简体   繁体   中英

Drawing a transparent NSView in NSWindow with black background

I have a NSView inside a NSWindow and the background of NSWindow is set to black (with alpha of 0.7). Is there anyway to have the NSView showing what's underneath the NSWindow ? In other words, how do I make the part where NSWindow and NSView overlap to have clear background?

Thanks!

您可以尝试setOpaque方法

If I understand properly, it seems like you're trying to have a window with hole in it. You can take a look at apple's sample code Round Transparent Window . It shows how to add transparent areas to an NSWindow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM