0

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

Justin Boo
  • 10,132
  • 8
  • 50
  • 71

1 Answers1

0

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

Justin Boo
  • 10,132
  • 8
  • 50
  • 71
  • hi,Justin Boo.thanks for your reply.but it seem difference with my fanciful effect.I just want to Draw a separator line in a background image, it keep original solid effect. – user1414516 May 24 '12 at 10:58
  • @user1414516 then You need to post Your code and screenshot. Because it's hard to understand what You need. – Justin Boo May 24 '12 at 11:02
  • http://b219.photo.store.qq.com/psb?/V13URhpd0C6SQx/YiIEENKK2OfUlVDL8X1k2gXL70wV.3VU4eKv0fpSowU!/b/YTNXioKSPgAAYpJTjYJjPgAA – user1414516 May 24 '12 at 11:10
  • http://b219.photo.store.qq.com/psb?/V13URhpd0C6SQx/YiIEENKK2OfUlVDL8X1k2gXL70wV.3VU4eKv0fpSowU!/b/YTNXioKSPgAAYpJTjYJjPgAA – user1414516 May 24 '12 at 11:11
  • I will add this to Your question, but... I can't understand what You want.. ?? Explain more, what is in that screenshot? image behind NSBox or in it? Text? MAybe You are talking about border?? – Justin Boo May 24 '12 at 11:13
  • hi,Justin Boo.i already implement this effect.use a picture for it.thanks again for your eagerness. – user1414516 May 25 '12 at 01:44