FontWeight.Compare(FontWeight, FontWeight) Metodo

Definizione

Confronta due istanze di 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

Parametri

left
FontWeight

Primo FontWeight oggetto da confrontare.

right
FontWeight

Secondo FontWeight oggetto da confrontare.

Valori restituiti

Valore Int32 che indica la relazione tra le due istanze di FontWeight. Quando il valore restituito è minore di zero, left è minore di right. Quando questo valore è zero, indica che entrambi gli operandi sono uguali. Quando il valore è maggiore di zero, indica che left è maggiore di right.

Esempio

Nell'esempio di codice seguente viene usato il Compare metodo per valutare due FontWeight oggetti.

// 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

Commenti

Gli spessori del carattere più leggeri sono inferiori a quelli più pesanti. Ad esempio, uno spessore del carattere "Light" o "Normal" è minore di uno spessore del carattere "UltraBold".

Si applica a