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

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

问题描述

我使用三个NSButtons做一个小的应用程序与图像集。这些按钮没有边框和背景。但是,当我点击一个按钮,它变成一个灰色的矩形。

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

Make your button type as NSMomentaryChangeButton.

[myBtn setButtonType:NSMomentaryChangeButton];

如果您使用NSMomentaryPushInButton,那么当您点击时,您可能会在按钮上显示灰色矩形。

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

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

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