Visual Basic Black Book by Steven Holzner

Visual Basic Black Book by Steven Holzner

Author:Steven Holzner
Language: eng
Format: epub
Tags: Visual Basic,


ITKnowledge

subscribe

login

search

My

ITKnowledge

FAQ/h

site map

contact us

Go!

Keyword

© Brief O Full

□ Advanced Search

□ Search Tips

Please Select

To access the contents, click the chapter and section titles. Visual Basic 6 Black Book

(Publisher: The Coriolis Group) Author(s): Steven Holzner ISBN: 1576102831 Publication Date: 08/01/98

Bookmark It

Search this book:

Go!

Drawing Boxes

You draw boxes in forms and picture boxes with the Line method, using the B argument:

object. Line [Step] ( xl, yl) [Step] ( x2, y2) , [color], [B][F] Here are the arguments you pass to Line:

• Step—Keyword specifying that the starting point coordinates are relative to the current graphics position given by the CurrentX and CurrentY properties.

• xl, yl —Single values indicating the coordinates of the starting point for the line or rectangle. The ScaleMode property determines the unit of measure used. If omitted, the line begins at the position indicated by CurrentX and CurrentY.

• Step—Keyword specifying that the end point coordinates are relative to the line starting point.

• x2, y>2 —Single values indicating the coordinates of the end point for the line being drawn.

• color —Long integer value indicating the RGB color used to draw the line. If omitted, the ForeColor property setting is used. You can use the RGB function or QBColor function to specify the color.

• B—If included, causes a box to be drawn using the coordinates to specify opposite corners of the box.

• F—If the B option is used, the F option specifies that the box is filled with the same color used to draw the box. You cannot use F without B. If B is used without F, the box is filled with the current FillColor and FillStyle. The default value for FillStyle is transparent.

Let's see an example showing how to draw boxes in forms and picture boxes when the user clicks a command button. In this case, we'll draw a box in a form

Private Sub Commandl_Click()

Line (ScaleWidth / 4, ScaleHeight / 4)-(3 * ScaleWidth / 4, 3 * _

file:///E|/Program%20Files/KaZaA/My%20Shared%...Basic%20-%20%20Black%20Book/ch18/593-596.html (1 of 3) [7/31/2001 9:02:04 AM]

Visual Basic 6 Black Book:Working With Graphics

ScaleHeight / 4) , , B

and another box in a picture box:

Private Sub Commandl_Click()

Line (ScaleWidth / 4, ScaleHeight / 4)-(3 * ScaleWidth / 4, 3 * _ ScaleHeight / 4), , B

Picturel.Line (Picturel.ScaleWidth / 4, Picturel.ScaleHeight / 4)-_ (3 * Picturel.ScaleWidth / 4, 3 * Picturel.ScaleHeight / 4), , B

End Sub

The result of this code appears in Figure 18.5. Now we're drawing boxes in Visual Basic.

Figure 18.5 Drawing boxes in forms and picture boxes. Drawing Circles

You use the Circle method to draw circles in forms and picture boxes:

object. Circle [Step] (x, y) , radius, [color, [start, end, [aspect]]] Here are the arguments you pass to Circle:

• Step—Keyword specifying that the center of the circle, ellipse, or arc is relative to the current coordinates given by the CurrentX and CurrentY properties of object.

• x, y —Single values indicating the coordinates for the center point of the circle, ellipse, or arc. The ScaleMode property of object determines the units of measure used.

• radius —Single value indicating the radius of the circle, ellipse, or arc. The ScaleMode property of object determines the unit of measure used.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.