PrintDocument Object

  • Thread starter Thread starter Roger
  • Start date Start date
R

Roger

Is there anyway to disable the pop-up window that shows
the printing progress? I have a program to prints multiple
documents and everytime I print a document, the pop-up
appears.
 
Roger,
You can set the PrintController of the document to an instance of
StandardPrintController the standard is PrintControllerWithStatusDialog
which, of course, puts up the dialog. See
ms-help://MS.VSCC/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemDrawingPrint
ingPrintDocumentClassPrintControllerTopic.htm
Ron Allen
 
I could not find that path on my local drive and if I go to the
internet, it is not a valid site.

I understand what you are says, I just need some code examples. When I
go to msdn.com to view the StandardPrintController object, it just gives
me definition, but does not exactly tell me how to use it. Any help
would be appreciated. Thanks.

ms-help://MS.VSCC/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemDrawingP
rintingPrintDocumentClassPrintControllerTopic.htm
 
Roger,
The path is a VS.NET help file path. If you don't have that I've pasted
in the help topic for the PrintDocument PrintController object below which
shows using a custom print controller. Note: this is for Framework 1.1
documentation but it works for Framework 1.0 as well.

You could just use myPrintDocument.PrintController = New
StandardPrintController() to get one without the status dialog as in the
(C#) snippet below from my code.
pDoc.PrintController = new StandardPrintController();
pDoc.Print(); // just print the document -- don't preview it
pDoc.Dispose();


Example
[Visual Basic, C#] The following example assumes you have created an
instance of the PrintDocument class that is named myPrintDocument. The
example creates a new instance of the PrintController class, assigns it to
the PrintController property of myPrintDocument, and prints the document.

[Visual Basic, C#] Use the System.Drawing.Printing and System.Windows.Forms
namespaces for this example.

[Visual Basic]
Public Sub myPrint()
If useMyPrintController = True Then
myPrintDocument.PrintController = New myControllerImplementation()
If wantsStatusDialog = True Then
myPrintDocument.PrintController = _
New PrintControllerWithStatusDialog( _
myPrintDocument.PrintController)
End If
End If
myPrintDocument.Print()
End Sub
[C#]
public void myPrint()
{
if (useMyPrintController == true)
{
myPrintDocument.PrintController =
new myControllerImplementation();
if (wantsStatusDialog == true)
{
myPrintDocument.PrintController =
new PrintControllerWithStatusDialog
(myPrintDocument.PrintController);
}
}
myPrintDocument.Print();
}
[C++, JScript] No example is available for C++ or JScript. To view a Visual
Basic or C# example, click the Language Filter button in the upper-left
corner of the page.

Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows
2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003
family

..NET Framework Security:

a.. PrintingPermission for safe printing from a restricted dialog box.
Associated enumeration: PrintingPermissionLevel.SafePrinting
 
Back
Top