This method displays the Print dialog box and creates a device context.

[C++Builder]   [ Boolean = ]imagekitcontrolname->PrintDraw->PrintDialog()
[Delphi]   [ Boolean = ]imagekitcontrolname.PrintDraw.PrintDialog

Parameters

None

Return Value

Returns True if successful. Returns False if unsuccessful.

Explanation

The PrintDialog method displays the Print dialog box and creates a device context using those settings. By executing the GetDevModeHandle method and retrieving the DevMode property, the "Print" dialog box can be displayed with the printer name and printing conditions. To use the current printer with its existing settings then it is not necessary to execute the GetDevModeHandle method. The Collate, Copies, FromPage, ToPage, MaxPage, MinPage, Options, PrintRange, and PrintToFile property values are displayed in the "Print" dialog box when it is initialized and changes made to those settings in the "Print" dialog box are returned to the properties when the printing is complete. If the PrintDialog method is successful, the printer device context is set into the Handle property. The device context is freed using the PrintDeleteDC method.

The PrintDialog method corresponds to the Print Control's PrintDlg method in earlier versions of the ImageKit.

 

Sample code: Printing:

In C++Builder

bool Ret;

VImageKit1->PrintDraw->ClearProperty();
VImageKit1->PrintDraw->Copies = 1;
Ret = VImageKit1->PrintDraw->PrintDialog();
if (Ret == false) return;

VImageKit1->PrintDraw->DocName = "ImageKit Print Sample";
if (VImageKit1->PrintDraw->PrintStartDoc() != false) {
   VImageKit1->PrintDraw->PrintStartPage();

   //code for displaying image or text

   VImageKit1->PrintDraw->PrintEndPage();
   VImageKit1->PrintDraw->PrintEndDoc();
}
VImageKit1->PrintDraw->PrintDeleteDC();

In Delphi

Ret: Boolean;

VImageKit1.PrintDraw.ClearProperty;
VImageKit1.PrintDraw.Copies := 1;
Ret := VImageKit1.PrintDraw.PrintDialog;
if Ret = False then Exit;

VImageKit1.PrintDraw.DocName := 'ImageKit Print Sample';
if (VImageKit1.PrintDraw.PrintStartDoc <> False) then
begin
   VImageKit1.PrintDraw.PrintStartPage;

   //code for displaying image or text

   VImageKit1.PrintDraw.PrintEndPage;
   VImageKit1.PrintDraw.PrintEndDoc;
end;
VImageKit1.PrintDraw.PrintDeleteDC;

 

The ImageKit9 VCL is a product created by Newtone Corporation