Canvas#

Qualified name: delphivcl.Canvas

class Canvas#

Bases: Persistent

TCanvas provides an abstract drawing space for objects that must render their own images. Use TCanvas as a drawing surface for objects that draw an image of themselves. Standard window controls such as edit controls or list boxes do not require a canvas, as they are drawn by the system. TCanvas provides properties, events, and methods that assist in creating an image by:

Specifying the type of brush, pen, and font to use. Drawing and filling a variety of shapes and lines. Writing text. Rendering graphic images. Enabling a response to changes in the current image. TCanvas has two descendants, TControlCanvas and TMetafileCanvas, which assist in drawing images of controls and in creating metafile images for objects.

Methods

AngleArc

Draws an arc on the image along the perimeter of the circle defined by the parameters.

Arc

Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle.

ArcTo

Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle.

BrushCopy

Copies a portion of a bitmap onto a rectangle on the canvas, replacing one of the colors of the bitmap with the brush of the canvas.

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.

Create

Creates an instance of TCanvas.

Destroy

Destroys an instance of TCanvas.

Draw

Renders the graphic specified by the Graphic parameter on the canvas at the location given by the coordinates (X, Y).

DrawFocusRect

Draws a rectangle in the style used to indicate that the object inside the rectangle has focus.

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

Fills an area of the canvas using the current brush.

FrameRect

Draws a rectangle using the Brush of the canvas to draw the border.

GetPixel

This is the same as TCanvas.Pixels[x, y].

HandleAllocated

Indicates whether the TCanvas object has acquired a handle to a device context.

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).

Lock

MoveTo

Changes the current drawing position to the point (X,Y).

Pie

Draws a pie-shaped section of the ellipse bounded by the rectangle (X1, Y1) and (X2, Y2) on the canvas.

PolyBezier

Draws a set of Bezier curves.

PolyBezierTo

Draws a set of Bezier curves and updates the value of PenPos.

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.

Refresh

Deselects the Pen, Brush, and Font from the device context.

RoundRect

Draws a rectangle with rounded corners on the canvas.

SetPixel

This is the same as TCanvas.Pixels[x, y] := color Specifies the color of the pixels within the current ClipRect.

StretchDraw

Draws the graphic specified by the Graphic parameter in the rectangle specified by the Rect parameter.

TextExtent

Returns the width and height, in pixels, of a string rendered in the current font.

TextHeight

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 clipping rectangle.

TextWidth

TryLock

Unlock

Attributes

Brush

Determines the color and pattern for filling graphical shapes and backgrounds.

CanvasOrientation

Determines the orientation of the canvas as left-to-right or right-to-left.

ClassName

Returns the TObject.ClassName

ClipRect

Specifies the boundaries of the clipping rectangle.

CopyMode

Specifies how a graphical image is copied onto the canvas.

Font

Specifies the font to use when writing text on the image.

Handle

Specifies the handle for this canvas.

LockCount

Indicates the number of times the canvas has been locked to prevent interference from other threads.

OnChange

Occurs when the image has just changed.

OnChanging

Occurs just before a change is made to the image.

Pen

Specifies the kind of pen the canvas uses for drawing lines and outlining shapes.

PenPos

Specifies the current drawing position of the Pen.

TextFlags

Specifies how text is written to the canvas.

AngleArc(X: Integer, Y: Integer, Radius: Cardinal, StartAngle: Single, SweepAngle: Single)#

Draws an arc on the image along the perimeter of the circle defined by the parameters. The AngleArc method draws a line from the current position to the starting point of the arc and then a counterclockwise circular arc to the arc endpoint. The arc traverses the perimeter of a circle whose center lies at (X,Y) and whose radius is Radius. The arc is drawn following the perimeter of the circle, counterclockwise, from the StartAngle with a sweep angle of SweepAngle. If the sweep angle is greater than 360 degrees, the entire circle is drawn and part of the arc is drawn multiple times. The current position is updated to the arc endpoint.

Arc(X1: Integer, Y1: Integer, X2: Integer, Y2: Integer, X3: Integer, Y3: Integer, X4: Integer, Y4: Integer)#

Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle. Use Arc to draw an elliptically curved line with the current Pen. The arc traverses the perimeter of an ellipse that is bounded by the points (X1,Y1) and (X2,Y2). The arc is drawn following the perimeter of the ellipse, counterclockwise, from the starting point to the ending point. The starting point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X3,Y3). The ending point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X4, Y4).

Note: On Windows 9x or Windows ME, the sums X1 + X2 and Y1 + Y2 cannot exceed 32768. Also, the sum X1 + X2 + Y1 + Y2 cannot exceed 32768. On NT or Windows 2000, the drawing direction can be changed to clockwise using the Windows API call SetArcDirection.

ArcTo(X1: Integer, Y1: Integer, X2: Integer, Y2: Integer, X3: Integer, Y3: Integer, X4: Integer, Y4: Integer)#

Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle. Vcl.Graphics.TCanvas.ArcTo inherits from Vcl.Graphics.TCustomCanvas.ArcTo. All content below this line refers to Vcl.Graphics.TCustomCanvas.ArcTo. Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle. Override the ArcTo method (or just use Arcto from descendant classes) to implement drawing of an elliptically curved line with the current Pen. The arc traverses the perimeter of an ellipse that is bounded by the points (X1,Y1) and (X2,Y2). The arc is drawn following the perimeter of the ellipse, counterclockwise, from the starting point to the ending point. The starting point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X3,Y3). The ending point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X4, Y4). This procedure draws lines by using the current pen and updates the value of PenPos to the value of the last endpoint.

Brush#

Determines the color and pattern for filling graphical shapes and backgrounds. Set the Brush property to specify the color and pattern to use when drawing the background or filling in graphical shapes. The value of Brush is a TBrush object. Set the properties of the TBrush object to specify the color and pattern or bitmap to use when filling in spaces on the canvas.

Note: Setting the Brush property assigns the specified TBrush object, rather than replacing the current TBrush object.

BrushCopy(Dest: Rect, Bitmap: Bitmap, Source: Rect, Color: Color)#

Copies a portion of a bitmap onto a rectangle on the canvas, replacing one of the colors of the bitmap with the brush of the canvas. Use BrushCopy to achieve special effects such as making the copied image partially transparent. BrushCopy is provided mainly for backward compatibility. Use a TImageList instead of BrushCopy. Dest specifies the rectangular portion of the canvas that will receive the copy of the bitmap. Bitmap specifies the graphic to copy from. Source specifies the rectangular area of Bitmap to copy. Color specifies the color in Bitmap to replace with the Brush of the canvas. To use BrushCopy to make the copied image partially transparent, specify the color of the surface of the canvas (clBackground for example) as the Color of the Brush property, then call BrushCopy.

CanvasOrientation#

Determines the orientation of the canvas as left-to-right or right-to-left.

Chord(X1: Integer, Y1: Integer, X2: Integer, Y2: Integer, X3: Integer, Y3: Integer, X4: Integer, Y4: Integer)#

Draws a closed figure represented by the intersection of a line and an ellipse. Use Chord to create a shape that is defined by an arc and a line that joins the endpoints of the arc. The chord consists of a portion of an ellipse that is bounded by the points (X1,Y1) and (X2,Y2). The ellipse is bisected by a line that runs between the points (X3,Y3) and (X4,Y4). The perimeter of the chord runs counter clockwise from (X3, Y3), counterclockwise along the ellipse to (X4,Y4), and straight back to (X3,Y3). If (X3,Y3) and (X4,Y4) are not on the surface of the ellipse, the corresponding corners on the chord are the closest points on the perimeter that intersect the line. The outline of the chord is drawn using the value of Pen, and the shape is filled using the value of Brush.

Note: On Windows 9x or Windows ME, the sums X1 + X2 and Y1 + Y2 cannot exceed 32768. Also, the sum X1 + X2 + Y1 + Y2 cannot exceed 32768. On NT, the drawing direction can be changed to clockwise using the Windows API call SetArcDirection.

ClipRect#

