vcl-cxgraphics-dot-tcxcanvas-dot-drawtext-x28-system-dot-string-system-dot-types-dot-trect-system-dot-classes-dot-talignment-cxclasses-dot-tcxalignmentvert-system-dot-boolean-system-dot-boolean-x29.md
Draws formatted text within a specified rectangle on the canvas.
procedure DrawTexT(const Text: string; R: TRect; AAlignmentHorz: TAlignment; AAlignmentVert: TcxAlignmentVert; AMultiLine: Boolean; AShowEndEllipsis: Boolean); overload;
| Name | Type | Description |
|---|---|---|
| Text | string |
A drawn text string.
| | R | TRect |
The target rectangle on the canvas.
| | AAlignmentHorz | TAlignment |
Specifies the required horizontal alignment for the drawn text string (Text).
| | AAlignmentVert | TcxAlignmentVert |
Specifies the required vertical alignment for the drawn text string (Text).
| | AMultiLine | Boolean |
Specifies if the procedure can split up displayed text into multiple lines.
| | AShowEndEllipsis | Boolean |
Specifies if the procedure displays an ellipsis at the end of the displayed text string if it does not fit into the target rectangle.
|
Call the DrawTexT procedure to draw a text string within the target rectangle on the current canvas. The DrawTexT procedure uses canvas background color and font settings to draw text.
The following code example demonstrates a TcxCustomGridTableView.OnCustomDrawPartBackground event handler that wraps a caption into multiple lines and displays an ellipsis at the end of the caption if it does not fit into the Group By box:
procedure TMyForm.cxgFilmsDBTableViewCustomDrawPartBackground(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxCustomGridCellViewInfo; var ADone: Boolean);
var
ABounds: TRect;
begin
ABounds := AViewInfo.Bounds;
ACanvas.FillRect(ABounds);
InflateRect(ABounds, -150, -4);
OffsetRect(ABounds, 140, 0);
ACanvas.DrawTexT('This is the Group By box. ' +
'It is used to group records by field values. ' +
'Drag a column header here to group by that field.',
ABounds, cxWordBreak or cxShowEndEllipsis);
ADone := True;
end;
void __fastcall TMyForm::cxgFilmsDBTableViewCustomDrawPartBackground(TcxCustomGridTableView *Sender,
TcxCanvas *ACanvas, TcxCustomGridCellViewInfo *AViewInfo, bool &ADone)
{
TRect ABounds = AViewInfo->Bounds;
ACanvas->FillRect(ABounds);
InflateRect(ABounds, -150, -4);
OffsetRect(ABounds, 140, 0);
ACanvas->DrawTexT("This is the Group By box. " +
"It is used to group records by field values. " +
"Drag a column header here to group by that field.",
ABounds, cxWordBreak | cxShowEndEllipsis);
ADone = true;
}
See Also
TcxCanvas.DrawTexT(System.String,System.Types.TRect,System.Integer,System.Boolean) Procedure