FontWeight.Compare(FontWeight, FontWeight) Método

Definição

Compara duas instâncias de 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

Parâmetros

left
FontWeight

O primeiro FontWeight objeto a ser comparado.

right
FontWeight

O segundo FontWeight objeto a ser comparado.

Retornos

Um Int32 valor que indica a relação entre as duas instâncias de FontWeight. Quando o valor retornado é menor que zero, left é menor que right. Quando esse valor é zero, indica que ambos os operandos são iguais. Quando o valor é maior que zero, ele indica que é maior que leftright.

Exemplos

No exemplo de código a seguir, o Compare método é usado para avaliar dois FontWeight objetos.

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

Comentários

Os pesos de fonte mais leves são menores do que os pesos de fonte mais pesados. Por exemplo, um peso de fonte "Claro" ou "Normal" é menor que um peso de fonte "UltraBold".

Aplica-se a