# CanvasDrawTextAtPoint

int CanvasDrawTextAtPoint (int panelHandle, int controlID,char text[], char metaFont[], Point anchorPoint,int alignment);

## Purpose

Draws a text string at the specified location in the canvas control. The location is in terms of an anchor point and an alignment around the point. If the string exceeds the size of the rectangle, CanvasDrawTextAtPoint clips the text.

CanvasDrawTextAtPoint draws the text using the current value of ATTR_PEN_COLOR.

CanvasDrawTextAtPoint draws the background of the text using the current value of the following attributes:

ATTR_PEN_FILL_COLOR
ATTR_PEN_MODE
ATTR_PEN_PATTERN

If you do not want to draw the background of the rectangle, set the ATTR_PEN_FILL_COLOR attribute of the canvas control to VAL_TRANSPARENT.

## Parameters

Input
Name | Type | Description
panelHandle | integer | Specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
controlID | integer | The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by NewCtrl or DuplicateCtrl.
text | string | Text string to be drawn at the anchor point.
metaFont | string | The text font. metaFont must be one of the predefined metafonts or a metafont you create by calling CreateMetaFont. Predefined metafonts—Contain typeface information, point size, and text styles such as bold, underline, italic, and strikeout. These metafonts are used in the LabWindows/CVI environment. Examples of predefined metafonts include VAL_MENU_META_FONT, VAL_DIALOG_META_FONT, VAL_EDITOR_META_FONT, and VAL_APP_META_FONT. LabWindows/CVI-supplied metafonts—Supplied with LabWindows/CVI and installed while LabWindows/CVI is running. These metafonts use typefaces that are not native to the operating systems. Examples of LabWindows/CVI-supplied metafonts are VAL_7SEG_META_FONT and VAL_SYSTEM_META_FONT.
anchorPoint | Point | Point structure specifying location of the point at which to draw the text. The Point structure is defined as follows: typedef struct { int x; int y; } Point; You can create a Point without having to declare a variable by using the following function: Point MakePoint (int x, int y); Example CanvasDrawTextAtPoint (panelHandle, controlID, "sample text", VAL_APP_META_FONT, MakePoint (20, 30), VAL_CENTER);
alignment | integer | Determines the placement of the text string in relation to the anchor point. Each alignment value refers to a point on the rectangle that implicitly encloses the text string. The text string is placed so that the point you specify with the alignment parameter is at the location you specify with the anchorPoint parameter. The valid values for the alignment parameter are listed in the following table.
VAL_LOWER_LEFT | Draw the string so that lower left corner of its enclosing rectangle is at the location specified by anchorPoint.
VAL_CENTER_LEFT | Draw the string so that midpoint of the left edge of its enclosing rectangle is at the location specified by anchorPoint.
VAL_UPPER_LEFT | Draw the string so that upper left corner of its enclosing rectangle is at the location specified by anchorPoint.
VAL_LOWER_CENTER | Draw the string so that midpoint of the bottom edge of its enclosing rectangle is at the location specified by anchorPoint.
VAL_CENTER | Draw the string so that center of its enclosing rectangle is at the location specified by anchorPoint.
VAL_UPPER_CENTER | Draw the string so that midpoint of the top edge of its enclosing rectangle is at the location specified by anchorPoint.
VAL_LOWER_RIGHT | Draw the string so that lower right corner of its enclosing rectangle is at the location specified by anchorPoint.
VAL_CENTER_RIGHT | Draw the string so that midpoint of the right edge of its enclosing rectangle is at the location specified by anchorPoint.
VAL_UPPER_RIGHT | Draw the string so that upper right corner of its enclosing rectangle is at the location specified by anchorPoint.
For example, VAL_UPPER_LEFT means that the text string is placed so that the upper left corner of the text string is at the anchorPoint.

## Return Value

Name | Type | Description
status | integer | Return value indicating whether the function was successful. A negative number indicates that an error occurred.
Code | Error Message String
xx | Success