IGxGraphics.TextRenderingHint

Syntax

TextRenderingHint: GxTextRenderingHint;

Description

The TextRenderingHint property determines text output mode.

Fore Example

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

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    BMP: IGxBitmap;
    Graph: IGxGraphics;
    GraphClass: GxGraphicsClass;
    Font: IGxFont;
    Brush: IGxBrush;
    Format: IGxStringFormat;
Begin
    BMP := GxBitmap.CreateNew(ImageBox1.ClientWidth, ImageBox1.ClientHeight, GxPixelFormat.Unknown);
    Font := 
New GxFont.Create("Times New Roman"100, GxFontStyle.BoldItalic, GxUnit.World);
    Brush := 
New GxSolidBrush.Create(GxColor.FromName("White"));
    Format := 
New GxStringFormat.Create;
    GraphClass := 
New GxGraphics.Create;
    Graph := GraphClass.FromImage(BMP);
    Graph.TextRenderingHint := GxTextRenderingHint.AntiAlias;
    Graph.DrawTextF(
"PROGNOZ", Font, Brush, 500, Format);
    ImageBox1.Image := BMP;
End Sub Button1OnClick;

After executing the example clicking the button in the ImageBox component displays bitmap with the "PROGNOZ" label according to the defined settings.

Fore.NET Example

Executing the example requires a form with the button named Button1, the PictureBox component named PictureBox1. Add links to the Drawing, ForeIO, Forms.NET, Marshalers system assemblies.

Imports System.IO;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.ForeIO;
Imports Prognoz.Platform.Interop.Marshalers;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var    

    BMP: GxBitmap;
    BMPCls: GxBitmapClass = New GxBitmapClass();
    Graph: GxGraphics;
    GraphClass: GxGraphicsClass = New GxGraphicsClassClass();
    Font: GxFont = New GxFontClass();
    Brush: GxSolidBrush = New GxSolidBrushClass();
    ColorCls: GxColorClass = New GxColorClassClass();
    Color: GxColor;
    Format: GxStringFormat = New GxStringFormatClass();
    ImgStream: System.IO.Stream = New System.IO.MemoryStream();
Begin
    BMP := BMPCls.CreateNew(PictureBox1.Width, PictureBox1.Height, GxPixelFormat.pifUnknown);
    Font.Create("Times New Roman"100, GxFontStyle.gfsBoldItalic, GxUnit.guWorld);
    Color := ColorCls.FromKnownColor(GxKnownColor.clWhite);
    Brush.Create(Color);
    Graph := GraphClass.FromImage(BMP);
    Graph.TextRenderingHint := GxTextRenderingHint.trhAntiAlias;
    Graph.DrawTextF("PROGNOZ", Font, Brush, 500, Format);
    BMP.SaveToStream(ImgStream);
    PictureBox1.Image := Image.FromStream(ImgStream);
End Sub;

The result matches with the Fore example.

See also:

IGxGraphics