FontWeight.Compare(FontWeight, FontWeight) Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Vergleicht zwei Instanzen von 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
Parameter
- left
- FontWeight
Das erste FontWeight zu vergleichende Objekt.
- right
- FontWeight
Das zweite FontWeight zu vergleichende Objekt.
Gibt zurück
Ein Int32 Wert, der die Beziehung zwischen den beiden Instanzen von FontWeight. Wenn der Rückgabewert kleiner als 0 ist, left ist er kleiner als right. Wenn dieser Wert null ist, gibt er an, dass beide Operanden gleich sind. Wenn der Wert größer als 0 ist, gibt er an, dass left größer als rightist.
Beispiele
Im folgenden Codebeispiel wird die Compare Methode verwendet, um zwei FontWeight Objekte auszuwerten.
// 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
Hinweise
Hellere Schriftbreiten sind kleiner als schwerere Schriftbreiten. Beispielsweise ist die Schriftbreite "Light" oder "Normal" kleiner als die Schriftbreite "UltraBold".