70 likes | 202 Views
Drawing a Stick Figure!. Create the follow form using code, draw a stick figure similar to the one shown here. Option Explicit Dim strcolor As String ____________________________ ScaleMode = vbPixels Line (80, 40)-(120, 80), strcolor, B Line (100, 80)-(100, 150), strcolor
E N D
Create the follow form using code, draw a stick figure similar to the one shown here.
Option Explicit Dim strcolor As String ____________________________ ScaleMode = vbPixels Line (80, 40)-(120, 80), strcolor, B Line (100, 80)-(100, 150), strcolor Line (60, 105)-(140, 105), strcolor Line (60, 190)-(100, 150), strcolor Line (140, 190)-(100, 150), strcolor
optBlack.Value = True ______________________________ strcolor = vbBlack ______________________________ strcolor = vbBlue ______________________________ strcolor = vbGreen ______________________________ strcolor = vbRed
Summary • There are two ways to create lines on a forms. You can create a line control, or you can use the line method to draw a line on a form using Visual Basic code. • A Shape control is similar to a Line control except that the Shape control contains several additional properties, which allows you to change the shape and shading of the control. • The BorderColor and BorderWidth properties specify the color and width of ordinary lines and the color and width of border lines for a shape. The FillColor and FillStyle properties specify how a shape will be filled. • The properties of both Line controls and Shape controls cannot manipulate it. • Distance and position on a form is measured using coordinates. The top left corner of a form has the coordinates (0,0).
All coordinates are positive. As you move toward the bottom of a form, the X-coordinate value increases. As you move toward the right of the form, the Y- coordinate value increases. • You specify where the Line method should draw a line by using specific coordinates. You can also specify the color of the line in the parameters. • The ScaleMethod property allows you to adjust the coordinate system of a form to be measured in twips, pixels, or points. • The Line method can also create boxes, either filled or unfilled.