Control.FontSize Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau mengatur ukuran font.
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; }
[<System.ComponentModel.Bindable(true)>]
[<System.ComponentModel.TypeConverter(typeof(System.Windows.FontSizeConverter))>]
[<System.Windows.Localizability(System.Windows.LocalizationCategory.None)>]
member this.FontSize : double with get, set
Public Property FontSize As Double
Nilai Properti
Ukuran teks di Control. Defaultnya adalah MessageFontSize. Ukuran font harus berupa angka positif.
- Atribut
Contoh
Contoh berikut menunjukkan cara mengatur properti ukuran font kontrol.
<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
Keterangan
Properti ini hanya memengaruhi kontrol yang templatnya menggunakan FontSize properti sebagai parameter. Pada kontrol lain, properti ini tidak berdampak.
Informasi Properti Dependensi
| Item | Nilai |
|---|---|
| Bidang pengidentifikasi | FontSizeProperty |
Properti metadata diatur ke true |
AffectsMeasure, , AffectsRenderInherits |
Penggunaan Atribut XAML
<object FontSize="double"/>
- or -
<object FontSize ="qualifiedDouble"/>
Nilai XAML
DoubleDouble
Representasi string dari Double nilai. Ini ditafsirkan sebagai pengukuran unit independen perangkat (1/96 inci). String tidak perlu secara eksplisit menyertakan titik desimal. Misalnya, nilai 1 dapat diterima.
Batasan rentang yang sama Double yang disebutkan di bagian Nilai Properti berlaku di sini.
qualifiedDouble Nilai ganda seperti yang dijelaskan sebelumnya yang diikuti oleh salah satu string deklarasi unit ini: px, , in, cmpt.
px (default) adalah unit independen perangkat (1/96 inci per unit)
in adalah inci; 1in==96px
cm adalah sentimeter; 1cm==(96/2,54) px
pt adalah poin; 1pt==(96/72) px
Catatan Dalam banyak kasus, ganda dapat diatur ke "Otomatis", tetapi Control.FontSize tidak dirender jika diatur ke "Otomatis".