Specifies the boundaries of the clipping rectangle.

CopyMode#

Specifies how a graphical image is copied onto the canvas. Set CopyMode to affect the way graphical images are drawn onto the canvas. The CopyMode is used when copying an image from another canvas using the CopyRect method. CopyMode is also used by TBitmap objects when they draw themselves to a canvas. Use CopyMode to achieve a variety of affects when rendering an image. Achieve special effects like merged images and making parts of a bitmap transparent by combining multiple images with different CopyModes.

CopyRect(Dest: Rect, Canvas: Canvas, Source: Rect)#

Copies part of an image from another canvas into the canvas. Use CopyRect to transfer part of the image on another canvas to the image of the TCanvas object. Dest specifies the rectangle on the canvas where the source image will be copied. The Canvas parameter specifies the canvas with the source image. Source specifies a rectangle bounding the portion of the source canvas that will be copied. The portion of the source canvas is copied using the mode specified by CopyMode.

Create()#

Creates an instance of TCanvas. Call Create to instantiate a TCanvas object at runtime. Create allocates memory for the instance of TCanvas and creates the TFont, TBrush and TPen objects for the Font, Brush, and Pen properties. Create also initializes the CopyMode to cmSrcCopy.

Destroy()#

Destroys an instance of TCanvas. Do not call Destroy directly in an application. Instead, call Free. Free verifies that the TCanvas object is not nil and only then calls Destroy.

Draw(X: Integer, Y: Integer, Graphic: Graphic)#

Renders the graphic specified by the Graphic parameter on the canvas at the location given by the coordinates (X, Y). Call Draw to draw a graphic on the canvas. Draw calls the Draw method of the graphic. The image is rendered into a rectangle determined by the size of the graphic, with the upper left corner at the point (X, Y). Graphics can be bitmaps, icons, or metafiles. If the graphic is a TBitmap object, the bitmap is rendered using the value of CopyMode. Renders the graphic specified by the Graphic parameter on the canvas at the location given by the coordinates (X, Y). Call Draw to draw a graphic on the canvas. Draw calls the Draw method of the graphic. The image is rendered into a rectangle determined by the size of the graphic, with the upper left corner at the point (X, Y). Graphics can be bitmaps, icons, or metafiles. If the graphic is a TBitmap object, the bitmap is rendered using the value of CopyMode.

DrawFocusRect(Rect: Rect)#

Draws a rectangle in the style used to indicate that the object inside the rectangle has focus. Call DrawFocusRect for the perimeter of the image of a control when the control gets or loses input focus. Because DrawFocusRect uses an XOR function, calling it a second time while specifying the same rectangle removes the rectangle from the screen. The rectangle this function draws cannot be scrolled. To scroll an area containing a rectangle drawn by DrawFocusRect, call DrawFocusRect to remove the rectangle from the screen, scroll the area, and then call DrawFocusRect to draw the rectangle in the new position.

Ellipse(X1: Integer, Y1: Integer, X2: Integer, Y2: Integer)#

Draws the ellipse defined by a bounding rectangle on the canvas. Call Ellipse to draw a circle or ellipse on the canvas. Specify the bounding rectangle either by giving:

The top left point at pixel coordinates (X1, Y1) and the bottom right point at (X2, Y2). A TRect value.If the bounding rectangle is a square, a circle is drawn.The ellipse is outlined using the value of Pen, and filled using the value of Brush.Note: On Windows 9x or Windows ME, the sums X1 + X2 and Y1 + Y2 cannot exceed 32768. Also, the sum X1 + X2 + Y1 + Y2 cannot exceed 32768.

FillRect(Rect: Rect)#

Fills the specified rectangle on the canvas using the current brush. Use FillRect to fill a rectangular region using the current brush. The region is filled including the top and left sides of the rectangle, but excluding the bottom and right edges.

FloodFill(X: Integer, Y: Integer, Color: Color, FillStyle: FillStyle)#

