IGxGraphicsClass.FromImage

Syntax

FromImage(Image: IGxImage): IGxGraphics;

Parameters

Image - image source.

Description

The FromImage method returns the graphic object obtained from the image passed by the Image parameter.

Example

Executing the example requires a form that contains a button named Button1 and the ImageBox component named ImageBox1. Any 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;

After executing the example clicking the button gets the graphic context of the image that is displayed in the ImageBox1 component. The word Example is displayed over the current image after that the image is refreshed in the ImageBox1 component.

See also:

IGxGraphicsClass