PrintDialog(Int32,IWin32Window) 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 As Integer, _
ByVal As IWin32Window _
) As Boolean
public bool PrintDialog(
int ,
IWin32Window
)
public function PrintDialog(
: Integer;
: IWin32Window
): Boolean;
public function PrintDialog(
: int,
: IWin32Window
) : boolean;
public: bool PrintDialog(
int ,
IWin32Window*
)
public:
bool PrintDialog(
int ,
IWin32Window^
)
Parameters
- ImageID
- A unique image identifier of the GdPicture image representing the image in use.
- owner
- Represents the top-level window that will own the modal dialog box.
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, this);
// 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, this) == 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);
}
Example
Printing an image.
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, this);
// Release used resources.
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
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, this) == 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);
}