更新:2007 年 11 月
命名空间:
System.Windows.Controls 程序集:
PresentationFramework(在 PresentationFramework.dll 中)
用于 XAML 的 XMLNS:http://schemas.microsoft.com/winfx/xaml/presentation
<BindableAttribute(True)> _
<LocalizabilityAttribute(LocalizationCategory.None)> _
<TypeConverterAttribute(GetType(FontSizeConverter))> _
Public Property FontSize As Double
Dim instance As Control
Dim value As Double
value = instance.FontSize
instance.FontSize = value
[BindableAttribute(true)]
[LocalizabilityAttribute(LocalizationCategory.None)]
[TypeConverterAttribute(typeof(FontSizeConverter))]
public double FontSize { get; set; }
[BindableAttribute(true)]
[LocalizabilityAttribute(LocalizationCategory::None)]
[TypeConverterAttribute(typeof(FontSizeConverter))]
public:
property double FontSize {
double get ();
void set (double value);
}
/** @property */
/** @attribute BindableAttribute(true) */
/** @attribute LocalizabilityAttribute(LocalizationCategory.None) */
/** @attribute TypeConverterAttribute(FontSizeConverter) */
public double get_FontSize()
/** @property */
/** @attribute BindableAttribute(true) */
/** @attribute LocalizabilityAttribute(LocalizationCategory.None) */
/** @attribute TypeConverterAttribute(FontSizeConverter) */
public void set_FontSize(double value)
public function get FontSize () : double
public function set FontSize (value : double)
<object FontSize="double"/>
- or –
<object FontSize ="qualifiedDouble"/>
- double
Double
Double 值的字符串表示形式。它被解释为与设备无关的单位(1/96 英寸)度量值。字符串无需显式包含小数点。例如,值 1 是可接受的。
在“属性值”一节中提到的相同的 Double 范围限制在此处也适用。
- qualifiedDouble
如前所述的一个 double 值,后跟下列单位声明字符串之一:px、in、cm、pt。
px (默认值)表示与设备无关的单位(每个单位 1/96 英寸)
in 表示英寸;1in==96px
cm 表示厘米;1cm==(96/2.54) px
pt 表示磅;1pt==(96/72) px
注意:在很多情况下,double 可能会设置为“Auto”,但如果设置为“Auto”,Contr..::.FontSize 将不会呈现。
此属性仅影响其模板使用 FontSize 属性作为参数的控件。对于其他控件,此属性不会产生任何影响。
下面的示例演示如何设置控件的字号属性。
<Button Name="btn3" FontSize="10.0"
Click="ChangeFontSize">
FontSize
</Button>
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
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.";
}
}
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
.NET Framework
受以下版本支持:3.5、3.0
参考
其他资源