IGxGraphics.SetTranslate

Syntax

SetTranslate(Value: IGxPointF);

Parameters

Value. Point where the origin of coordinates shifts.

Description

The SetTranslate method shifts the origin of coordinates to the point passed by the Value parameter.

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
    Img: IGxBitmap;
    ImgFont: IGxFont;
    ImgBrush: IGxBrush;
    Graph: IGxGraphics;
    p: IGxPointF;
Begin
    Img := GxBitmap.CreateNew(ImageBox1.ClientWidth, ImageBox1.ClientHeight, GxPixelFormat.Format32bppArgb);
    ImgFont := 
New GxFont.Create("Times New Roman"16, GxFontStyle.BoldItalic, GxUnit.World);
    ImgBrush := 
New GxSolidBrush.Create(GxColor.FromName("Red"));
    Graph := GxGraphicsClass.FromImage(Img);
    Graph.DrawTextW(
"Text 1", ImgFont, ImgBrush, 00);
    p := 
New GxPointF.Create(5050);
    Graph.SetTranslate(p);
    Graph.DrawTextW(
"Text 2", ImgFont, ImgBrush, 00);
    ImageBox1.Image := Img;
End Sub Button1OnClick;

After executing the example clicking the button in the ImageBox component displays a new bitmap where two labels are rendered corresponding to the settings and the difference in the origin of coordinates point shift.

See also:

IGxGraphics