使无边框窗口与较大的阴影 [英] Make borderless window with darker larger shadow

查看:96
本文介绍了使无边框窗口与较大的阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当窗口在无边框窗口中激活时如何创建更暗和更大的阴影?

How to create darker and larger shadow when window becomes active in borderless window?

我把NSWindow子类化,我的窗口变成主窗口和关键窗口,但这不是帮助.. shadow还是很小。所以也许有人知道如何解决这个问题?我也尝试过无效阴影,但这也没有帮助太..

I subclassed NSWindow and my window becomes main window and key window but that's not helping.. shadow still small. So maybe someone knows how to fix this? I also tried invalidate shadow, but that didn't help too..

子类别NSWindow:

Subclassed NSWindow:

- (id)initWithContentRect:(NSRect)contentRect
            styleMask:(NSUInteger)windowStyle
              backing:(NSBackingStoreType)bufferingType
                defer:(BOOL)flag
{

    self = [super initWithContentRect: contentRect
                  styleMask: NSBorderlessWindowMask 
                    backing: NSBackingStoreBuffered
                      defer: NO];

    if(self)
    {
        [self setHasShadow:YES];

        [self setBackgroundColor:[NSColor clearColor]];
        [self setOpaque:NO];
    }   

return self;
}


推荐答案

styleMask。如果设置为NSTitledWindowMask,窗口会得到一个更大的阴影。

This is tied to the window's styleMask. If it is set to NSTitledWindowMask window will get a larger shadow.

这篇关于使无边框窗口与较大的阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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