我想勾画出一个类似于Mission Control和Exposé的窗口。我创建了一个透明的自定义NSWindow
,其外观与this question类似,但我不希望用户与该窗口进行交互。概述系统窗口
有没有办法做到这一点?
下面是我的自定义NSWindow,我一直称与
windowOutline = [[WindowOutline alloc] initWithContentRect:rect styleMask:1 backing:NSBackingStoreBuffered defer:false];
[windowOutline makeKeyAndOrderFront:self];
[windowOutline drawRect:rect];
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)windowStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag
{
self = [super
initWithContentRect:contentRect
styleMask:NSBorderlessWindowMask
backing:bufferingType
defer:flag];
if (self)
{
[self setOpaque:NO];
[self setBackgroundColor:[NSColor clearColor]];
}
return self;
}
- (void)drawRect:(NSRect)frame {
frame = NSInsetRect(self.frame, 3.0, 3.0);
[NSBezierPath setDefaultLineWidth:6.0];
NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:frame
xRadius:6.0 yRadius:6.0];
[[NSColor redColor] set];
[path stroke];
}
你试过了什么?你可能会发布一些代码来陪伴你的描述吗? – Jules 2013-02-25 21:14:02
那里。添加它。 – agg23 2013-02-25 21:30:36