Shape (1)

Shape (2)

- Best way to understand a circle is when you know that circles are drawn according to the square within, meaning that when you draw a sqare shape then you be sure that the elliptic shape surrounds the square that touches the 4 corners or this square is an even circle with even 360 units called degrees. *See shape (3)*.

Shape (3) - Square shape within an elliptic shape (Circle) touches it in the 4 corners.

- Now, when we want to know the central point where the **3** hands (Hours Hand, Minutes Hand and Seconds Hand) will spin around, then we will need to specify the central point "**PointF**" (X,Y) in the very middile of the circle, which will be also the center of the square shape winthin, and as long as our form will be a square shape (Width=Height) then it's easy to calculate the position of this point.

- Now, we want to draw **3** hands starting from this **PointF** and the **3** hands have different length (Seconds Hand is the tallest, Hours Hand is the shortest). Unless you know how to centralize the 3 hands on the form, we won't be drawing these hands at the Design Time (IDE). To draw a line you need to know its length. **PointF (X,Y)** is the start Point of drawing while **PointE (X,Y)** is the end point of drawing.

*Line.Length=PointF to PointE* , so according to shape (2), if I want to draw a line with length 500 Pixels then I need to set the PointF to PointE=500 like this **Me.Line (0,0)-(500,500), VbRed **, that means that I will draw a line from the **Point (0,0)** to the **Point(500,500)**, if my form is 500 Pix then I will be drawing a line from the upper-left corner **PointF** to the lower-right corner **PointE**, see Shape (4).

Shape (4) - X,Y understanding

** - In our example **the form is a circle, but the form has even coordinates (4650 X 4650) twips while 4650 twips=310 Pixels ( * To convert twips to pixels we use 4650 / 15).

Naturally our Radius (R) is (4650/2)=2325 Twips (155 Pixels). In order to draw a circle on a form with 2325 Twips Radius, then our code is as following and is a part of the application project example of course. If you applied this code to a new Visual Basic 6.0 project then you will get a Round Shaped Form, but you will see it better if you set the **Picture** property of the form to a **310X310 Pixels JPG** Picture and set the **BorderStyle** property of the form to=**0 - None** :

- Drawing a line on the form : We said that if you wanted to draw a line on the form you must determine a starting point to draw from PointF (X1, Y1) and an end point to end draw to it PointE (X2, Y2) but, how do we determine the Line's length ? See Shape (5) first .....

Shape (5) - Drawing line on the form 'Green line'

- The picture in Shape (5) shows how is it done to draw a line from PointF(X1,Y1) to PointE(X2,Y2) or from (2325,2325) to (1500,1500) using Twips as the meassuring unit and how twip points are placed on a Visual Basic form of a size of (4650 X 4650) twips. Remember that we started drawing from the center point until we reached (1500X1500) the PointE.

- The Size of this line When you meassure, it will be (825 Twips from doing __2325-1500__). Why the line is leaning and not straight ?

The answer is : Because of its **Angl**e

-What is a line's Angle ?

- **Angle** generally is that figure or is the figure formed when 2 rays meet in one point, while the 2 rays are called the Angle Sides. Angle is measured by the Degree(s) like that symbol º, for example *(90º* ). How to use Angles in Visual Basic drawing lines on the form.

It is confusing because we only have one line and we want to make an Angle for it, and notice that the line slopes.