The following table lists the commonly used properties of the Canvas object.
Common properties of the Canvas object
Properties |
Descriptions |
Font |
Specifies the font to use when writing text on the image. Set the properties of the TFont object to specify the font face, color, size, and style of the font. |
Brush |
Determines the color and pattern the canvas uses for filling graphical shapes and backgrounds. Set the properties of the TBrush object to specify the color and pattern or bitmap to use when filling in spaces on the canvas. |
Pen |
Specifies the kind of pen the canvas uses for drawing lines and outlining shapes. Set the properties of the TPen object to specify the color, style, width, and mode of the pen. |
PenPos |
Specifies the current drawing position of the pen. |
Pixels |
Specifies the color of the area of pixels within the current ClipRect. |
These properties are described in more detail in Using the properties of the Canvas object.
Here is a list of several methods you can use:
Common methods of the Canvas object
Method |
Descriptions |
Arc |
Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle. |
Chord |
Draws a closed figure represented by the intersection of a line and an ellipse. |
CopyRect |
Copies part of an image from another canvas into the canvas. |
Draw |
Renders the graphic object specified by the Graphic parameter on the canvas at the location given by the coordinates (X, Y). |
Ellipse |
Draws the ellipse defined by a bounding rectangle on the canvas. |
FillRect |
Fills the specified rectangle on the canvas using the current brush. |
FloodFill (VCL only) |
Fills an area of the canvas using the current brush. |
FrameRect (VCL only) |
Draws a rectangle using the Brush of the canvas to draw the border. |
LineTo |
Draws a line on the canvas from PenPos to the point specified by X and Y, and sets the pen position to (X, Y). |
MoveTo |
Changes the current drawing position to the point (X,Y). |
Pie |
Draws a pie-shaped the section of the ellipse bounded by the rectangle (X1, Y1) and (X2, Y2) on the canvas. |
Polygon |
Draws a series of lines on the canvas connecting the points passed in and closing the shape by drawing a line from the last point to the first point. |
Polyline |
Draws a series of lines on the canvas with the current pen, connecting each of the points passed to it in Points. |
Rectangle |
Draws a rectangle on the canvas with its upper left corner at the point (X1, Y1) and its lower right corner at the point (X2, Y2). Use Rectangle to draw a box using Pen and fill it using Brush. |
RoundRect |
Draws a rectangle with rounded corners on the canvas. |
StretchDraw |
Draws a graphic on the canvas so that the image fits in the specified rectangle. The graphic image may need to change its magnitude or aspect ratio to fit. |
TextHeight, TextWidth |
Returns the height and width, respectively, of a string in the current font. Height includes leading between lines. |
TextOut |
Writes a string on the canvas, starting at the point (X,Y), and then updates the PenPos to the end of the string. |
TextRect |
Writes a string inside a region; any portions of the string that fall outside the region do not appear. |
These methods are described in more detail in Using Canvas methods to draw graphic objects.
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|