开发者

Does strokeRect: of NSBezierPath always draw a transparent rect? (Cocoa OSX)

开发者 https://www.devze.com 2022-12-25 05:57 出处:网络
I am trying to make a custom selection box for an image view I created and I am trying to use strokeRect: from NSBezierPath but it always seems to be transparent.Called the method set to set the color

I am trying to make a custom selection box for an image view I created and I am trying to use strokeRect: from NSBezierPath but it always seems to be transparent. Called the method set to set the color the blackColor and then also tried using olorWithDeviceRed:green:blue:alpha: but no matter what I have tried the rectangle created alway开发者_JAVA百科s seems to be transparent. Is there a better method to use to draw an empty rectangle?


Are you seeing the boundaries of your strokeRect:?

All +strokeRect: does is draw the outside edge defined by the rect. If you want to fill that rect as well you would need to call [NSBezierPath fillRect:rect]. In this case it will use the current fill color. Calling -set on a color sets the stroke and fill color but if you want to set it individually you'd call -setFill on your color object.

0

精彩评论

暂无评论...
验证码 换一张
取 消