DrawingAttributes.MaxWidth Field

Definition

Specifies the largest value allowed for the Width property.

public: static initonly double MaxWidth;
public static readonly double MaxWidth;
 staticval mutable MaxWidth : double
Public Shared ReadOnly MaxWidth 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 MaxWidth 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