* New post Constructor Destructor and Inheritance& Array , Virtual base class in c++ language

Sunday, 21 July 2013

0 Drawing with V.B

Drawing with V.B
  • Picture box control 
  • Image box control
Graphics Control

You can place graphics on three controls:
  • Form
  • Picture box
  • Image box
The main difference in these controls is that the image box control is designed specifically for displaying images and not for creating new images or manupulating them. The other two controls provide drawing method that let you design graphics at run time. 

                                        The method for loading graphics on the various are simpler then creating graphics from stretch.


   Coding

picture 2.picture = picture1.picture

  1. 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.
  2. 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.
Coordinates describe the position of the individual pixels on the screen or of the point on a piece of paper in the printers. The coordinates system is similar to a city map. Each square on the map has its own unique address: a combination of a column and a row number. The column number is the vertical coordinates or ycoordinate . The row number is the horizontal coordinate or x coordinates.

0 comments:

Post a Comment

 

PROGRAMMINGqueen Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates

Blogger Widgets