如何在某些窗口上放置一些标签?
我需要从我的应用程序中标记一些打开的窗口。我可以获得 Windows 列表、它们的系统 ID、名称、所有者...我可以仅在选定的窗口上绘制一些 NSImage 吗?
I need to mark some opened window from my application. I can get the windows list, their system id, name, owner... Can I draw some NSImage only on choosen window?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有一个窗口,正如您所说,您可以添加一个 NSImageView 作为该窗口的子视图。这个 NSImageView 应该设置为具有与相关窗口大小相同的框架,以便它填充窗口。
如果您需要进行自定义绘图,您可以子类化
NSImageView
并重写其drawRect:
方法,或者您可以将其 image 属性设置为您已经创建并添加的图像到应用程序包。希望这就是你的意思。
If you have a window, as you say you do, you could add a
NSImageView
as a subview of that window. ThisNSImageView
should be set to have a frame the same size as the window in question so it fills the window.If you need to do custom drawing you could subclass the
NSImageView
and override itsdrawRect:
method or you could just set its image property to an image that you have already created and added to the apps bundle.Hope this is what you mean.