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 and DevNames properties, 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 and the information shown in the DevMode and DevNames properties is updated. Also, the device context resolution is set in the XResolution and YResolution properties. The device context is freed using the PrintDeleteDC method, and the DevMode property and DevNames property are released with the ReleaseDevModeHandle 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();
VImageKit1->PrintDraw->ReleaseDevModeHandle();

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;
VImageKit1.PrintDraw.ReleaseDevModeHandle;

Differences with ImageKit 7/8/9 ActiveX/VCL

If this method succeeds, the information indicated by DevMode property and DevNames property is updated, and the device context resolution is set in XResolution property and YResolution property.

 

The ImageKit10 VCL is a product created by Newtone Corporation