Skip to content

CheckMark class ​

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.

vb
Private Sub Form_Load()
    Check1.Value = vbUnchecked
End Sub

Private Sub Check1_Click()
    Debug.Print "Check is now: " & Check1.Value
End Sub

Three-state behaviour ​

Value is typed as CheckBoxConstants:

ConstantValueMeaning
vbUnchecked0The check is cleared.
vbChecked1The check is selected.
vbGrayed2The 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.

vb
Check1.Value = vbGrayed     ' show the indeterminate state

Drawing modes ​

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.

Background ​

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.

Properties ​

Anchors ​

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.

Appearance ​

How the glyph is shaded when VisualStyles is False. A member of AppearanceConstants: vbAppear3d (default) or vbAppearFlat. Ignored when VisualStyles is True.

BackColor ​

The background colour, as an OLE_COLOR. Defaults to the system 3-D face colour. Used only when BackStyle is vbBFOpaque.

BackStyle ​

Whether the control fills its rectangle before drawing the glyph. A member of BackFillStyleConstants: vbBFTransparent (default) or vbBFOpaque.

Container ​

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.

ControlType ​

A read-only ControlTypeConstants value identifying this control as a check mark. Always vbCheckMark.

Dock ​

Whether the control fills one edge of, or the entire interior of, its container. A member of DockModeConstants, default vbDockNone.

DragIcon ​

A StdPicture used as the mouse cursor while the control is being drag-and-dropped (see Drag and DragMode).

DragMode ​

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).

Enabled ​

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.

Height ​

The control's height, in twips by default (or in the container's ScaleMode units). Single.

Index ​

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.

Left ​

The horizontal distance from the left edge of the container to the left edge of the control. Single.

MouseIcon ​

A StdPicture used as the mouse cursor when MousePointer is vbCustom and the pointer is over the control.

MousePointer ​

The mouse cursor shown when the pointer is over the control. A member of MousePointerConstants.

Name ​

The unique design-time name of the control on its parent form. Read-only at run time.

Parent ​

A reference to the Form (or UserControl) that contains this control. Read-only.

TabIndex ​

INFO

Reserved for compatibility with VB6; not currently implemented in twinBASIC. The control is not focusable, so the property has no effect at run time.

Tag ​

A free-form String the application can use to associate custom data with the control. Ignored by the framework.

ToolTipText ​

A multi-line String displayed as a tooltip when the user hovers over the control.

Top ​

The vertical distance from the top of the container to the top of the control. Single.

Value ​

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.

Visible ​

Whether the control is shown. Boolean, default True.

VisualStyles ​

When True, the glyph is drawn through the OS theme engine; when False (default), it is drawn with DrawFrameControl and obeys Appearance. Boolean.

WhatsThisHelpID ​

A Long identifying a "What's This?" help-pop-up topic in the application's help file. See ShowWhatsThis.

Width ​

The control's width. Single.

Methods ​

Drag ​

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).

Move ​

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.

OLEDrag ​

Initiates an OLE drag operation from the control, raising the OLEStartDrag event so the application can populate the DataObject.

Syntax: object.OLEDrag

Refresh ​

Forces an immediate repaint of the control.

Syntax: object.Refresh

ShowWhatsThis ​

Displays the topic identified by WhatsThisHelpID as a "What's This?" pop-up.

Syntax: object.ShowWhatsThis

ZOrder ​

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).

Events ​

Click ​

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( )

DblClick ​

Raised when the user double-clicks the control.

Syntax: object_DblClick( )

DragDrop ​

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 )

DragOver ​

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 )

MouseDown ​

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 )

MouseMove ​

Raised when the cursor moves over the control.

Syntax: object_MouseMove( Button As Integer, Shift As Integer, X As Single, Y As Single )

MouseUp ​

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 )

OLECompleteDrag ​

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 )

OLEDragDrop ​

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 )

OLEDragOver ​

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 )

OLEGiveFeedback ​

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 )

OLESetData ​

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 )

OLEStartDrag ​

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 )

twinBASIC and LOGO copyright of "WaynePhillipsEA" author