0 out of 1 rated this helpful - Rate this topic

PrintForm.PrintAction Property

Gets or sets a value indicating whether the output is directed to a printer, to a print preview window, or to a file.

Namespace:  Microsoft.VisualBasic.PowerPacks.Printing
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)
[BrowsableAttribute(true)]
public PrintAction PrintAction { get; set; }

Property Value

Type: System.Drawing.Printing.PrintAction
Returns a PrintAction enumeration.

When PrintToPrinter is selected, the output is directed to the system default printer. You can override this behavior and explicitly set the printer and printer properties by using the PrinterSettings property. If no default printer is available, the user is prompted to select a printer.

When PrintToPreview is selected, the form is displayed in a standard Windows Forms PrintPreviewDialog control.

When PrintToFile is selected, an image of the form 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, the user is prompted for a file name.

NoteNote

Files are saved in an 8-bit Greyscale PostScript format. 24-bit RGB PostScript is not supported.

NoteNote

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 calling the Print method.

The following example demonstrates how to set the PrintAction property. This example requires that you have a PrintForm component named PrintForm1 and three RadioButton controls on a form.

If RadioButton1.Checked = True Then
    PrintForm1.PrintAction = Printing.PrintAction.PrintToPrinter
ElseIf RadioButton2.Checked = True Then
    PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
Else
    PrintForm1.PrintFileName = _
  My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData _
  & "Form1.eps"
    PrintForm1.PrintAction = Printing.PrintAction.PrintToFile
End If
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.