CLedButton






4.47/5 (10投票s)
2000 年 3 月 4 日

286931

4909
一个看起来像LED的按钮。
引言
class CLedButton : public CButton (version 1.0)
这是一个显示LED的类,具有两种状态:开启或关闭。LED可以在其右侧显示一些文本。LED是只读的(用户端),并且不能获得焦点(您应该在资源中禁用“选项卡停靠”)。禁用状态未实现:它与启用状态完全相同。
如何使用CLedButton
- 在您的对话框中,添加一个按钮、复选框或单选按钮。
- 使用“类向导”将其绑定到成员变量(类型为
Control
)。 - 然后在头文件中,将类类型更改为
CLedButton
。 - 在
InitDialog()
中,将您的位图资源绑定到按钮。m_greenLed.SetImage( IDB_LEDBUTTON_GREEN, 15 ); //15 is the width of one image in the bitmap
- 您可以使用以下成员设置或检索LED的状态(开启或关闭)。
m_greenLed.Depress(TRUE); //ON (second image in bitmap) m_greenLed.Depress(FALSE); //OFF (first image in bitmap)
位图随源代码提供。
- greenButton.bmp
- redButton.bmp
请访问: http://welcome.to/softbird 以获取更新、其他资源和更多信息!
示例项目使用 Visual C++ 6 (MFC 4.2) 编译,未用 Unicode 测试过。