PrintPage(PageNumber: Integer; Graphics: IGxGraphics);
PageNumber. The number of the displayed page.
Graphics. Graphic context in which the table is to be displayed.
The PrintPage method displays table in a graphic context.
Executing the example requires a form, a button with the Button1 identifier located on this form, the TabSheetBox component, the UiTabSheet and ImageBox components with the UiTabSheet1 and ImageBox1 identifiers respectively. The UiTabSheet is the data source for the TabSheetBox component. Also the file system should include the file C:/map.bmp containing an image.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
tSheet: ITabSheet;
Printer: ITabSheetPrinter;
pCount: Integer;
Graphics: IGxGraphics;
m_Image: IGxImage;
Begin
tSheet := UiTabSheet1.TabSheet;
Printer := tSheet.CreatePrinter;
Printer.FirstPageGap := 30;
Printer.HeaderGap := 15;
Printer.FooterGap := 30;
Printer.PageSettings.BlackAndWhite := True;
pCount := Printer.GetPageCount;
If pCount > 0 Then
m_Image := New GxImage.CreateFromFile("C:/map.bmp");
Graphics := GxGraphicsClass.FromImage(m_Image);
Printer.PrintPage(1, Graphics);
ImageBox1.Image := m_Image;
End If;
End Sub Button1OnClick;
After executing the example the contents of the TabSheetBox component is displayed in graphical form with the specified parameters in the ImageBox1 component.
See also: