PrintDialog.PrintableAreaWidth 属性

定义

获取页面的可打印区域的宽度。

public:
 property double PrintableAreaWidth { double get(); };
public double PrintableAreaWidth { get; }
member this.PrintableAreaWidth : double
Public ReadOnly Property PrintableAreaWidth As Double

属性值

Double

一个表示可打印页面区域的宽度的 Double

示例

以下示例演示如何使用可扩展应用程序标记语言 (XAML) 标记和代码获取属性的值 PrintableAreaWidth

<Button Width="200" Click="GetWidth">Get the Printable Width</Button>

...

private void GetWidth(object sender, RoutedEventArgs e)
{
    PrintDialog pDialog = new PrintDialog();
    PrintQueue pq = pDialog.PrintQueue;     //force initialization of the dialog's PrintTicket or PrintQueue
    txt2.Text = pDialog.PrintableAreaWidth.ToString() + " is the printable width";
}
Private Sub GetWidth(ByVal sender As Object, ByVal e As RoutedEventArgs)
    Dim pDialog As New PrintDialog()
    Dim pq As PrintQueue = pDialog.PrintQueue 'force initialization of the dialog's PrintTicket or PrintQueue
    txt2.Text = pDialog.PrintableAreaWidth.ToString() & " is the printable width"
End Sub

适用于