FontWeight.Compare(FontWeight, FontWeight) Methode

Definitie

Vergelijkt twee exemplaren van FontWeight.

public:
 static int Compare(System::Windows::FontWeight left, System::Windows::FontWeight right);
public static int Compare(System.Windows.FontWeight left, System.Windows.FontWeight right);
static member Compare : System.Windows.FontWeight * System.Windows.FontWeight -> int
Public Shared Function Compare (left As FontWeight, right As FontWeight) As Integer

Parameters

left
FontWeight

Het eerste FontWeight object dat moet worden vergeleken.

right
FontWeight

Het tweede FontWeight object dat moet worden vergeleken.

Retouren

Een Int32 waarde die de relatie tussen de twee exemplaren van FontWeight. Wanneer de retourwaarde kleiner is dan nul, left kleiner is dan right. Als deze waarde nul is, geeft dit aan dat beide operanden gelijk zijn. Wanneer de waarde groter is dan nul, geeft dit aan dat left deze groter is dan right.

Voorbeelden

In het volgende codevoorbeeld wordt de Compare methode gebruikt om twee FontWeight objecten te evalueren.

// Return the typefaces for the selected font family name and font values.
Typeface typeface1 = new Typeface(new FontFamily("Arial"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
Typeface typeface2 = new Typeface(new FontFamily("Arial"), FontStyles.Normal, FontWeights.UltraBold, FontStretches.Normal);

if (FontWeight.Compare(typeface1.Weight, typeface2.Weight) < 0)
{
    // Code execution follows this path because
    // the FontWeight of typeface1 (Normal) is less than of typeface2 (UltraBold).
}
' Return the typefaces for the selected font family name and font values.
Dim typeface1 As New Typeface(New FontFamily("Arial"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal)
Dim typeface2 As New Typeface(New FontFamily("Arial"), FontStyles.Normal, FontWeights.UltraBold, FontStretches.Normal)

If FontWeight.Compare(typeface1.Weight, typeface2.Weight) < 0 Then
    ' Code execution follows this path because
    ' the FontWeight of typeface1 (Normal) is less than of typeface2 (UltraBold).
End If

Opmerkingen

Lichtere tekengewichten zijn kleiner dan zwaardere tekengewichten. Een lettertypegewicht 'Licht' of 'Normaal' is bijvoorbeeld kleiner dan een 'UltraBold'-tekengewicht.

Van toepassing op