VB6 Tutorial 30: Lines and Shapes

Posted On 2018-04-15 by VB6Boy
Keywords: visual,basic,vb6,visualbasic,tutorial,basic,beginner
Tags: VB6 Tutorials 
Views: 51

Title Uploaded Size
Line_and_Shape.zip 4/15/2018 5:55:26 AM 1,379


Looking for the more of the VB6 Tutorial? Here is the tutorial index.

Line and shape are the simplest controls in Visual Basic 6 IDE that do not raise events. They are only used for designing the program interface.

You can enhance the graphical user interface (GUI) of your application using these two controls. The knowledge of using them appropriately will greatly improve your software. You can easily learn about the properties of Lines and shape. Just experiment!

The Line control

Line is used to draw lines.

Some properties of the Line control are:

  • BorderColor: The BorderColor property sets the Line color.
  • BorderStyle: The BorderStyle property sets the style of the line like solid, dash, dot and other styles.
  • BorderWidth: The BorderWidth property sets the line width.
  • DrawMode: The DrawMode property has several symbolic constant values or named constant values that determine the appearance of the line control.

The Line method

You can even draw a line from your code. The Line method does the job.

Line (x1, y1)-(x2, y2), color

Example

This example draws a line of 5 twips width.

DrawWidth = 5
Line (0, 0)-(500, 600), vbRed

You need to type the minus ("-") sign between the two points.

Shape

Shape is used to draw different kinds of shapes. The shapes that you can draw using this control are rectangle, square, oval, circle, rounded rectangle and rounded square.

Shape control also has the same properties as the Line control plus some other simple properties such as BackColor that sets the background color, FillStyle that sets the filling style of the shape and FillColor that sets the color filling the shape.

Different shapes can be drawn from the code using some methods which are out of the scope of this lesson. They will be discussed later.

See the attached sample program for an example of how you can use it this control on your form.

Looking for the more of the VB6 Tutorial? Here is the tutorial index.


About the Author

has posted a total of 101 articles.


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.159.91.117

Before you can post, you need to prove you are human. If you log in, this test goes away.


Code Links