Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1449

A small, no fancy checkbox

$
0
0
Someone ask for a simple checkbox with click and value. Nothing professional...
Small and to the point:

Code:

Option Explicit

Const m_def_Value = True
Dim m_Value As Boolean
Event Click()
Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Event Change()


Public Property Get Value() As Boolean
  Value = m_Value
End Property

Public Property Let Value(ByVal New_Value As Boolean)
  m_Value = New_Value
  PropertyChanged "Value"
  True_or_False
End Property

Private Sub FalseVal_Click()
 
  RaiseEvent Click
  True_or_False

End Sub

Private Sub TrueVal_Click()
 
  RaiseEvent Click
  True_or_False
 
End Sub

Private Sub UserControl_Initialize()

  UserControl.Width = TrueVal.Width
  UserControl.Height = TrueVal.Height
     
  TrueVal.Visible = False

End Sub

Function True_or_False()

  If TrueVal.Visible = False Then
      TrueVal.Visible = True
      FalseVal.Visible = False
      m_Value = False
  Else
      TrueVal.Visible = False
      FalseVal.Visible = True
      m_Value = True
  End If

End Function

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

  m_Value = PropBag.ReadProperty("Value", m_def_Value)
 
End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

  Call PropBag.WriteProperty("Value", m_Value, m_def_Value)
 
End Sub

Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  RaiseEvent MouseMove(Button, Shift, X, Y)
End Sub

Private Sub FalseVal_Change()
  RaiseEvent Change
End Sub

Private Sub TrueVal_Change()
  RaiseEvent Change
End Sub

I have two .gif's, created within excel, Paste it into Irfanview, Auto crop, save as .GiF

The pictures can be any size of your choice. One picture have a mark (TrueVal) and the other just an open block(FalseVal).
Place the images to 0,0 No matter which is above or not.

Others can make the code more useful as I'm not experienced in this kind of coding :)

Viewing all articles
Browse latest Browse all 1449

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>