Printer.PrintAction Property
Gets or sets a value that determines whether the print output is directed to a printer, to a print preview window, or to a file.
Namespace: Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6
Assembly: Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
Syntax
public PrintAction PrintAction { get; set; }
public:
property PrintAction PrintAction {
PrintAction get();
void set(PrintAction value);
}
member PrintAction : PrintAction with get, set
Public Property PrintAction As PrintAction
Property Value
Type: System.Drawing.Printing.PrintAction
Returns a PrintAction enumeration.
Remarks
When PrintToPrinter is selected, the print output is directed to the computer's default printer. If no printer is installed an error is raised.
When PrintToPreview is selected, the print output is displayed in a standard PrintPreviewDialog control.
When PrintToFile is selected, the print output is saved to an Encapsulated PostScript file (.eps, .ps, or .ai) in the path specified by the PrintFileName property. If no file name is specified an error is raised. Files are saved in an 8-bit Grayscale PostScript format. 24-bit RGB PostScript is not supported.
Note
The user is not prompted for a path or file name extension. To make sure that the file has a valid path and extension, you can implement your own dialog box. To do this, use a SaveFileDialog component and assign the return value to the PrintFileName property before you call the Print method.
The following table lists the PrintAction values that are valid for the PrintAction property.
Enumeration name |
Description |
---|---|
PrintToFile |
The print operation is directed to a file. |
PrintToPreview |
The print operation is directed to a print preview dialog box. |
PrintToPrinter |
The print operation is directed to a printer. |
Note
Functions and objects in the Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 namespace are provided for use by the tools for upgrading from Visual Basic 6.0 to Visual Basic. In most cases, these functions and objects duplicate functionality that you can find in other namespaces in the .NET Framework. They are necessary only when the Visual Basic 6.0 code model differs significantly from the .NET Framework implementation.
Examples
The following example demonstrates how to set the PrintAction property. It requires that you have three RadioButton controls that enable the user to select a printing method.
Dim Printer As New Printer
If RadioButton1.Checked = True Then
Printer.PrintAction = Printing.PrintAction.PrintToPrinter
ElseIf RadioButton2.Checked = True Then
Printer.PrintAction = Printing.PrintAction.PrintToPreview
Else
Printer.PrintFileName = _ My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData _
& "Form1.eps"
Printer.PrintAction = Printing.PrintAction.PrintToFile
End If
See Also
Printer Class
Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 Namespace
bc1bcb98-e13b-4c68-a514-045c042dbf364e434922-3709-49c6-a69d-38120ed72d7a7f9351ea-cb3e-4615-8f70-5a29c165c1a7
Return to top