SetTranslate(Value: IGxPointF);
Value. Point where the origin of coordinates shifts.
The SetTranslate method shifts the origin of coordinates to the point passed by the Value parameter.
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;
p: IGxPointF;
Begin
BMP := GxBitmap.CreateNew(ImageBox1.ClientWidth, ImageBox1.ClientHeight, GxPixelFormat.Unknown);
Font := New GxFont.Create("Times New Roman", 16, GxFontStyle.BoldItalic, GxUnit.World);
Brush := New GxSolidBrush.Create(GxColor.FromName("Red"));
GraphClass := New GxGraphics.Create;
Graph := GraphClass.FromImage(BMP);
Graph.DrawTextW("PROGNOZ", Font, Brush, 0, 0);
p := New GxPointF.Create(50, 50);
Graph.SetTranslate(p);
Graph.DrawTextW("PROGNOZ", Font, Brush, 0, 0);
ImageBox1.Image := BMP;
End Sub Button1OnClick;
After executing the example clicking the button in the ImageBox component displays a new bitmap where two labels "PROGNOZ" are rendered corresponding to the settings and the difference in the origin of coordinates point shift.
See also: