Control.FontWeight 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 berat atau ketebalan font yang ditentukan.
public:
property System::Windows::FontWeight FontWeight { System::Windows::FontWeight get(); void set(System::Windows::FontWeight value); };
[System.ComponentModel.Bindable(true)]
public System.Windows.FontWeight FontWeight { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.FontWeight : System.Windows.FontWeight with get, set
Public Property FontWeight As FontWeight
Nilai Properti
Nilai FontWeight. Defaultnya adalah Normal.
- Atribut
Contoh
Contoh berikut menunjukkan cara mengatur FontWeight properti kontrol.
<Button Name="btn5" FontWeight="Normal"
Click="ChangeFontWeight">
FontWeight
</Button>
void ChangeFontWeight(object sender, RoutedEventArgs e)
{
if (btn5.FontWeight == FontWeights.Bold)
{
btn5.FontWeight = FontWeights.Normal;
btn5.Content = "FontWeight";
}
else
{
btn5.FontWeight = FontWeights.Bold;
btn5.Content = "Control font weight changes from Normal to Bold.";
}
}
Private Sub ChangeFontWeight(ByVal Sender As Object, ByVal e As RoutedEventArgs)
If (btn5.FontWeight = FontWeights.Bold) Then
btn5.FontWeight = FontWeights.Normal
btn5.Content = "FontWeight"
Else
btn5.FontWeight = FontWeights.Bold
btn5.Content = "Control font weight changes from Normal to Bold."
End If
End Sub
Keterangan
Properti ini hanya memengaruhi kontrol yang templatnya menggunakan FontWeight properti sebagai parameter. Pada kontrol lain, properti ini tidak berdampak. Untuk daftar nilai yang telah FontWeight ditentukan sebelumnya, lihat FontWeights kelas .
Informasi Properti Dependensi
| Item | Nilai |
|---|---|
| Bidang pengidentifikasi | FontWeightProperty |
Properti metadata diatur ke true |
AffectsMeasure, , AffectsRenderInherits |