IGxGraphics.DrawTextPF

Syntax

DrawTextPF(Text: String; Font: IGxFont; Brush: IGxBrush; Origin: IGxPointF; Format: IGxStringFormat);

Parameters

Text. Text.

Font. Font that is used to display the text.

Brush. Brush that is used to render the text.

Origin. Real point where the text is displayed.

Format. Text alignment format.

Description

The DrawTextPF method displays the text in the specified point with the specified format.

Fore Example

Executing the example requires a form with the button named Button1, the ImageBox component named. Add links to the Drawing, Forms system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    BMP: IGxBitmap;
    Graph: IGxGraphics;
    ImgFont: IGxFont;
    ImgBrush: IGxBrush;
    ImgFormat: IGxStringFormat;
    p: IGxPointF;
Begin
    BMP := GxBitmap.CreateNew(ImageBox1.ClientWidth, ImageBox1.ClientHeight, GxPixelFormat.Format24bppRgb);
    ImgFont := 
New GxFont.Create("Times New Roman"16, GxFontStyle.BoldItalic, GxUnit.World);
    ImgBrush := 
New GxSolidBrush.Create(GxColor.FromName("Red"));
    ImgFormat := 
New GxStringFormat.Create;
    ImgFormat.Alignment := GxStringAlignment.Center;
    Graph := GxGraphicsClass.FromImage(BMP);
    p := 
New GxPointF.Create(50.550.5);
    Graph.DrawTextPF(
"New Image", ImgFont, ImgBrush, p, ImgFormat);
    ImageBox1.Image := BMP;
End Sub Button1OnClick;

After executing the example, clicking the button in the ImageBox component displays a new bitmap with rendered label with specified settings.

See also:

IGxGraphics