Share via


How to insert a tool in c# form that works as a light which goes on and off according to button_Click()

Question

Monday, April 21, 2014 7:47 PM

I have two methods. I want to add some tool.. (like a button, or an image or anything appropriate) that works as a light indicator. When I click on one of the buttons, one of the button lights up and when second method is getting accessed in background, second tool should light up. Any idea how it can be done?

-.NET Forum

All replies (3)

Monday, April 21, 2014 10:40 PM ✅Answered | 1 vote

perhaps something as simple as two small (say, 10 x 10) labels which can take on either of three colors:  Gray (indicating inactive state), Red (indicating a problem of some sort), Green (indicating all is well)  ?

Both LEDs are controlled by a function taking two arguments( label identity (say, 1 or 2) & new State (Gray, Green or Red).

A public function pointer referencing this function is available to anyone wishing to change the LED state.


Tuesday, April 22, 2014 5:41 AM ✅Answered

Hi Gaurav_Kul21,

Thanks for your post.

What is your project type? Winform project or any other project?
If it is winform project, just change the button background image in your button click event.

Use this method:

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.click(v=vs.110).aspx

And this property:

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.backgroundimage(v=vs.110).aspx

Regards,

Barry Wang
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.


Monday, April 21, 2014 8:46 PM

Hiya,

 Are you designe an UI? This really is not the forum for UI developments. Sorry.