DrawingAttributes.MaxHeight Fält

Definition

Anger det största värdet som tillåts för egenskapen Height .

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

Fältvärde

Exempel

I följande exempel ser du till att Height egenskapen för är inställd på DrawingAttributes ett juridiskt värde. Det här exemplet förutsätter att det finns en InkCanvas som heter 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

Kommentarer

Använd fältet MaxHeight för att kontrollera om ett värde ligger inom de gränser som tillåts för egenskapen Height . Gör detta när värdet kommer från en okänd källa, till exempel obehindrat användarindata.

Gäller för