30.07.2013 Views

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

746 Graphics and Multimedia Chapter 16<br />

A graphics context represents a drawing surface on the screen. A Graphics object provides access<br />

<strong>to</strong> the graphics context of a control.<br />

An instance of the Pen class is used <strong>to</strong> draw lines.<br />

An instance of one of the classes that derive from abstract class Brush is used <strong>to</strong> draw solid<br />

shapes.<br />

The Point structure can be used <strong>to</strong> represent a point in a two-dimensional plane.<br />

Graphics objects contain methods for drawing, font manipulation, color manipulation and other<br />

graphics-related actions.<br />

Method OnPaint normally is called in response <strong>to</strong> an event, such as the uncovering of a window.<br />

This method, in turn, triggers a Paint event.<br />

Structure Color defines constants for manipulating colors in a <strong>Visual</strong> <strong>Basic</strong> program.<br />

Color properties R, G and B return Integer values from 0 <strong>to</strong> 255, representing the amounts of<br />

red, green and blue, respectively, that exist in a Color. The larger the value, the greater the<br />

amount of that particular color.<br />

<strong>Visual</strong> <strong>Basic</strong> provides class ColorDialog <strong>to</strong> display a dialog that allows users <strong>to</strong> select colors.<br />

Component property BackColor (one of the many Component properties that can be called<br />

on most GUI components) changes the component’s background color.<br />

Class Font’s construc<strong>to</strong>rs all take at least three arguments—the font name, the font size and the<br />

font style. The font name is any font currently supported by the system. The font style is a member<br />

of the FontStyle enumeration.<br />

Class FontMetrics defines several methods for obtaining font metrics.<br />

Class Font provides the Bold, Italic, Strikeout and Underline properties, which return<br />

True if the font is bold, italic, strikeout or underlined, respectively.<br />

Class Font provides the Name property, which returns a String representing the name of the<br />

font.<br />

Class Font provides the Size and SizeInPoints properties, which return the size of the font<br />

in design units and points, respectively.<br />

The FontFamily class provides information about such font metrics as the family’s spacing and<br />

height information.<br />

The FontFamily class provides the GetCellAscent, GetCellDescent, GetEmHeight<br />

and GetLineSpacing methods, which return the ascent of a font, descent of a font, the font’s<br />

height in points and the distance between two consecutive lines of text, respectively.<br />

Class Graphics provides methods DrawLine, DrawRectangle, DrawEllipse,<br />

DrawArc, DrawLines, DrawPolygon and DrawPie, which draw lines and shape outlines.<br />

Class Graphics provides methods FillRectangle, FillEllipse, FillPolygon and<br />

FillPie, which draw solid shapes.<br />

Classes HatchBrush, LinearGradientBrush, PathGradientBrush and Texture-<br />

Brush all derive from class Brush and represent shape-filling styles.<br />

Graphics method FromImage retrieves the Graphics object associated with the image file<br />

that is its argument.<br />

The DashStyle and DashCap enumerations define the style of dashes and their ends, respectively.<br />

Class GraphicsPath represents a shape constructed from straight lines and curves.<br />

GraphicsPath method AddLine appends a line <strong>to</strong> the shape that is encapsulated by the object.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!