Home

Controls Properties:
The Border Style of a Control

 

Introduction

Some controls display a border when they are drawn and some others don't. Consider the following:

Some of these controls allow you to specify a type of border you want to show surrounding the controls. This characteristic is controlled by the BorderStyle property, which is based on BorderStyle enumerator. Its members are:

Value Example
Fixed3D
FixedSingle
None

To programmatically specify the border style of a control, access its BorderStyle property and assign it the desired BorderStyle member. Here is an example:

Imports System
Imports System.Drawing
Imports System.Windows.Forms

Module Exercise

    Public Class WinControls
        Inherits Form

        Private pnlViewer As Panel

        Dim components As System.ComponentModel.Container

        Public Sub New()
            InitializeComponent()
        End Sub

        Public Sub InitializeComponent()

            pnlViewer = New Panel()
            pnlViewer.BorderStyle = BorderStyle.Fixed3D
            pnlViewer.BackColor = Color.LightBlue
            Controls.Add(pnlViewer)

        End Sub

        Public Shared Function Main() As Integer

            Application.Run(New WinControls())
            Return 0

        End Function

    End Class

End Module
 

Home Copyright © 2008 FunctionX, Inc. Home