Fills an area of the canvas using the current brush. Use FloodFill to fill a possibly non-rectangular region of the image with the value of Brush. The boundaries of the region to be filled are determined by moving outward from the point (X,Y) until a color boundary involving the Color parameter is encountered. X and X are the coordinates on the canvas where filling starts. Color is the color that defines the boundary of the region to fill. Its interpretation depends on the value of FillStyle. FillStyle specifies whether the region is defined by all pixels with the same value as Color, or all points with a different value.

Tip: Use the Pixels property to get the exact value of the color at the point (X,Y) when using a FillStyle of fsSurface. Similarly, when FillStyle is fsBorder, use Pixels to get the exact value of the boundary color if a point on the boundary is known.

Font#

Specifies the font to use when writing text on the image. Set Font to specify the font to use for writing text on the image. The value of Font is a T Font object. Set the properties of the T Font object to specify the font face, color, size, style, and any other aspects of the font. The Canvas.Font property is only guaranteed to equal the Font property if you have an owner-drawn listbox (where you are expected to use the canvas). Even in that case, it is only guaranteed to equal the Font property once the first paint message is underway. If you use a canvas inside an ownerdraw event, everything should work as expected. Using the canvas for a reason outside the scope of its intended usage may give unpredictable results.

Note: Setting the Font property assigns the specified T Font object, rather than replacing the current T Font object.

FrameRect(Rect: Rect)#

Draws a rectangle using the Brush of the canvas to draw the border. Use FrameRect to draw a 1 pixel wide border around a rectangular region. FrameRect does not fill the interior of the rectangle with the Brush pattern. To draw a boundary using the Pen instead, use the Polygon method.

GetPixel(x, y) TColor#

This is the same as TCanvas.Pixels[x, y]. Returns the color of the pixels within the current ClipRect.

Handle#

Specifies the handle for this canvas. The Handle property specifies the Windows GDI handle to the device context for this canvas. Set Handle to the HDC for the device context the canvas must draw into. When a windowed control responds to a Windows paint message, the HDC for drawing is passed in to the PaintWindow method. In other cases, an HDC can be obtained for a window by calling the GetDeviceContext method of a control. Additionally, Windows provides API calls to obtain an HDC for a printer or for a memory image. Read the Handle property to supplement the drawing services provided by the TCanvas object with API calls that require a handle to a device context. Most of the Windows GDI calls require an HDC. TCanvas does not own the HDC. Applications must create an HDC and set the Handle property. Applications must release the HDC when the canvas no longer needs it. Setting the Handle property of a canvas that already has a valid HDC will not automatically release the initial HDC.

Note: Some descendants of TCanvas, such as TControlCanvas, do own the HDC. Do not set the Handle property for these objects. They fetch and free their own Handle.

HandleAllocated()#

Indicates whether the TCanvas object has acquired a handle to a device context. Use HandleAllocated to determine whether the Handle property is set to an HDC value. HandleAllocated indicates whether the canvas has acquired a device context. Use HandleAllocated rather than reading the Handle property. When an application reads the Handle property, TCanvas automatically allocates a new device context and returns its handle if the property had not been previously set.

LineTo(X: Integer, Y: Integer)#

Draws a line on the canvas from PenPos to the point specified by X and Y, and sets the pen position to (X, Y). Use LineTo to draw a line from PenPos up to, but not including the point (X,Y). LineTo changes the value of PenPos to (X,Y). The line is drawn using Pen.

Note: If the current Pen does not have a style of psSolid, the line is drawn with a background specified by the current brush.

Lock()#
LockCount#

Indicates the number of times the canvas has been locked to prevent interference from other threads.

MoveTo(X: Integer, Y: Integer)#

Changes the current drawing position to the point (X,Y). Use MoveTo to set the value of PenPos before calling LineTo. Calling MoveTo is equivalent to setting the PenPos property.

OnChange#

Occurs when the image has just changed.

OnChanging#

Occurs just before a change is made to the image.

Pen#

Specifies the kind of pen the canvas uses for drawing lines and outlining shapes. Set Pen to specify the pen to use for drawing lines and outlining shapes in the image. The value of Pen is a TPen object. Set the properties of the TPen object to specify the color, style, width, and mode of the pen.

