GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / PrintDialog Method / PrintDialog(Int32) Method
A unique image identifier of the GdPicture image representing the image in use.
Example





In This Topic
PrintDialog(Int32) Method
In This Topic
Invokes the standard Windows Print dialog box, which allows you to select additional options or settings and then to print the specified GdPicture image. This method uses the actual paper size when printing.
Syntax
'Declaration
 
Public Overloads Function PrintDialog( _
   ByVal ImageID As Integer _
) As Boolean
public bool PrintDialog( 
   int ImageID
)
public function PrintDialog( 
    ImageID: Integer
): Boolean; 
public function PrintDialog( 
   ImageID : int
) : boolean;
public: bool PrintDialog( 
   int ImageID
) 
public:
bool PrintDialog( 
   int ImageID
) 

Parameters

ImageID
A unique image identifier of the GdPicture image representing the image in use.

Return Value

true if the method has been followed successfully, otherwise false. Please use the PrintGetStat method to determine the reason for the printing failure.
Example
Printing an image.
Printing an image with the help of standard Windows Printer Dialog.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // Open an image file. An empty string allows the control to prompt for selecting a file.
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("");
 
    gdpictureImaging.PrintDialog(imageID);
 
    // Release used resources.
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Showing the error description of the last executed print operation, that has failed.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // Open an image file. An empty string allows the control to prompt for selecting a file.
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("");
 
    if (gdpictureImaging.PrintDialog(imageID) == false)
    {
        MessageBox.Show("Printing failed for " + gdpictureImaging.PrintGetDocumentName() +
                        "\nError: " + gdpictureImaging.PrintGetStat() +
                        "\nMessage: " + gdpictureImaging.PrintGetLastError(), "Printing status", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
    else
        MessageBox.Show("Printing succeded for " + gdpictureImaging.PrintGetDocumentName(), "Printing status", MessageBoxButtons.OK, MessageBoxIcon.Information);
 
    // Release used resources.
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also