CToolbar的按钮启用与禁用(enable/disable)
2014-07-25 17:08
465 查看
当前我使用到的有效的方式是:
通过发消息的方式
禁用某个Toolbar中的按钮,例如ID为 IDC_BUTTON_ADD,Toolbar对像为m_wndToolBar,设置fsState为TBSTATE_INDETERMINATE
启用某个Toolar按钮,设置fsState为TBSTATE_ENABLED
参见MSDN中,fsState的说明,还可以设置其它的状态,例如 HIDDEN
TBSTATE_CHECKED
The button has the TBSTYLE_CHECK style and is being clicked.
TBSTATE_ELLIPSES
Version 4.70. The button's text is cut off and an ellipsis is displayed.
TBSTATE_ENABLED
The button accepts user input. A button that doesn't have this state is grayed.
TBSTATE_HIDDEN
The button is not visible and cannot receive user input.
TBSTATE_INDETERMINATE
The button is grayed.
TBSTATE_MARKED
Version 4.71. The button is marked. The interpretation of a marked item is dependent upon the application.
TBSTATE_PRESSED
The button is being clicked.
TBSTATE_WRAP
The button is followed by a line break. The button must also have the TBSTATE_ENABLED state.
Owed by: 春夜喜雨 http://blog.csdn.net/chunyexiyu 转载请标明来源
通过发消息的方式
禁用某个Toolbar中的按钮,例如ID为 IDC_BUTTON_ADD,Toolbar对像为m_wndToolBar,设置fsState为TBSTATE_INDETERMINATE
TBBUTTONINFO tbinfo; tbinfo.cbSize = sizeof(TBBUTTONINFO); tbinfo.dwMask = TBIF_STATE; <span style="color:#000099;"><strong>tbinfo.fsState = TBSTATE_INDETERMINATE; </strong></span> ::SendMessage(<strong><span style="color:#000099;">m_wndToolBar.GetSafeHwnd()</span></strong>, TB_SETBUTTONINFO,<strong><span style="color:#000099;">(WPARAM)IDC_BUTTON_ADD</span></strong>,(LPARAM)&tbinfo);
启用某个Toolar按钮,设置fsState为TBSTATE_ENABLED
TBBUTTONINFO tbinfo; tbinfo.cbSize = sizeof(TBBUTTONINFO); tbinfo.dwMask = TBIF_STATE; <span style="color:#000099;"><strong>tbinfo.fsState = TBSTATE_ENABLED; </strong></span> ::SendMessage(<strong><span style="color:#000099;">m_wndToolBar.GetSafeHwnd()</span></strong>, TB_SETBUTTONINFO,<strong><span style="color:#000099;">(WPARAM)IDC_BUTTON_ADD</span></strong>,(LPARAM)&tbinfo);
参见MSDN中,fsState的说明,还可以设置其它的状态,例如 HIDDEN
TBSTATE_CHECKED
The button has the TBSTYLE_CHECK style and is being clicked.
TBSTATE_ELLIPSES
Version 4.70. The button's text is cut off and an ellipsis is displayed.
TBSTATE_ENABLED
The button accepts user input. A button that doesn't have this state is grayed.
TBSTATE_HIDDEN
The button is not visible and cannot receive user input.
TBSTATE_INDETERMINATE
The button is grayed.
TBSTATE_MARKED
Version 4.71. The button is marked. The interpretation of a marked item is dependent upon the application.
TBSTATE_PRESSED
The button is being clicked.
TBSTATE_WRAP
The button is followed by a line break. The button must also have the TBSTATE_ENABLED state.
Owed by: 春夜喜雨 http://blog.csdn.net/chunyexiyu 转载请标明来源
相关文章推荐
- VC中按钮控件的启用(enable)和禁用(disable)(转载)
- VC中按钮控件的启用(enable)和禁用(disable)
- 在VC中编程实现按钮的启用(enable)和禁用(disable)
- 程序实现启用/禁用设备(驱动)enable/disable device with windows api
- jquery disable按钮(启用、禁用按钮)
- 程序实现启用/禁用设备(驱动)enable/disable device with windows api
- 程序实现启用/禁用设备(驱动)enable/disable device with windows api
- repeater实现样式设置,并添加删除按钮,参考课上老师做的案例。数据表添加字段status,使用repeater实现禁用与启用。repeater添加编辑按钮,和Edit.aspx页面。
- Windows 10下WLAN突然不能连接(按那个启用禁用蓝牙的按钮也没有用)的问题
- c# 禁用和启用windows form窗体上的关闭按钮
- XtraReports Suite:Auto-Disable the Parameters button on Silverlight DocumentPreview control(在Silverlight文档预览控件中禁用参数按钮)
- javascript按钮禁用和启用的效果
- 如何修改SpriteBuilder中的按钮禁用启用状态
- 点击一个按钮后禁用按钮,执行完事件后再启用按钮
- javascript按钮禁用和启用的效果
- 如何修改SpriteBuilder中的按钮禁用启用状态
- jQuery实现禁用启用按钮
- 点击一个按钮后禁用按钮,执行完事件后再启用按钮
- Jquery禁用/启用按钮与文本框代码
- javascript按钮禁用和启用的效果