PrintForm.PrintFileName Property

Gets or sets the file name of an Encapsulated PostScript file and the path to which the file will be saved when the PrintAction property is set to PrintToFile.

Namespace:  Microsoft.VisualBasic.PowerPacks.Printing
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

声明
<BrowsableAttribute(True)> _
Public Property PrintFileName As String
    Get
    Set
[BrowsableAttribute(true)]
public string PrintFileName { get; set; }
[BrowsableAttribute(true)]
public:
property String^ PrintFileName {
    String^ get ();
    void set (String^ value);
}
[<BrowsableAttribute(true)>]
member PrintFileName : string with get, set
function get PrintFileName () : String
function set PrintFileName (value : String)

Property Value

Type: System.String
Returns a String that contains a file path and name.

Remarks

When the PrintAction property is set to PrintToFile, an image of a form will be saved to an Encapsulated PostScript file (.eps, .ps, or .ai). The PrintFileName property specifies the path to the file.

备注

To enable other applications to recognize the file as a PostScript file, you must use a valid PostScript file name extension (.eps, .ps, or .ai) in the PrintFileName property.

If no PrintFileName is specified, the user will be prompted for a file name at run time.

Note   The user will not be prompted for a path or a 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.

Examples

The following example demonstrates how to display a dialog box to prompt a user for a file name and then assign it to the PrintFileName property. This example requires that you have a PrintForm component named PrintForm1 on a form.

Dim fileDialog As New Windows.Forms.SaveFileDialog
Dim fileToSave As String
fileDialog.Title = "Save to PostScript file"
fileDialog.AddExtension = True
fileDialog.Filter = "Encapsulated PostScript (*.eps)|"
fileDialog.InitialDirectory = _
  My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData
fileDialog.ShowDialog()
fileToSave = fileDialog.FileName & ".eps"
PrintForm1.PrintFileName = filePath

.NET Framework Security

See Also

Reference

PrintForm Class

Microsoft.VisualBasic.PowerPacks.Printing Namespace

Other Resources

PrintForm Component (Visual Basic)

How to: Print a Form by Using the PrintForm Component (Visual Basic)

How to: Print the Client Area of a Form (Visual Basic)

How to: Print Client and Non-Client Areas of a Form (Visual Basic)

How to: Print a Scrollable Form (Visual Basic)

Deploying Applications That Reference the PrintForm Component (Visual Basic)