Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LED like buttons

Status
Not open for further replies.

OzzieGeorge

Programmer
Jan 14, 2005
2,590
0
36
AU
A newbie question I have dabbled in the past and do a bit in VBA but this is only my second excursion into VB and I get stuck almost straight away.

I need to place on a form some "led" like indicators that I can illuminate either red or green depending on certain conditions. Can anyone point me to where I could find such a thing?

Any help greatly appreciated.
 
Use a Shape object with its shape property set to Circle. Set its FillColor property as required (VBRed, VBGreen etc)

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
I wanted to use mousemove to allow me to show which led style button the mouse was on but that doesn't seem to work with a shape. Am I doing something wrong or is that not possible? If not, is there another solution?
 
If you want to get events then the easy way is to use a Command Button with its Style set to Graphical and its Picture property set to a suitable GIF (produced in your favourite picture editor. You can use the MaskColor and UseMaskColor properties to get a round image in your button.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
If you don't want the border then you could also use an Image control.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Any of this work for you OzzieGeorge?

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Hi

I decided to go with using a control button which I have left square as there are 8 rows of 32 of them. I am still trying to work out how best to switch colours as I am unsure how to include the coloured bit map when it gets compiled. Still a lot to do on it though. Most of the writing I have done has been in VBA with excel, so expect lots more questions.
 
Ok if you are happy with them square; set Style to Graphical and then just use the Backcolor property to set the color (you will not need to use bitmaps).
 
Speaking as someone has been red/green colorblind for a great many years - stay away from this !! I can think of not many things more annoying then seeing a lit LED, and wondering what is wrong, never knowing that there were didfferent colors on it ...
 
[,,,]there are 8 rows of 32 of them [...]
Most of the writing I have done has been in VBA with excel [...]
Now, since you are using VB, try to put all of your command buttons in a control array(s), I don't think you had this option in VBA.
It will make your coding a LOT easier since you will have just one _Click event for all controls in an array.

Have fun.

---- Andy
 
Put a transparent label over the "Led button" and use the mouse move or click on that. Make sure the label is 'to the front' using Format/Order

Also I put a tiny yellow dot (a tiny line) slightly off center on the "led" button that gives it a three dimensional look of a reflection of light on a spherical surface.
 
I thought it was possible to change the default images used on a standard VB checkbox, or am I dreaming it? That way you could have a green LED for checked and red for unchecked.

- Andy
___________________________________________________________________
If you think nobody cares you're alive, try missing a couple of mortgage payments
 
jzr makes an important point, and I couldn't agree more: color should NOT be considered a reliable indicator of state by itself. An alternative, such as a numeric reading, should be provided.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top