是否可以在OSX中将自由形式的形状用作窗口? [英] Is it posible to use free form shapes as windows in OSX?

查看:76
本文介绍了是否可以在OSX中将自由形式的形状用作窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用自由形式的形状(例如,部分透明的图像)作为没有标准的关闭和最大化按钮的窗口背景.就像小部件一样.在OSX中有可能吗?我找不到有关此信息或使用此信息的应用程序的任何信息.

I want to use a free form shape (e.g. A partially transparent image) as a window backgound without the standard close and maximise buttons. Like the widgets do. Is that possible in OSX? I could not find any info on that or an app that uses this.

谢谢

推荐答案

是.您可以通过子类化NSWindow使其无边界和透明来实现此目的.您还将子类化NSView来绘制可见的自定义形状,然后将该视图的实例用作窗口的内容视图.结果将是一个窗口,其唯一可见的部分将是内容视图绘制的形状.

Yes. You can do this by subclassing NSWindow to make it borderless and transparent. You'll also subclass NSView to draw the visible custom shape, then use an instance of this view as the window's content view. The result will be a window whose only visible parts will be the shape your content view draws.

这是一个很好的带有示例的文章.

这篇关于是否可以在OSX中将自由形式的形状用作窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