FontWeight.Compare(FontWeight, FontWeight) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
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 comparar.
- right
- FontWeight
O segundo FontWeight objeto para comparar.
Devoluções
Um Int32 valor que indica a relação entre as duas instâncias de FontWeight. Quando o valor de retorno é menor que zero, left é menor que right. Quando este valor é zero, indica que ambos os operandos são iguais. Quando o valor é maior que zero, indica que left é maior que right.
Exemplos
No exemplo de código seguinte, 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
Observações
Pesos de fonte mais leves são menores do que pesos de fonte mais grossos. Por exemplo, um peso de fonte "Light" ou "Normal" é menor do que um peso de fonte "UltraBold".