user1414516
user1414516

Reputation: 3

transparent separator line based on nsbox

I have a problem with separator line, it is based on NSBox, I use a regular NSBox with its Box Type set to "Custom" and border type set to "Groove".

In the case of not painting the background, it's fine.

But if to draw the background, Can not be a transparent background

How to implement like transparent background effect?

Like this:

Screenshot

Upvotes: 0

Views: 794

Answers (1)

Justin Boo
Justin Boo

Reputation: 10198

You can do it by setting color with alpha like this:

[boxOutlet setFillColor:[NSColor colorWithCalibratedRed:0 green:0 blue:0 alpha:0.5]];

It will fill NSBox with black 50% transparency. Alpha is opacity value.
Note: boxOutlet is IBOutlet of NSBox.

Result:

Screenshot

Upvotes: 0

Related Questions