A small value counter:
What's on the form:
What is it?
The coding:
The user can enlarge the textbox size manually or add code to it, as well as forecolor which I did not need.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
Project: Value Counter.zip





Reply With Quote
