Software Technology Tips

Windows form has its default blue color form border style.We can customize its look and feel.

Following are the steps :
1.In form's property window set 'FormBorderStyle' to None..
2.Now we need to paint the form border using any color we want.
   (a) Declare some variables
              'The color and the width of the border.
               Private borderColor As Color = Color.Black 'Border Color
               Private borderWidth As Integer = 10
             'The region of the form.
               Private formRegion As Rectangle
   (b)In the Form load Event define the form's region.
         Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

              'Sets the location of the form w.r.t the position
              formRegion = New Rectangle(0, 0, 653, 408) 'Here 653 and 408 is form's Size

         End Sub
    (c)Draw the border in the Paint Event of form.
         Private Sub Form1_Paint(sender As System.Object, e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

           'Draws the border.
       ControlPaint.DrawBorder(e.Graphics, formRegion , borderColor, _
     borderWidth, ButtonBorderStyle.Solid, borderColor, borderWidth, _
     ButtonBorderStyle.Solid, borderColor, borderWidth,          ButtonBorderStyle.Solid, _
            borderColor, borderWidth, ButtonBorderStyle.Solid)

    End Sub

Related Tags:

WindowsApplication, VB.NET, Visual Basic, Forms

Author: Kumari Vandana

Visual Basic

Let us Connect!

Awards and Achievements

Red Herringcolor DeloitteFast50 DB ZInnov1   Nascome  DB Stpi

This site uses cookies. We respect your privacy.copyright (c) Mindfire Solutions 2007-2015. Login