[英]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). 我有一个NSView
一个内部NSWindow
和背景NSWindow
设置为黑色(具有0.7的α)。 Is there anyway to have the NSView
showing what's underneath the NSWindow
? 无论如何,是否有NSView
显示NSWindow
下面的内容? In other words, how do I make the part where NSWindow
and NSView
overlap to have clear background? 换句话说,如何使NSWindow
和NSView
重叠的部分具有清晰的背景?
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 . 您可以看一下苹果的示例代码Round Transparent Window 。 It shows how to add transparent areas to an NSWindow. 它显示了如何向NSWindow添加透明区域。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.