Drawing Lines and Shapes on a Form

See Also1YQC42C

You can use the line controlTW530P to draw simple lines on forms, and the shape control9JZFLA to draw rectangles (regular or rounded corners), squares (regular or rounded corners), ovals, and circles on forms.  Select each tool in the Toolbox414LEZP.

To draw a line a form

   1. In the Toolbox, select the line control.

     When the pointer moves onto the form, it changes to a cross hair21ZJ44P.

   2. Click the form where you want the line to begin and hold down the mouse button.

   3. Drag the cross hair to where you want the line to end and release the mouse button.

   4. From the Properties window1K6JQPY, select the BorderStyle43RNRL property if you want to change the appearance of the line.

   5. In the Settings boxAV4YN4, select the style you want.

   6. Click the Enter button1MFBOJ1 to accept the setting.

 

To draw a shape on a form

   1. In the Toolbox, select the shape control.

     When the pointer moves onto the form, it changes to a cross hair21ZJ44P.

   2. Click and drag the cross hair to make the item the size you want.

   3. From the Properties window1K6JQPY, select the Shape2XNTAGF property.

   4. In the Settings boxAV4YN4, select the style you want.

   5. Click the Enter button1MFBOJ1 to accept the setting.

 

Note   To add color, set the BackColor1W9T6JQ property to the color you want.

To draw lines, rectangles, and filled-in boxes at run time, use the LineGU01B0 method.

To draw circles, ellipses, and arcs at run time, use the Circle38E9WK method.

 


See Also

Help:

Displaying a Graphic on a Form13Z8KW6

Picture Box Control31MYIWX

Setting Form and Control Properties1NFIWMG

 

Learning Visual Basic:

Using Color and Graphics

 

Programmer's Guide:

Chapter 15, "Creating Graphics for Applications"