Unit: GxUnit;
The Unit property determines the units that are used to specify the graphic image settings.
Executing the example requires a form with the ImageButton component named ImageButton1.
Sub ImageButton1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Img: IGxImage;
TransfImage: IGxRectangleTransformImage;
Marg: IGxMargins;
Begin
Img := GxRectangleTransformImage.FromFile("c:\Image.bmp");
TransfImage := Img As IGxRectangleTransformImage;
Marg := TransfImage.Margins;
Marg.Bottom := 5;
Marg.Left := 5;
Marg.Right := 5;
Marg.Top := 5;
TransfImage.Unit := GxUnit.Millimeter;
ImageButton1.NormalLook.Background := TransfImage;
End Sub ImageButton1OnClick;
After executing the example clicking the ImageButton1 button changes the button's background. The Image.bmp image is specified as a background in the normal mode of the button. The fixed area in 5 mm from all the edges is set for the image.
See also: