绘制在Mac OS X的桌面上 [英] Drawing on desktop in Mac OS X

查看:128
本文介绍了绘制在Mac OS X的桌面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建程序的模拟 conky

I want to create analog of program conky. What is the best way to draw information on a OS X desktop?

推荐答案

NSWindow有一个方法, setLevel:,它允许您控制窗口相对于其他窗口的位置。从我自己的经验,你可能想尝试喂它 kCGDesktopIconWindowLevel ,并调用 setHasShadow:NO 想。要实际做图,你会在你的窗口中放一个自定义的NSView子类,并创建一个没有框架的窗口(见 NSBorderlessWindowMask )和transparent( window setBackgroundColor:[NSColor clearColor]],[self setOpaque:NO]; )。

NSWindow has a method, setLevel:, that lets you control how the window is positioned compared to other windows. From my own experience, you might want to try feeding it kCGDesktopIconWindowLevel, and calling setHasShadow:NO to implement the look you want. To actually do the drawing you would put a custom NSView subclass in your window, and create the window without a frame (see NSBorderlessWindowMask) and transparent ([window setBackgroundColor:[NSColor clearColor]], [self setOpaque:NO];).

你可能还需要一个< =http://www.cocoadev.com/index.pl?DontExposeMe =nofollow noreferrer>查看这篇文章,以在Expose事件期间将您的窗口固定到桌面。

You might also want to take a look at this article to keep your window pinned to the desktop during an Expose event.

这篇关于绘制在Mac OS X的桌面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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