我想勾畫出一個類似於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