BorderStyle Property

Purpose

Returns or sets the border style for an object.

Syntax

object.BorderStyle = [value]

object:Ocx Object
valueBorderStyleConst

Description

For a form, the BorderStyle property determines key characteristics that visually identify a form as either a general-purpose window or a dialog box. The value can be one of the following BorderStyleConst:

basNone (0) no border and no caption (Form only)
basFixedSingle (1) simple border (WS_BORDER)
basThick (2) double border (WS_THICKFRAME)

The form's SizeAble property affects the BorderStyle property and sets it to basThick.

Example

Ocx Label lbl = "No Border", 10, 10, 100, 16

Ocx Command cmd = "Add Single Border", 10, 35, 100, 22

Do : Sleep : Until Me Is Nothing

 

Sub cmd_Click

Static Byte cond = 0

Inc cond : If cond = 3 Then cond = 0

lbl.BorderStyle = cond

Select cond

Case 0 : cmd.Caption = "Add Single Border"

Case 1 : cmd.Caption = "Add Double Border"

Case 2 : cmd.Caption = "Remove Border"

EndSelect

EndSub

Remarks

The BorderStyle is a property for all visible Ocx objects.

Known Issues

With TextBoxes, the positioning of the BorderStyle property is important. In the example below, clicking the command button will set the border to double width (incorrect behaviour).

Ocx TextBox tb = "", 10, 10, 300, 32 : tb.BorderStyle = 1 : tb.MultiLine = True

Ocx Command chk = "Set TextBox border to 1", 10, 50, 150, 22

Do : Sleep  : Until Me Is Nothing

 

Sub chk_Click

tb.BorderStyle = 1

EndSub

However, if you place the BorderStyle property change AFTER Multiline, then clicking the command button no longer doubles the width of the border.

See Also

Form, Appearance, Sizeable

{Created by Sjouke Hamstra; Last updated: 02/08/2022 by James Gaite; Other Contributors: Jean-Marie Melanson}