Introduction
class CLedButton : public CButton (version 1.0)
This is a class which displays a LED that has 2 states: ON or OFF. The LED can have some text on its right. The LED is read-only (on user side) and cannot have focus (you should disable "tab stop" in the resource). The disabled state is not implemented: it is exactly like the enable state.
How to use CLedButton:
- To your dialog, add either a button, a checkbox or a radio button.
- Bind it to a member variable (of type
Control
) using Class Wizard.
- Then change in the header file, the class type to
CLedButton.
- In
InitDialog()
, bind your bitmap resource to the button: m_greenLed.SetImage( IDB_LEDBUTTON_GREEN, 15 );
- You can set or retrieve the state of the LED (ON or OFF) using the following member:
m_greenLed.Depress(TRUE);
m_greenLed.Depress(FALSE);
The bitmaps are given with the source code:
- greenButton.bmp
- redButton.bmp
Please visit: http://welcome.to/softbird for updates, other sources and more!
The sample project was compiled with Visual C++ 6 (MFC 4.2 ) and not tested with Unicode.