Button Control

Description

The Button control allows the user to click it to perform an action. The Button control can display both text and images. When the button is clicked, it looks as if it is being pushed in and released.

Usage

Button controls allow the operator to initiate some action by clicking with the mouse.
You can change the look of a button using several properties, such as ForeColor (used for the button text), BackColor, Font, TextAlign, Image, and ImageAlign. You must provide a click event function to determine whether the operator clicked the button, and then take some action in the event handler.

Button Control Properties

Property Description
BackColor

The background color for the control.

Default: Control

BackColorMode

The background color mode for the control.

Default: Visual Style

Enabled

Sets whether the control is enabled at runtime.

Default: True

EventTaskType

The type of task used for events.

Default: Normal

Font

The font for the control text.

Default: Microsoft Sans Serif 8.25 pt

FontBold

The bold attribute for the current font

Default: False

FontItalic

The italic attribute for the current font

Default: False

FontName

The name for the current font

.

Default: Microsoft Sans Serif

FontSize

The size for the current font in points

.

Default: 8.25

ForeColor

The foreground color for the control text.

Default: ControlText

Height The height of the control in pixels.
Image

The picture for the control. To delete, press the [Delete] key.

Default: Empty

ImageAlign

The picture alignment for the control.

Default: MiddleCenter

Left The left coordinate of the control in pixels.
Name

The name of the control.

Default: ButtonXX

PressDelay

Sets the time in msec until the event is executed after the control is clicked. If you release the click button before the set time elapses, the event will not execute.

Default: Immediately Execute

PressSound Sets whether a beep sounds when the control is clicked.
TabIndex The tab index of the control.
Text

The text of the control.

Default: Name of control

TextAlign

Selects the text alignment.

Default: MiddleCenter

ToolTipText

The text used in the control’s tooltip.

Default: Empty

Top The top coordinate of the control in pixels.
Visible

Whether the control is visible or not at runtime.

Default: True

Width The width of the control in pixels.

Button Control Events

Event Description
Click Executes when the user clicks the control with the mouse.