Udostępnij za pośrednictwem


Appearance and BorderStyle Properties for Visual Basic 6.0 Users

The Appearance and the BorderStyle properties in Visual Basic 6.0 are used to control the appearance of controls.

Conceptual Differences

The Visual Basic 6.0 Frame, Image, Label, PictureBox, and TextBox controls support both the Appearance and BorderStyle properties. Setting a combination of the two properties makes the control appear with no border, with a single line for a border, or with a three-dimensional border.

In Visual Basic 2008, the Appearance property no longer exists for these controls. Its functionality has been combined with the BorderStyle property to set the appearance in a single step.

The Visual Basic 6.0 CommandButton, ListBox, and ComboBox controls support only the Appearance property.

The Visual Basic 2008 Button control has a FlatStyle property that is equivalent to the Appearance property. The ListBox control can be made to appear flat by setting the BorderStyle property to FixedSingle. The ComboBox control never actually supported a flat appearance in Visual Basic 6.0, so there is no equivalent.

Note

Visual Basic 6.0 forms also have a BorderStyle property that supports a different set of values. This is replaced by the FormBorderStyle property in Visual Basic 2008.

Code Changes for the Appearance and BorderStyle Properties

The following code example illustrates the differences in coding techniques between Visual Basic 6.0 and Visual Basic 2008.

Code changes for changing the appearance of controls

The following example demonstrates setting properties to change the appearance of controls at run time.

' Visual Basic 6.0
' Give a TextBox a flat look with no border.
Text1.Appearance = 0
Text1.BorderStyle = 0
' Give a TextBox a three-dimensional appearance.
Text1.Appearance = 1
Text1.BorderStyle = 1
' Give a CommandButton a flat look
Command1.Appearance = 0
' Give a ListBox a flat look
List1.Appearance = 0
' Visual Basic' Give a TextBox a flat look with a single border.
TextBox1.BorderStyle = BorderStyle.None
' Give a TextBox a three-dimensional appearance.
TextBox2.BorderStyle = BorderStyle.Fixed3D
' Give a Button a flat look
Button1.FlatStyle = FlatStyle.Flat
' Give a ListBox a flat look
ListBox1.BorderStyle = BorderStyle.FixedSingle

Appearance and BorderStyle Equivalencies

The following table lists Visual Basic 6.0 Appearance and BorderStyle constants and their Visual Basic 2008 enumeration equivalents.

Visual Basic 6.0

Visual Basic 2008 Equivalent

BorderStyle = 0 – None

None

Appearance = 0 – Flat

BorderStyle = 1 – Fixed Single

FixedSingle

Appearance = 1 – 3D

BorderStyle = 1 – Fixed Single

Fixed3D

Upgrade Notes

When upgrading a Visual Basic 6.0 application using the Upgrade wizard, Frame controls can be upgraded to either Visual Basic 2008 GroupBox or Panel controls. Appearance and BorderStyle mappings apply only to those Frame controls that are upgraded to Panel controls; there is no BorderStyle property for GroupBox controls. For more information, see Frame Control for Visual Basic 6.0 Users.

When upgrading ComboBox, CommandButton, and ListBox controls, the Appearance property is not mapped. If the Appearance property is set in code, an upgrade warning will be added.

See Also

Concepts

ComboBox Control for Visual Basic 6.0 Users

CommandButton Control for Visual Basic 6.0 Users

Frame Control for Visual Basic 6.0 Users

Label Control for Visual Basic 6.0 Users

PictureBox Control for Visual Basic 6.0 Users

TextBox Control for Visual Basic 6.0 Users

User Controls for Visual Basic 6.0 Users