FontWeight.Compare(FontWeight, FontWeight) メソッド

定義

FontWeight の 2 つのインスタンスを比較します。

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

パラメーター

left
FontWeight

比較する最初の FontWeight オブジェクト。

right
FontWeight

比較する 2 番目の FontWeight オブジェクトです。

戻り値

Int32

Int32 の 2 つのインスタンス間の関係を示す FontWeight 値。 戻り値が 0 未満の場合、leftright 未満です。 この値が 0 の場合は、2 つのオペランドが等しいことを示します。 この値が 0 よりも大きい場合は、leftright よりも大きいことを示します。

次のコード例では、メソッドを Compare 使用して 2 つの FontWeight オブジェクトを評価します。

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

注釈

フォントの太さが太い方が、フォントの太さよりも小さくなります。 たとえば、"Light" または "Normal" のフォントの太さは、"UltraBold" フォントの太さよりも小さくなります。

適用対象