資訊
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Control.FontWeight 屬性

取得或設定指定之字型的粗細。

命名空間:  System.Windows.Controls
組件:  PresentationFramework (在 PresentationFramework.dll 中)
針對 XAML 的 XMLNS: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

[BindableAttribute(true)]
public FontWeight FontWeight { get; set; }
<object FontWeight="FontWeight" .../>

屬性值

類型:System.Windows.FontWeight
A FontWeight value. 預設值是FontWeights.Normal

識別項欄位

FontWeightProperty

若要設定的中繼資料屬性true

AffectsMeasure , AffectsRender, Inherits

這個屬性只會影響其樣板使用的控制項FontWeight做為參數的屬性。 在 [其他控制項中,這個屬性會造成任何影響。 為一系列預先定義FontWeight的值,請參閱FontWeights類別。

下列範例會示範如何設定FontWeight控制項的屬性。


<Button Name="btn5" FontWeight="Normal" 
        Click="ChangeFontWeight">
  FontWeight
</Button>



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



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.";
    }
}


.NET Framework

支援版本:4.5、4、3.5、3.0

.NET Framework Client Profile

支援版本:4、3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (不支援伺服器核心角色), Windows Server 2008 R2 (SP1 (含) 以後版本支援伺服器核心角色,不支援 Itanium)

此.NET Framework 並不支援各種平台的所有版本。如需支援版本的清單,請參閱.NET Framework 系統需求.

社群新增項目

顯示:
© 2014 Microsoft