AutoSize: Boolean;
AutoSize: Boolean;
The AutoSize property determines whether the control is automatically resized to fit size of the image placed in it.
If the value is True, the control is automatically resized to fit the image size, if the value is False, the control is not resized.
The default property value is False.
Executing the example requires a regular report with the REGULAR_REPORT identifier, which sheet contains an image. Add links to the Metabase, Report, Tab, Drawing system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Report: IPrxReport;
Sheet: IPrxTable;
Image: IPrxPicture;
Pict: IGxImage;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("REGULAR_REPORT").Edit;
Report := MObj As IPrxReport;
Sheet := Report.Sheets.Item(0) As IPrxTable;
Image := Sheet.TabSheet.Objects.Item(0).Extension As IPrxPicture;
Pict := GxImage.FromFile("C:\Logo.jpg");
Image.Image := Pict;
Image.AutoSize := True;
Image.Center := True;
Image.Proportional := False;
Image.Stretch := False;
MObj.Save;
End Sub Main;
The image in the regular report is replaced with the specified one of original size, the image is centered, aspect ratio is locked, and image extension to fit the control's size, in which the image is located, is also locked.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
Imports Prognoz.Platform.Interop.Drawing;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
Report: IPrxReport;
Sheet: IPrxTable;
Image: IPrxPicture;
Pict: GxImage = New GxImageClass_2();
Begin
MB := Params.Metabase;
MObj := MB.ItemById["REGULAR_REPORT"].Edit();
Report := MObj As IPrxReport;
Sheet := Report.Sheets.Item[0] As IPrxTable;
Image := Sheet.TabSheet.Objects.Item[0].Extension As IPrxPicture;
Pict.CreateFromFile("C:\Logo.jpg");
Image.Image := Pict;
Image.AutoSize := True;
Image.Center := True;
Image.Proportional := False;
Image.Stretch := False;
MObj.Save();
End Sub;
See also: