Edit

Share via


DrawingAttributes.MinWidth Field

Definition

Specifies the smallest value allowed for the Width property.

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

Field Value

Examples

The following example ensures the Width property of the DrawingAttributes is set to a legal value. This example assumes that there is an InkCanvas called inkCanvas1.

if (DAWidth < DrawingAttributes.MinWidth)
{
    DAWidth = DrawingAttributes.MinWidth;
}
else if (DAWidth > DrawingAttributes.MaxWidth)
{
    DAWidth = DrawingAttributes.MaxWidth;
}

inkCanvas1.DefaultDrawingAttributes.Width = DAWidth;
If DAWidth < DrawingAttributes.MinWidth Then

    DAWidth = DrawingAttributes.MinWidth

ElseIf DAWidth > DrawingAttributes.MaxWidth Then

    DAWidth = DrawingAttributes.MaxWidth

End If

inkCanvas1.DefaultDrawingAttributes.Width = DAWidth

Remarks

Use the MinWidth field to check whether a value is within the limits allowed for the Width property. Do this when the value comes from an unknown source, such as unconstrained user input.

Applies to