DrawingAttributes.MinHeight 欄位

定義

指定 Height 屬性允許的最小值。

public: static initonly double MinHeight;
public static readonly double MinHeight;
 staticval mutable MinHeight : double
Public Shared ReadOnly MinHeight As Double 

欄位值

範例

下列範例可確保 HeightDrawingAttributes 屬性設定為合法值。 此範例假設有一個名為 InkCanvasinkCanvas1 的 。

if (DAHeight < DrawingAttributes.MinHeight)
{
    DAHeight = DrawingAttributes.MinHeight;
}
else if (DAHeight > DrawingAttributes.MaxHeight)
{
    DAHeight = DrawingAttributes.MaxHeight;
}

inkCanvas1.DefaultDrawingAttributes.Height = DAHeight;
If DAHeight < DrawingAttributes.MinHeight Then

    DAHeight = DrawingAttributes.MinHeight

ElseIf DAHeight > DrawingAttributes.MaxHeight Then

    DAHeight = DrawingAttributes.MaxHeight

End If

inkCanvas1.DefaultDrawingAttributes.Height = DAHeight

備註

MinHeight使用 欄位來檢查值是否在屬性允許 Height 的限制內。 當值來自未知的來源時,請執行此動作,例如未受限制的使用者輸入。

適用於