通过


DrawingAttributes.MinHeight 字段

定义

指定属性允许的 Height 最小值。

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

字段值

示例

以下示例确保该HeightDrawingAttributes属性设置为法定值。 此示例假定有一个 InkCanvas 调用 inkCanvas1

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 的限制范围内。 当值来自未知源(例如不受约束的用户输入)时执行此操作。

适用于