-
Aug 23rd, 2017, 11:57 AM
#1
Thread Starter
Addicted Member
Value Counter User Control
A small value counter:
What's on the form:
What is it?
The coding:
Code:
'Default Property Values:
Const m_def_Value = 0
'Property Variables:
Dim m_Value As Integer
'Event Declarations:
Event DownClick(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=ThisCountDown,ThisCountDown,-1,MouseUp
Event UpClick(Button As Integer, Shift As Integer, X As Single, Y As Single) 'MappingInfo=ThisCountUp,ThisCountUp,-1,MouseUp
Public Property Get Value() As Integer
Value = m_Value
End Property
Public Property Let Value(ByVal New_Value As Integer)
m_Value = New_Value
PropertyChanged "Value"
CounterLabel.Text = m_Value
End Property
Private Sub UserControl_InitProperties()
m_Value = m_def_Value
UserControl.Height = ThisCountUp.Height - 20
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
m_Value = PropBag.ReadProperty("Value", m_def_Value)
CounterLabel.BackColor = PropBag.ReadProperty("BackColor", &H80000005)
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("Value", m_Value, m_def_Value)
Call PropBag.WriteProperty("BackColor", CounterLabel.BackColor, &H80000005)
End Sub
Public Property Get BackColor() As OLE_COLOR
BackColor = CounterLabel.BackColor
End Property
Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
CounterLabel.BackColor() = New_BackColor
PropertyChanged "BackColor"
End Property
Private Sub ThisCountDown_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent DownClick(Button, Shift, X, Y)
CounterLabel.Text = Val(CounterLabel.Text) - 1
m_Value = Val(CounterLabel.Text)
End Sub
Private Sub ThisCountUp_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent UpClick(Button, Shift, X, Y)
CounterLabel.Text = Val(CounterLabel.Text) + 1
m_Value = Val(CounterLabel.Text)
End Sub
The user can enlarge the textbox size manually or add code to it, as well as forecolor which I did not need.
Project: Value Counter.zip
Last edited by Inside; Aug 26th, 2017 at 04:58 AM.
Reason: Adding Project
Programmers are very patient people....while programming....but don't expect them to be patient all the time
-
Oct 14th, 2017, 04:17 PM
#2
Lively Member
Re: Value Counter User Control
Nice control. I needed something similar with a tiny vertical slider to adjust the values (like in the older mediachance realdraw program). Thanks once again.
-
Oct 14th, 2017, 09:42 PM
#3
Thread Starter
Addicted Member
Re: Value Counter User Control
Thanks.
It's very basic and other features can be added easily.
Programmers are very patient people....while programming....but don't expect them to be patient all the time
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|