GBIC: Graphics
The following is reprinted for archival purposes from Gary Beene's Information Center, with permission from Mr. Beene himself.
VB has limited graphics capabilities. Most serious graphics work is done using Windows API
Graphical controls (cannot appear on top of other controls, cannot receive focus, cannot serve as containers and do no have an hWnd property):
- Image
- Line
- Shape
Pictures can be displayed on:
- form
- picturebox
- image control
Graphics methods
.Cls | 'clear a drawing area |
.PSet | 'sets color of a pixel at a specified point |
.Point | 'returns color value at a specified point |
.Line | 'draws line between two coordinates (also draws box) |
.Circle | 'draw circle of radius about a specified point (can also draw arcs or ellipses) |
.PaintPicture | 'draws a picture on a form, picturebox, or printer |
These properties affect the way graphics methods appear:
.FillStyle | |
.FillColor | |
.DrawWidth | 'width of lines |
.BorderWidth | 'width of outline on line and shape controls |
.DrawStyle | 'set solid or broken pattern for lines |
.DrawMode | 'defines what happend when one pattern is drawn on top of another |
Colors
- color is a Long integer from 0 to 16,777,215 (&HFFFFFF&)
- color is represented by red, green and blue content - each with a value of 0 to 255
- RGB function is used to set colors using RGB content
iColor = RGB (R, G, B) 'R,G,B have values 0 to 255. (0,0,0) is black. (255,255,255) is white.
iColor = QBColor (i) 'i = 0 to 15, corresponding to VB color constants
represent color by this syntax (Note: this is reversed from standard Internet color syntax):
iColor = &HBBGGRR& 'where BB is blue, GG is green, and RR is red content
Non-displayed pictures
- VB offers a Picture object for loading pictures which do not need to be displayed
- The Picture object is convenient for creating animation sequences by using an array of Picture objects
Dim MyPicture As Picture
Set MyPicture = LoadPicture( "mypicture.bmp" )
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.