Control.FontSize プロパティ
定義
フォント サイズを取得または設定します。Gets or sets the font size.
public:
property double FontSize { double get(); void set(double value); };
[System.ComponentModel.Bindable(true)]
[System.ComponentModel.TypeConverter(typeof(System.Windows.FontSizeConverter))]
[System.Windows.Localizability(System.Windows.LocalizationCategory.None)]
public double FontSize { get; set; }
member this.FontSize : double with get, set
Public Property FontSize As Double
プロパティ値
Control 内のテキストのサイズ。The size of the text in the Control. 既定値は、MessageFontSize です。The default is MessageFontSize. フォント サイズは、正の数であることが必要です。The font size must be a positive number.
- 属性
例
次の例は、コントロールのフォントサイズプロパティを設定する方法を示しています。The following example shows how to set the font size property of a control.
<Button Name="btn3" FontSize="10.0"
Click="ChangeFontSize">
FontSize
</Button>
void ChangeFontSize(object sender, RoutedEventArgs e)
{
fsize = btn3.FontSize;
if (fsize == 16.0)
{
btn3.FontSize = 10.0;
btn3.Content = "FontSize";
}
else
{
btn3.FontSize = 16.0;
btn3.Content = "Control font size changes from 10 to 16.";
}
}
Private Sub ChangeFontSize(ByVal Sender As Object, ByVal e As RoutedEventArgs)
fsize = btn3.FontSize
If (fsize = 16.0) Then
btn3.FontSize = 10.0
btn3.Content = "FontSize"
Else
btn3.FontSize = 16.0
btn3.Content = "Control font size changes from 10 to 16."
End If
End Sub
注釈
このプロパティは、テンプレートがFontSizeプロパティをパラメーターとして使用するコントロールにのみ影響します。This property only affects a control whose template uses the FontSize property as a parameter. その他のコントロールでは、このプロパティは影響を与えません。On other controls, this property has no impact.
依存プロパティ情報Dependency Property Information
識別子フィールドIdentifier field | FontSizeProperty |
メタデータプロパティがに設定されるtrue Metadata properties set to true |
AffectsMeasure、AffectsRender、InheritsAffectsMeasure, AffectsRender, Inherits |
XAML 属性の使用方法XAML Attribute Usage
<object FontSize="double"/>
- or -
<object FontSize ="qualifiedDouble"/>
XAML 値XAML Values
doubledouble
Double
Double値の文字列形式。A string representation of a Double value. これは、 デバイスに依存しない単位 (1/96 インチ)device-independent unit (1/96th inch)測定値として解釈されます。This is interpreted as a デバイスに依存しない単位 (1/96 インチ)device-independent unit (1/96th inch) measurement. 文字列には、小数点を明示的に含める必要があります。Strings need not explicitly include decimal points. たとえば、の1
値は許容されます。For example, a value of 1
is acceptable.
ここでDoubleは、「プロパティ値」セクションで説明したのと同じ範囲制限を適用します。The same Double range restrictions that are mentioned in the Property Value section apply here.
qualifiedDoublequalifiedDouble
前に説明したdouble値の後にpx
、 in
cm
、、、 pt
のいずれかの単位宣言文字列が続きます。A double value as previously described that is followed by one of these unit declaration strings: px
, in
, cm
, pt
.
px
(既定) はです。デバイスに依存しない単位 (1 単位は 1/96 インチ)device-independent units (1/96th inch per unit)px
(default) is デバイスに依存しない単位 (1 単位は 1/96 インチ)device-independent units (1/96th inch per unit)
in
はインチ。1in==96pxin
is inches; 1in==96px
cm
はセンチメートルです。1cm = = (96/2.54) pxcm
is centimeters; 1cm==(96/2.54) px
pt
はポイント。1pt==(96/72) pxpt
is points; 1pt==(96/72) px
メモ多くの場合、double は "auto" に設定されますがControl.FontSize 、"auto" に設定すると、はレンダリングされません。Note In many cases a double may be set to "Auto," but a Control.FontSize does not render if set to "Auto".