| title | CheckMark |
|---|---|
| parent | VB Package |
| permalink | /tB/Packages/VB/CheckMark/ |
| has_toc | false |
{: .no_toc }
A CheckMark is a windowless control that draws a single check glyph --- checked, unchecked, or grey --- that scales to fill its rectangle. Unlike CheckBox, it has no caption, no font, and cannot take focus or receive keyboard input; it is essentially the box from a check-box rendered at whatever size the layout requires. This makes it especially useful inside reports and other dense layouts where the fixed-size system check would look out of place, but it is also available on a Form or UserControl.
The default property is Value and the default event is Click.
Private Sub Form_Load()
Check1.Value = vbUnchecked
End Sub
Private Sub Check1_Click()
Debug.Print "Check is now: " & Check1.Value
End Sub
- TOC {:toc}
Value is typed as CheckBoxConstants:
| Constant | Value | Meaning |
|---|---|---|
| vbUnchecked | 0 | The check is cleared. |
| vbChecked | 1 | The check is selected. |
| vbGrayed | 2 | The check is in an indeterminate (grey) state. |
A user click toggles Value between vbChecked and vbUnchecked only. The grey state is reachable from code --- assign vbGrayed to Value to display it.
Check1.Value = vbGrayed ' show the indeterminate state
VisualStyles selects how the glyph is rendered:
- VisualStyles = False (default) --- drawn with the GDI DrawFrameControl primitive. Honours Appearance: vbAppear3d uses the classic raised/sunken look, vbAppearFlat uses a single-pixel outline. A disabled check, or one in the vbGrayed state, is drawn over the dotted three-state pattern.
- VisualStyles = True --- drawn through the OS theme engine (UXTHEME), so the glyph uses the current visual-style theme. Appearance is ignored in this mode.
BackStyle controls whether the rectangle behind the glyph is filled before the glyph is drawn:
- vbBFTransparent (default) --- only the glyph is painted; whatever the container draws shows through.
- vbBFOpaque --- the rectangle is filled with BackColor first.
{: .no_toc }
The Anchors object that determines which sides of the control follow the corresponding sides of its container as the container is resized. Read-only --- set the individual sides through the returned object.
{: .no_toc }
How the glyph is shaded when VisualStyles is False. A member of AppearanceConstants: vbAppear3d (default) or vbAppearFlat. Ignored when VisualStyles is True.
{: .no_toc }
The background colour, as an OLE_COLOR. Defaults to the system 3-D face colour. Used only when BackStyle is vbBFOpaque.
{: .no_toc }
Whether the control fills its rectangle before drawing the glyph. A member of BackFillStyleConstants: vbBFTransparent (default) or vbBFOpaque.
{: .no_toc }
The immediate container (a Form, Frame, PictureBox, or other container control) that hosts this CheckMark. Assigning a new value with Set moves the control to a different container.
{: .no_toc }
A read-only ControlTypeConstants value identifying this control as a check mark. Always vbCheckMark.
{: .no_toc }
Whether the control fills one edge of, or the entire interior of, its container. A member of DockModeConstants, default vbDockNone.
{: .no_toc }
A StdPicture used as the mouse cursor while the control is being drag-and-dropped (see Drag and DragMode).
{: .no_toc }
Whether the control should drag itself when the user holds the mouse over it. A member of DragModeConstants: vbManual (0, default --- call Drag from code) or vbAutomatic (1).
{: .no_toc }
Determines whether the control reacts to mouse input. A disabled CheckMark still shows its current value but is drawn dimmed and ignores clicks. Boolean, default True.
{: .no_toc }
The control's height, in twips by default (or in the container's ScaleMode units). Single.
{: .no_toc }
When the control is part of a control array, the Long zero-based index of this instance within the array. Reading Index on a control that is not part of an array raises run-time error 343 (Object not an array). Read-only at run time.
{: .no_toc }
The horizontal distance from the left edge of the container to the left edge of the control. Single.
{: .no_toc }
A StdPicture used as the mouse cursor when MousePointer is vbCustom and the pointer is over the control.
{: .no_toc }
The mouse cursor shown when the pointer is over the control. A member of MousePointerConstants.
{: .no_toc }
The unique design-time name of the control on its parent form. Read-only at run time.
{: .no_toc }
A reference to the Form (or UserControl) that contains this control. Read-only.
{: .no_toc }
Note
Reserved for compatibility with VB6; not currently implemented in twinBASIC. The control is not focusable, so the property has no effect at run time.
{: .no_toc }
A free-form String the application can use to associate custom data with the control. Ignored by the framework.
{: .no_toc }
A multi-line String displayed as a tooltip when the user hovers over the control.
{: .no_toc }
The vertical distance from the top of the container to the top of the control. Single.
{: .no_toc }
The current state of the check. Default property.
Syntax: object.Value [ = value ]
value : A member of CheckBoxConstants: vbUnchecked (0), vbChecked (1), or vbGrayed (2).
A user click toggles Value between vbChecked and vbUnchecked only; vbGrayed is settable from code.
{: .no_toc }
Whether the control is shown. Boolean, default True.
{: .no_toc }
When True, the glyph is drawn through the OS theme engine; when False (default), it is drawn with DrawFrameControl and obeys Appearance. Boolean.
{: .no_toc }
A Long identifying a "What's This?" help-pop-up topic in the application's help file. See ShowWhatsThis.
{: .no_toc }
The control's width. Single.
{: .no_toc }
Begins, completes, or cancels a manual drag-and-drop operation. Typically called from a MouseDown handler when DragMode is vbManual.
Syntax: object.Drag [ Action ]
Action : optional A member of DragConstants: vbCancel (0), vbBeginDrag (1, default), or vbEndDrag (2).
{: .no_toc }
Repositions and optionally resizes the control in a single call.
Syntax: object.Move Left [, Top [, Width [, Height ] ] ]
Left : required A Single giving the new horizontal position.
Top, Width, Height : optional New values for the corresponding properties. Omitted values are left unchanged.
{: .no_toc }
Initiates an OLE drag operation from the control, raising the OLEStartDrag event so the application can populate the DataObject.
Syntax: object.OLEDrag
{: .no_toc }
Forces an immediate repaint of the control.
Syntax: object.Refresh
{: .no_toc }
Displays the topic identified by WhatsThisHelpID as a "What's This?" pop-up.
Syntax: object.ShowWhatsThis
{: .no_toc }
Brings the control to the front or back of its sibling stack.
Syntax: object.ZOrder [ Position ]
Position : optional A member of ZOrderConstants: vbBringToFront (0, default) or vbSendToBack (1).
{: .no_toc }
Raised when the user clicks the control with the left mouse button --- after Value has toggled between vbChecked and vbUnchecked. Default event.
Syntax: object_Click( )
{: .no_toc }
Raised when the user double-clicks the control.
Syntax: object_DblClick( )
{: .no_toc }
Raised on the destination control when a manual drag operation ends over it.
Syntax: object_DragDrop( Source As Control, X As Single, Y As Single )
{: .no_toc }
Raised on the control under the cursor while a manual drag operation is in progress.
Syntax: object_DragOver( Source As Control, X As Single, Y As Single, State As Integer )
{: .no_toc }
Raised when the user presses any mouse button over the control.
Syntax: object_MouseDown( Button As Integer, Shift As Integer, X As Single, Y As Single )
{: .no_toc }
Raised when the cursor moves over the control.
Syntax: object_MouseMove( Button As Integer, Shift As Integer, X As Single, Y As Single )
{: .no_toc }
Raised when the user releases a mouse button over the control.
Syntax: object_MouseUp( Button As Integer, Shift As Integer, X As Single, Y As Single )
{: .no_toc }
Raised on the source control when the OLE drag operation finishes, indicating which effect (copy, move, none) the destination accepted.
Syntax: object_OLECompleteDrag( Effect As Long )
{: .no_toc }
Raised on the destination control when the user drops data on it.
Syntax: object_OLEDragDrop( Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single )
{: .no_toc }
Raised on the destination control while an OLE drag passes over it.
Syntax: object_OLEDragOver( Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer )
{: .no_toc }
Raised on the source control during a drag so the application can adjust the cursor or other visual feedback.
Syntax: object_OLEGiveFeedback( Effect As Long, DefaultCursors As Boolean )
{: .no_toc }
Raised on the source control when the destination requests data in a format that was registered but not yet supplied.
Syntax: object_OLESetData( Data As DataObject, DataFormat As Integer )
{: .no_toc }
Raised on the source control at the start of an OLE drag, so the application can populate the DataObject and choose the allowed effects.
Syntax: object_OLEStartDrag( Data As DataObject, AllowedEffects As Long )