Note: Setting the Pen property assigns the specified TPen object, rather than replacing the current TPen object.

PenPos#

Specifies the current drawing position of the Pen.

Pie(X1: Integer, Y1: Integer, X2: Integer, Y2: Integer, X3: Integer, Y3: Integer, X4: Integer, Y4: Integer)#

Draws a pie-shaped section of the ellipse bounded by the rectangle (X1, Y1) and (X2, Y2) on the canvas. Use Pie to draw a pie-shaped wedge on the image. The wedge is defined by the ellipse bounded by the rectangle determined by the points (X1, Y1) and (X2, Y2). The section drawn is determined by two lines radiating from the center of the ellipse through the points (X3, Y3) and (X4, Y4). The wedge is outlined using Pen, and filled using Brush.

Note: On Windows 9x or Windows ME, the sums X1 + X2 and Y1 + Y2 cannot exceed 32768. Also, the sum X1 + X2 + Y1 + Y2 cannot exceed 32768.

PolyBezier(Points: Point)#

Draws a set of Bezier curves. Use PolyBezier to draw cubic Bezier curves using the endpoints and control points specified by the Points parameter. The first curve is drawn from the first point to the fourth point, using the second and third points as control points. Each subsequent curve in the sequence needs exactly three more points: the ending point of the previous curve is used as the starting point, the next two points in the sequence are control points, and the third is the ending point. The Points parameter gives the endpoints to use when generating the Bezier curves.

Note: The Points_Size parameter is the index of the last point in the array (one less than the total number of points). This procedure draws lines by using the current pen.

Note: In Delphi, you can use the Slice function to pass a portion of an array of points to the PolyBezier method. For example, to form a Bezier curve using the first ten points from an array of 100 points, use the Slice function as follows: Canvas.PolyBezier(Slice(PointArray, 10));

Control points after a[Index+3] are ignored. Nothing happens if there aren’t enough control points.

PolyBezierTo(Points: Point)#

Draws a set of Bezier curves and updates the value of PenPos. Use PolyBezierTo to draw cubic Bezier curves using the endpoints and control points specified by the Points parameter. The first curve is drawn from the first point to the fourth point, using the second and third points as control points. Each subsequent curve in the sequence needs exactly three more points: the ending point of the previous curve is used as the starting point, the next two points in the sequence are control points, and the third is the ending point. The Points parameter gives the endpoints to use when generating the Bezier curves.

Note: The Points_Size parameter is the index of the last point in the array (one less than the total number of points). This procedure draws lines by using the current pen and updates the value of PenPos to the value of the last endpoint.

Note: In Delphi, you can use the Slice function to pass a portion of an array of points to the PolyBezierTo method. For example, to form a Bezier curve using the first ten points from an array of 100 points, use the Slice function as follows: Canvas.PolyBezierTo(Slice(PointArray, 10));

Polygon(Points: Point)#

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. Use Polygon to draw a closed, many-sided shape on the canvas, using the value of Pen. After drawing the complete shape, Polygon fills the shape using the value of Brush. The Points parameter is an array of points that give the vertices of the polygon.

Note: The Points_Size parameter is the index of the last point in the array (one less than the total number of points). The first point is always connected to the last point.

Note: In Delphi, you can use the Slice function to pass a portion of an array of points to the Polygon method. For example, to form a polygon using the first ten points from an array of 100 points, use the Slice function as follows: Canvas.Polygon(Slice(PointArray, 10));

To draw a polygon on the canvas, without filling it, use the Polyline method, specifying the first point a second time at the end.

Polyline(Points: Point)#

Draws a series of lines on the canvas with the current pen, connecting each of the points passed to it in Points. Use Polyline to connect a set of points on the canvas. If you specify only two points, Polyline draws a single line. The Points parameter is an array of points to be connected.

Note: The Points_Size parameter is the index of the last point in the array (one less than the total number of points). Note: In Delphi, you can use the Slice function to pass a portion of an array of points to the Polyline method. For example, to form a line connecting the first ten points from an array of 100 points, use the Slice function as follows: Canvas.Polyline(Slice(PointArray, 10));

