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
'Declaração
Public Property PrintAction As PrintAction
Get
Set
public PrintAction PrintAction { get; set; }
public:
property PrintAction PrintAction {
PrintAction get ();
void set (PrintAction value);
}
member PrintAction : PrintAction with get, set
function get PrintAction () : PrintAction
function set PrintAction (value : 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.
Observação
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. |
Observação
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 2010. 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
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 Namespace
Other Resources
How to: Fix Upgrade Errors by Using the Printer Compatibility Library (Visual Basic)
Deploying Applications That Reference the Printer Compatibility Library