Line and Shape Controls in VB.NET

 Introduction to the Line and Shape Controls

Visual Basic power pack  controls allow us to draw lines, rectangle and oval shapes on your Windows Forms application. These controls accept many of the graphics methods of system. Drawing namespace. This enables you to draw lines and shapes in a single step without having to create graphics objects, pens, and brushes.

We can able to draw horizontal, vertical, and diagonal lines, rectangles, squares, ovals, circles, and rectangles and squares with the help of power pack  graphical controls. Now we discuss about and Shape Controls

Introduction to the Line and Shape Controls

The Visual Basic Power Packs Line and Shape controls are a set of three graphical controls that enable you to draw lines and shapes on forms and containers.

 LineShape  control -is used to draw horizontal, vertical, and diagonal lines.

  OvalShape  control is used to draw circles and ovals.

 RactangelShape control is used to draw rectangles and squares.

  Shape   

             LineShape
         
 SimpleShape                       

                                      OvalShape        
                                      RactangleShape     

                              

  •   Drag the  LineShape control from the Toolbox drag to a form or container control.
  •   Drag the sizing and move handles to size and position the line.

                                            -- ---Or-----

        Imports Microsoft.VisualBasic.PowerPacks

        Dim ShapeCon As New ShapeContainer

        Dim testLine As New LineShape

        ShapeCon.Parent = Me

        testLine.Parent = ShapeCon

        testLine.StartPoint = New System.Drawing.Point(10, 10)

        testLine.EndPoint = New System.Drawing.Point(300, 300)

Note: When any  Line or Shape control is added to a form or container, ShapeContainer object is created.


Similar Articles