TextRenderingHint: GxTextRenderingHint;
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.Format32bppArgb);
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("New Image", Font, Brush, 50, 0, Format);
ImageBox1.Image := BMP;
End Sub Button1OnClick;
Clicking the button in the ImageBox component displays a new bitmap with the specified label containing defined settings.
The requirements and result of the Fore.NET example execution match with those in the Fore example. Use Fore.NET analogs instead of Fore components. 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.pifFormat32bppArgb);
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("New Image", Font, Brush, 50, 0, Format);
BMP.SaveToStream(ImgStream);
PictureBox1.Image := Image.FromStream(ImgStream);
End Sub;
See also: