FromImage(Image: IGxImage): IGxGraphics;
Image. Image source.
The FromImage method returns the graphic object obtained from the image passed by the input parameter.
Executing the example requires a form with the Button1 button and the ImageBox component named ImageBox1. An image is loaded to ImageBox1.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
f: IGxFont;
b: IGxBrush;
Image: IGxImage;
Graph: IGxGraphics;
Begin
f := New GxFont.Create("Times New Roman", 16, GxFontStyle.BoldItalic, GxUnit.World);
b := New GxSolidBrush.Create(GxColor.FromName("Green"));
Image := ImageBox1.Image;
Graph := GxGraphicsClass.FromImage(Image);
Graph.DrawTextW("Example", f, b, 0, 0);
ImageBox1.Image := Image;
End Sub Button1OnClick;
Clicking the button gets the graphic context of the image displayed in the ImageBox1 component. The word Example is displayed over the current image, after which the image is refreshed in the ImageBox1 component.
See also: