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

[Visual Basic]   [ Boolean = ]imagekitcontrolname.PrintDraw.PrintDialog
[Visual C++]     [ BOOL = ]imagekitcontrolname.GetPrintDraw().PrintDialog()

Parameters

None

Return Value

Returns True (nonzero) if successful. Returns False (0) 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 Hdc 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:

Visual Basic

    Dim Ret As Boolean


    ImageKit1.PrintDraw.ClearProperty

    ImageKit1.PrintDraw.Copies = 1

    ImageKit1.PrintDraw.Options = &H4 Or &H8 Or &H100000

    Ret = ImageKit1.PrintDraw.PrintDialog

    If Ret = 0 Then Exit Sub


    ImageKit1.PrintDraw.DocName = "ImageKit Print Sample"

    If (ImageKit1.PrintDraw.PrintStartDoc <> False) Then

       ImageKit1.PrintDraw.PrintStartPage


       'code for displaying image or text


       ImageKit1.PrintDraw.PrintEndPage

       ImageKit1.PrintDraw.PrintEndDoc

    End If

    ImageKit1.PrintDraw.PrintDeleteDC


Visual C++

    BOOL Ret;


    ImageKit1.GetPrintDraw().ClearProperty();

    ImageKit1.GetPrintDraw().SetCopies(1);

    ImageKit1.GetPrintDraw().SetOptions(0x4 | 0x8 | 0x100000);

    Ret = ImageKit1.GetPrintDraw().PrintDialog();

    if (Ret == FALSE) return;


    ImageKit1.GetPrintDraw().SetDocName("ImageKit Print Sample");

    if (ImageKit1.GetPrintDraw().PrintStartDoc() != FALSE) {

       ImageKit1.GetPrintDraw().PrintStartPage();


       //code for displaying image or text


       ImageKit1.GetPrintDraw().PrintEndPage();

       ImageKit1.GetPrintDraw().PrintEndDoc();

    }

    ImageKit1.GetPrintDraw().PrintDeleteDC();

 

The ImageKit8 ActiveX is a product created by Newtone Corporation