通过


FlowDocument.FontSize 属性

定义

获取或设置 .. 的 FlowDocument顶级字号。

public:
 property double FontSize { double get(); void set(double value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.FontSizeConverter))]
[System.Windows.Localizability(System.Windows.LocalizationCategory.None)]
public double FontSize { get; set; }
[<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

属性值

要使用的所需字号(以独立于设备的像素为单位)。 默认值由 MessageFontSize 值确定。

属性

示例

以下示例演示如何设置 FontSize 元素的属性 FlowDocument

<FlowDocumentReader>
  <FlowDocument
    FontFamily="Century Gothic"
    FontSize="12"
    FontStretch="UltraExpanded"
    FontStyle="Italic"
    FontWeight="UltraBold"
  >
    <Paragraph>
      Any font settings on this paragraph would override the font settings
      for the FlowDocument.
    </Paragraph>
  </FlowDocument>
</FlowDocumentReader>

以下示例演示如何以编程方式设置 FontSize 属性。

FlowDocument flowDoc = new FlowDocument(new Paragraph(new Run("A bit of text content...")));
// Set the desired column gap to 10 device independend pixels.
flowDoc.FontFamily = new FontFamily("Century Gothic");
flowDoc.FontSize = 12.0;
flowDoc.FontStretch = FontStretches.UltraExpanded;
flowDoc.FontStyle = FontStyles.Italic;
flowDoc.FontWeight = FontWeights.UltraBold;
Dim flowDoc As New FlowDocument(New Paragraph(New Run("A bit of text content...")))
' Set the desired column gap to 10 device independend pixels.
flowDoc.FontFamily = New FontFamily("Century Gothic")
flowDoc.FontSize = 12.0
flowDoc.FontStretch = FontStretches.UltraExpanded
flowDoc.FontStyle = FontStyles.Italic
flowDoc.FontWeight = FontWeights.UltraBold

注解

子元素上的任何 FontSize 设置都覆盖此顶级设置。

XAML 属性用法

<object FontSize="double"/>
- or -
<object FontSize="qualifiedDouble"/>

XAML 值

Double

值的字符串表示形式 Double 等于或大于 0.0,但小于 Double.PositiveInfinity。 不限定的值以与设备无关的像素进行度量。 字符串不需要显式包含小数点。

qualifiedDouble如上所述的双精度值,后跟以下单位说明符之一:px、、incmpt

px (默认值) 是独立于设备的单位(每单位 1/96 英寸)

in 为英寸;1in==96px

cm 为厘米;1cm==(96/2.54) px

pt is points;1pt==(96/72) px

Dependency 属性信息

物品 价值
标识符字段 FontSizeProperty
元数据属性设置为 true AffectsMeasureAffectsRenderInherits

适用于