Dim _mMaxReturnValue As Integer = 100
Dim _mReturnValue As Double
Dim _mValue2 As Integer = 0
Dim _maverage As Integer
Dim _mMax As Integer = 100
Dim _mMin As Integer = 0
Dim _mValue As Integer = 0
#Region "Value Properties"
Public Property MaxReturnValue() As Integer
Get
Return _mMaxReturnValue
End Get
Set(ByVal xvalue As Integer)
_mMaxReturnValue = xvalue
Me.Invalidate()
End Set
End Property
Public Function ReturnValue() As Integer
Return _mReturnValue
End Function
Public Property Maximum() As Integer
Get
Return _mMax
End Get
Set(ByVal xvalue As Integer)
_mMax = xvalue
If _mMax < Minimum Then Minimum = _mMax
If _mMax < Value Then Value = _mMax
Dim bull1 As Integer = Valuebulletl + 22 ' bullet=Left from Arrow spacing
Dim bull2 As Integer = Valuebulletr + ClientRectangle.Width * 0.3 + 1 'Bullet=Right Size 30 %
Dim zdiff As Integer = bull2 - bull1
_mMax = Me.Width - zdiff - 40 - Me.Height ' height increase width bullet
Me.Invalidate()
End Set
End Property
Public Function averages2() As Integer
Return _maverage
End Function
Public Property Minimum() As Integer
Get
Return _mMin
End Get
Set(ByVal xvalue As Integer)
_mMin = xvalue
If _mMin > Maximum Then Maximum = _mMin
If _mMin > Value Then Value = _mMin
_mMin = 0
Me.Invalidate()
End Set
End Property
<Category("Values"), Description("The control's value"),
DefaultValue(0)>
Public Property Value() As Integer
Get
Return _mValue
End Get
Set(ByVal xvalue As Integer)
_mValue = xvalue
If _mValue < Minimum Then _mValue = Minimum
If _mValue > Maximum Then _mValue = Maximum
Dim z As Double = (Maximum) / 100
_maverage = CInt(Value / z)
If _maverage < 1 Then
_mReturnValue = 0
Else
_mReturnValue = _mMaxReturnValue * (_maverage / 100)
End If
xvalue = _mValue
RaiseEvent ValueChanged()
Me.Invalidate()
End Set
End Property
Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
MyBase.OnResize(e)
'Resizing refreshes the graphics
Dim bull1 As Object = Me.Valuebulletl + 22
Dim bull2 As Object = Me.Valuebulletr + Me.Width * 0.3
Dim zdiff As Integer = bull2 - bull1 'width of bullet
Me.Maximum = Me.Width - zdiff - 40 - Me.Height
Me.Invalidate()
End Sub
Form1
Private Sub GScrollBar1_ValueChanged() Handles GScrollBar1.ValueChanged
Me.Pnlright.Width = CInt((Me.Width) * (100 - GScrollBar1.averages2) * (0.01)) - 13
TextBox1.Text = GScrollBar1.averages2
TextBox2.Text = GScrollBar1.ReturnValue
TextBox3.Text = GScrollBar1.Value
TextBox1.Refresh()
TextBox2.Refresh()
TextBox3.Refresh()
ListBox1.Refresh()
ListBox2.Refresh()
GScrollBar1.Refresh()
End Sub
Comments