Click here to Skip to main content
11,702,939 members (60,279 online)
Click here to Skip to main content

CLedButton

, 3 Mar 2000 201.9K 3.7K 74
Rate this:
Please Sign up or sign in to vote.
A button that looks like a LED.

Sample Image - CLedButton.jpg

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:

  1. To your dialog, add either a button, a checkbox or a radio button.
  2. Bind it to a member variable (of type Control) using Class Wizard.
  3. Then change in the header file, the class type to CLedButton.
  4. In InitDialog(), bind your bitmap resource to the button:
    m_greenLed.SetImage( IDB_LEDBUTTON_GREEN, 15 );
    //15 is the width of one image in the bitmap
  5. You can set or retrieve the state of the LED (ON or OFF) using the following member:
    m_greenLed.Depress(TRUE);  //ON  (second image in bitmap)
    m_greenLed.Depress(FALSE); //OFF (first image in bitmap)

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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Benjamin Mayrargue
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralKingPower Pin
KingPeng25-Jun-06 1:57
memberKingPeng25-Jun-06 1:57 
GeneralRe: KingPower Pin
zaodt8-May-07 8:29
memberzaodt8-May-07 8:29 
GeneralCorrected Class Pin
Devil for ever18-May-06 9:36
memberDevil for ever18-May-06 9:36 
GeneralAnomally behavior with several controls Pin
Anonymous6-Mar-05 22:48
sussAnonymous6-Mar-05 22:48 
GeneralProblem with CFormView Pin
Seve Ho21-Jul-04 21:31
memberSeve Ho21-Jul-04 21:31 
QuestionHow to get Tab order and garyed status Pin
tiousi18-Dec-03 6:45
membertiousi18-Dec-03 6:45 
Generaldynamically creation of CLedButton Pin
silverspoon15-Jul-02 3:15
membersilverspoon15-Jul-02 3:15 
GeneralLedButtons with Dialog BAr Pin
murd26-Jan-02 5:14
membermurd26-Jan-02 5:14 
GeneralPoor Plagiarism Pin
Bill Gates Antimatter Particle25-Nov-01 7:15
memberBill Gates Antimatter Particle25-Nov-01 7:15 
GeneralRe: Poor Plagiarism Pin
Shaun Harrington21-Feb-06 13:12
memberShaun Harrington21-Feb-06 13:12 
GeneralRed - Green Toggle Pin
MarkKozel6-Nov-01 12:09
memberMarkKozel6-Nov-01 12:09 
GeneralMinor alignment bug... Pin
Kevin Pinkerton6-Jun-01 6:01
memberKevin Pinkerton6-Jun-01 6:01 
GeneralRe: Minor alignment bug... Pin
Anonymous6-Jun-01 8:30
memberAnonymous6-Jun-01 8:30 
QuestionIf I do dialog docking, how I can show LED Button and control? Pin
Heon30-Mar-01 18:02
memberHeon30-Mar-01 18:02 
AnswerRe: If I do dialog docking, how I can show LED Button and control? Pin
Anonymous6-Jun-01 5:22
memberAnonymous6-Jun-01 5:22 
Generalcledbutton Pin
Kunle Adeleye18-Jun-00 14:43
sussKunle Adeleye18-Jun-00 14:43 
GeneralRe: cledbutton Pin
Benjamin Mayrargue20-Jul-00 6:53
sussBenjamin Mayrargue20-Jul-00 6:53 
GeneralRe: cledbutton Pin
Kevin Pinkerton6-Jun-01 3:35
memberKevin Pinkerton6-Jun-01 3:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150819.1 | Last Updated 4 Mar 2000
Article Copyright 2000 by Benjamin Mayrargue
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid