Results 1 to 1 of 1

Thread: A small, no fancy checkbox

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2017
    Location
    South Africa (in the middle)
    Posts
    160

    Lightbulb A small, no fancy checkbox

    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

    Project: CheckJJ.zip
    Last edited by Inside; Aug 26th, 2017 at 04:57 AM. Reason: Adding Project
    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
  •  



Click Here to Expand Forum to Full Width