Hello,
Does PowerShell Studio sport a circular light/LED type On/Off indicator of any type. I'm not finding one in the Toolbox. Maybe there is a way to make a button circular and make that function of a light indicator?
Thanks.
Circular Light Indictor Widget
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Circular Light Indictor Widget
There is no build in or custom control set for this, but you could create your own.
It is possible to override the CheckBox's Paint event and draw an image, but that is a bit advanced. I recommend searching the web for C# examples.
If you were to use a Button with an image, you would have to track the state outside of the control and toggle the image within your script.
It is possible to override the CheckBox's Paint event and draw an image, but that is a bit advanced. I recommend searching the web for C# examples.
If you were to use a Button with an image, you would have to track the state outside of the control and toggle the image within your script.
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Circular Light Indictor Widget
I would just use an picture control and paint a circular color in the center. Set the paint color to red or green as needed. It shouldn't take more thanabout 5 lines of code.
You could also just add two images (LED) and set the image as needed.
A third possibility is to use the XAML/WPF custom control to host the WPF LED control.
You could also just add two images (LED) and set the image as needed.
A third possibility is to use the XAML/WPF custom control to host the WPF LED control.
Re: Circular Light Indictor Widget
Here is a quick and dirty example. You can resize the LED without changing the code.
Using images would allow you to use pictures of LEDs or stoplights as an annunciator/indicator.
Using images would allow you to use pictures of LEDs or stoplights as an annunciator/indicator.
- Attachments
-
- Demo-LED.psf
- (33.59 KiB) Downloaded 202 times
Re: Circular Light Indictor Widget
Here is a cute little toggle LED.
- Attachments
-
- Demo-LED2.psf
- (69.97 KiB) Downloaded 164 times
Re: Circular Light Indictor Widget
Same control and code but altered for new look in the designer.
- Attachments
-
- Demo-LED3.psf
- (35.04 KiB) Downloaded 177 times
Re: Circular Light Indictor Widget
Thanks Mr. V - nice idea.
So to add images we can use open button in PS studio and just add our BMP/JPG.
To add an image programmatically is it:
$checkboxONOFF.image = [System.Drawing.image]::FromFile('c:\redcircle.bmp')?
So to add images we can use open button in PS studio and just add our BMP/JPG.
To add an image programmatically is it:
$checkboxONOFF.image = [System.Drawing.image]::FromFile('c:\redcircle.bmp')?