PrintDialog.PrintableAreaHeight 属性

定义

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

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

属性值

Double

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

示例

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

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

...

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

适用于