Custom switch for app Windows Forms .NET
After compile the control in release mode, in ..Bin/Release there will be a .dll file. In my case "Interruttore.dll".
Insert the Switch control into the ToolBox in Visual Studio
- Open Visual Studio's Toolbox,
- Right mouse button and click in "Choose items" (Scegli elementi in Italian Language)
- In the tab ".NET Framework Component", click in Open (Sfoglia in Italian Language)
- Go to Bin/Relese directory of SwitchControl and click in dll file
- Click OK and the control is addedd in your ToolBox.
Add Switch Control in Forms
For add the control in Windows Forms, you can drag and drop the control from ToolBox in Windows Forms
Events Of Control
The control generates two events:
Private Sub Interruttore1_SwitchOFF() Handles Interruttore1.SwitchOFF
and Private Sub Interruttore1_SwitchON() Handles Interruttore1.SwitchON
Property Of Control
The control has some property:
State:
This property get or set the status of the control. Is possibile change this value from code and Property Box of control in the Appearance categoryNoTextState:
This property display or hides the control status text.
Basic Example of functionality:
In the Off Event
PictureBox1.Image = My.Resources.spenta
In the On Event
PictureBox1.Image = My.Resources.accesa
This project was created for educational purposes only. It is available to everyone for download and is open to modifications.
My name is Marco Puccio, I am a software developer from Palermo. I love technology in all its forms. I also deal with IT teaching.