|
|
Title | Make a tristate checkbox |
Description | This example shows how to make a tristate checkbox in Visual Basic 6. |
Keywords | tristate, tri-state, checkbox |
Categories | Controls |
|
|
In the CheckBox's MouseDown event handler, update the control's Value property to loop through checked, unchecked, and gray. Call the ReleaseCapture API function so the control doesn't receive a Click event and change its own state.
|
|
Private Declare Function ReleaseCapture Lib "user32" () As _
Long
Private Sub Check1_MouseDown(Button As Integer, Shift As _
Integer, X As Single, Y As Single)
Static working As Boolean
If working Then Exit Sub
working = True
Select Case Check1.Value
Case Unchecked
Check1.Value = Gray
Case Gray
Check1.Value = Checked
Case Checked
Check1.Value = Unchecked
End Select
working = False
ReleaseCapture
End Sub
|
|
|
|
|
|