开发者

Can I make a button/icon in a MFC toolbar that can't be clicked?

开发者 https://www.devze.com 2023-02-01 01:01 出处:网络
I have a subclass of CMFCToolBa开发者_如何学Pythonr that contains a few buttons, one for toggling a setting and the others for displaying the current state (shown one at a time). I need the other butt

I have a subclass of CMFCToolBa开发者_如何学Pythonr that contains a few buttons, one for toggling a setting and the others for displaying the current state (shown one at a time). I need the other buttons to not be clickable- if the user clicks on them, they should not depress. Is there a way to prevent a button from depressing without making it disabled (because then it is grayed out) or to add an icon to a toolbar that has no interaction?


It's been a while since I've done MFC, so I'm not too sure of the name, of the control, but I think you can put an icon in a CLabel (or maybe CLabelImage). You don't want to use a button for this because a button is supposed to be clicked, i.e., it looks push-able. You want something like a label that just shows state, that's what labels are for.


Would it be easier - and potentially saner - to just handle the button press event and reset the button state, and then do nothing

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号