Drawing with V.B
- Picture box control
- Image box control
You can place graphics on three controls:
- Form
- Picture box
- Image box
The method for loading graphics on the various are simpler then creating graphics from stretch.
Coding
picture 2.picture = picture1.picture
- Image box control = If the stretch property is true , the image is resized to fill the area of the image box control. Unless the control dimension have the same aspects ratio as the image is dimension the image is distroted as its resized. If the stretch property is false , the image box control behave likes a picture box with autosize property set to true show image box control , both containing the same image. Notice how the image is resized in the imagebox control whose stretch property is true.
- Picture box control = If the autosize property is true , the control is resized to the dimension of the image its contain. If the autosize property is false,only the part of the image that can fit on the control is displayed.
Loading and Saving images = To load a graphics on a control at runtime use the load picture method as follow:
Form1,picture = load picture (filename)
The file name variable is the name of the file containing the graphics . The file can have one of the following extensions.
- BMP = Bitmap
- GIF = Graphics interchage format
- JPG = Joint photographic experts group
Coding
Private Sub Command1_Click()
Picture1.Line (2500, 500)-(1000, 1500)
Picture1.Line (1000, 1500)-(3500, 1500)
Picture1.Line (3500, 1500)-(2500, 500)
Picture1.Line (1000, 1500)-(1000, 3000)
Picture1.Line (3500, 1500)-(3500, 3000)
Picture1.Line (1000, 3000)-(3500, 3000)
Picture1.Line (2500, 500)-(5500, 500)
Picture1.Line (3500, 1500)-(6500, 1500)
Picture1.Line (5500, 500)-(6500, 1500)
Picture1.Line (6500, 1500)-(6500, 3000)
Picture1.Line (3500, 3000)-(6500, 3000)
Picture1.Line (1500, 2000)-(1500, 2200)
Picture1.Line (1500, 2000)-(3000, 2000)
Picture1.Line (1500, 2000)-(1500, 2500)
Picture1.Line (1500, 2500)-(3000, 2500)
Picture1.Line (3000, 2000)-(3000, 2500)
Picture1.Line (4000, 2200)-(4000, 3000)
Picture1.Line (4000, 2200)-(5000, 2200)
Picture1.Line (5000, 2200)-(5000, 3000)
Picture1.Line (4000, 500)-(5000, 1500)
Picture1.Line (3600, 500)-(4500, 1500)
Picture1.Line (3300, 500)-(4200, 1500)
Picture1.Line (3200, 500)-(4100, 1500)
Picture1.Line (3100, 500)-(4000, 1500)
Picture1.Line (3300, 500)-(4200, 1500)
Picture1.Line (4200, 500)-(5200, 1500)
End Sub
Coordinate System
V.B provides two basic method for drawing shape and on control and a method for displaying text.
- Line = Draws line and boxes.
- Circle = Draws circle and ellipses.
- Print = Display text strings.
0 comments:
Post a Comment