单击时无边框 NSButton 变为灰色 [英] Borderless NSButton turns gray when clicked

查看:36
本文介绍了单击时无边框 NSButton 变为灰色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个带有图像集的三个 NSButton 的小应用程序.这些按钮没有边框也没有背景.然而,当我点击一个按钮时,它会变成一个灰色的矩形.

I am making a little application with three NSButtons with an image set. These buttons have no border nor background. However, when I click a button it turns into a gray rectangle.

我该如何解决这个问题?谢谢.

How can I fix this? Thanks.

推荐答案

使您的按钮类型为 NSMomentaryChangeButton.

[myBtn setButtonType:NSMomentaryChangeButton];

如果您使用 NSMomentaryPushInButton,那么单击时您可能会在按钮上看到灰色矩形.

If you use NSMomentaryPushInButton then you may get gray rectangle over the button when click.

这篇关于单击时无边框 NSButton 变为灰色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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