Condividi tramite


PrintForm.PrinterSettings Property

Gets or sets a PrinterSettings object that you can use to specify various properties of a printer.

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

Syntax

'Dichiarazione
<BrowsableAttribute(False)> _
Public Property PrinterSettings As PrinterSettings
    Get
    Set
[BrowsableAttribute(false)]
public PrinterSettings PrinterSettings { get; set; }
[BrowsableAttribute(false)]
public:
property PrinterSettings^ PrinterSettings {
    PrinterSettings^ get ();
    void set (PrinterSettings^ value);
}
[<BrowsableAttribute(false)>]
member PrinterSettings : PrinterSettings with get, set
function get PrinterSettings () : PrinterSettings
function set PrinterSettings (value : PrinterSettings)

Property Value

Type: System.Drawing.Printing.PrinterSettings
Returns a PrinterSettings object.

Remarks

The settings returned by the PrinterSettings are the same settings that are exposed to a user in the Print dialog box.

You can specify several printer settings by using the PrinterSettings property. For example, use the Copies property to specify the number of copies to print. Use the PrinterName property to specify the printer to use, and use the PrintRange property to specify the range of pages to print.

Nota

To enable the user to select the settings, you may want to use a PrintDialog component to display a standard Print dialog box, and then assign the PrinterSettings property value to the PrinterSettings property.

Examples

The following code example demonstrates how to use the PrinterSettings property to set the number of copies to print and to check whether the specified printer is valid. This example requires that you have a PrintForm component named PrintForm1 on a form.

PrintForm1.PrinterSettings.Copies = 2
If PrintForm1.PrinterSettings.IsValid Then
    PrintForm1.Print()
End If

.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)