SetScale(X: Double, Y: Double);
X. Scale by the X axis.
Y. Scale by the Y axis.
The SetScale method sets the scale of the graphic image.
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;
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);
Graph.SetScale(10, 10);
Graph.DrawTextW("PROGNOZ", Font, Brush, 0, 0);
ImageBox1.Image := BMP;
End Sub Button1OnClick;
After executing the example clicking the button displays a new bitmap in the ImageBox component where two "PROGNOZ" labels are rendered with different scales according to the settings.
See also: