How to make knob track of a NSScroller transparent?

1.1k views Asked by At

enter image description here

This is my application screenshot.There is only one NSScrollView on the window.I have made the other parts of the scrollview transparent,except the knob slot.

Here is my draw code for custom NSScroller subclass.

- (void) drawRect: (NSRect)dirtyRect
{
    [[NSColor clearColor] set];
    NSRectFill(dirtyRect);

    [self drawKnob];
}

Does anyone have a clue to make this work? Thanks a lot.

1

There are 1 answers

0
Li Fumin On BEST ANSWER

OK,I solve this myself.Here is the code.

- (void) drawRect: (NSRect)dirtyRect
{
    NSDrawWindowBackground([self bounds]);
    [self drawKnob];
}

Though it is not really transparent, but the effect is what I want.