Calling the MoveTo function with the value of the first point, and then repeatedly calling LineTo with all subsequent points will draw the same image on the canvas. However, unlike LineTo, Polyline does not change the value of PenPos.

Rectangle(X1: Integer, Y1: Integer, X2: Integer, Y2: Integer)#

Draws a rectangle on the canvas. Use Rectangle to draw a rectangle using Pen and fill it with Brush. Specify the rectangle’s coordinates in one of two ways: Giving four coordinates that define the upper left corner at the point (X1, Y1) and the lower right corner at the point (X2, Y2). Using a TRect type. To fill a rectangular region without drawing the boundary in the current pen, use FillRect. To outline a rectangular region without filling it, use FrameRect or Polygon. To draw a rectangle with rounded corners, use RoundRect.

Refresh()#

Deselects the Pen, Brush, and Font from the device context. Call Refresh to return the HDC used by the canvas to a default state. Refresh does not change the values of the Font, Brush, or Pen properties. Calling any of the drawing methods of the canvas after calling Refresh will reselect the Font, Brush, or Pen into the HDC if it is used by the drawing method.

RoundRect(X1: Integer, Y1: Integer, X2: Integer, Y2: Integer, X3: Integer, Y3: Integer)#

Draws a rectangle with rounded corners on the canvas. Use RoundRect to draw a rounded rectangle using Pen and fill it with Brush. The rectangle will have edges defined by the points (X1,Y1), (X2,Y1), (X2,Y2), (X1,Y2), but the corners will be shaved to create a rounded appearance. The curve of the rounded corners matches the curvature of an ellipse with width X3 and height Y3. To draw an ellipse instead, use Ellipse. To draw a true rectangle, use Rectangle.

SetPixel(x, y, color)#

This is the same as TCanvas.Pixels[x, y] := color Specifies the color of the pixels within the current ClipRect.

StretchDraw(Rect: Rect, Graphic: Graphic)#

Draws the graphic specified by the Graphic parameter in the rectangle specified by the Rect parameter. Call StretchDraw to draw a graphic on the canvas so that the image fits in the specified rectangle. StretchDraw calls the Draw method of the graphic. The graphic object determines how to fit into the rectangle. This may involve changing magnification and/or aspect ratio. To render the graphic in its natural size, use the Draw method, instead. If the graphic is a TBitmap object, the bitmap is rendered using the value of CopyMode.

Note: If the graphic is an icon, it is not stretched.

TextExtent(Text: string) Size#

Returns the width and height, in pixels, of a string rendered in the current font. Use TextExtent to determine the space a string will occupy in the image. Other elements in the image such as lines, boxes, or additional lines of text can be positioned to accommodate the size of the text. TextExtent returns the width and height of the rectangle that bounds the text on the canvas. To check only the height, call TextHeight. To check only the width, call TextWidth.

TextFlags#

Specifies how text is written to the canvas.

TextHeight()#
TextOut(X: Integer, Y: Integer, Text: string)#

Writes a string on the canvas, starting at the point (X,Y), and then updates the PenPos to the end of the string. Use TextOut to write a string onto the canvas. The string will be written using the current value of Font. Use the TextExtent method to determine the space occupied by the text in the image. To write only the text that fits within a clipping rectangle, use TextRect instead. After a call to TextOut, the PenPos property indicates the point at the top right of the text on the canvas.

TextRect(Rect: Rect, Text: string, TextFormat: TextFormat)#

Writes a string inside a clipping rectangle. Use TextRect to write a string within a limited rectangular region. Any portions of the string that fall outside the rectangle passed in the Rect parameter are clipped and don’t appear. The upper left corner of the text is placed at the point (X, Y). Writes a string inside a clipping rectangle. Use TextRect to write a string within a limited rectangular region. Any portions of the string that fall outside the rectangle passed in the Rect parameter are clipped and don’t appear. The upper left corner of the text is placed at the point (X, Y).

TextWidth()#
TryLock()#
Unlock()#