ARTICLE
VB.Net Custom Dial Control - Revised
The VB.Net Custom Dial Control is a custom dial control written using GDI+ and VB.Net. This article and the attached source code is a revised version of my previous article with an extended version of the control.
Download
Files:
Learning new aspects of Visual Studios Designer I made this control and added designer support for the control. Each dial control now has the following properties to allow easy access to the control being used:
- Minimum - Used to set the dial minimum value property.
- Maximum - Used to set the dials maximum value property.
- ShowText - Shows text inside the dial.
- DialPosition - Current value of the dial being used.
- PositionInc - Allows the dials increment value to be changed.
Code Excerpt:
'<summary>
'Maximum value of dial.
'</summary>
<CategoryAttribute("Appearance"), DescriptionAttribute("Set maximum value of dial to?"), DefaultValueAttribute(359.5f)> _
Public
Property Maximum() As Single
Get
Return maximum
End Get
Set
If DialPosition Value Then
DialPosition = Value
End If
maximum = Value
End Set
End Property '<summary>
'Counts get and set
</summary>
<CategoryAttribute("Appearance"), DescriptionAttribute("Sets starting value of dial to?"), DefaultValueAttribute(0.5f)> _
Public Property DialPosition() As Single
Get
Return dialPosition
End Get
Set dialPosition = Value
If DialPosition = Maximum Then
dialPosition = maximum
End If If
DialPosition < Minimum Then
dialPosition = minimum
End If
If DialPosition Maximum Then
dialPosition = maximum
End If
Me.Refresh()
OnValueChanged(Me)
End Set
End Property NOTE: THIS ARTICLE IS CONVERTED FROM C# TO VB.NET USING A CONVERSION TOOL. ORIGINAL ARTICLE CAN BE FOUND ON C# CORNER (WWW.C-SHARPCORNER.COM).