FontWeight.Compare(FontWeight, FontWeight) Método

Definición

Compara dos instancias 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

Primer objeto FontWeight que se va a comparar.

right
FontWeight

Segundo objeto FontWeight que se va a comparar.

Devoluciones

Int32

Valor de Int32 que indica la relación entre las dos instancias de FontWeight. Cuando el valor devuelto es menor que cero, left o menor que right. Cuando este valor es cero, indica que ambos operandos son iguales. Cuando el valor es mayor que cero, indica que left es mayor que right.

Ejemplos

En el ejemplo de código siguiente, el Compare método se usa para evaluar dos 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

Comentarios

Los pesos de fuente más ligeros son menores que los pesos de fuente más pesados. Por ejemplo, un peso de fuente "Light" o "Normal" es menor que un peso de fuente "UltraBold".

Se aplica a