Figure.VerticalAnchor 属性

定义

获取或设置一个值,该值指示内容沿垂直方向锚定到的位置。

public:
 property System::Windows::FigureVerticalAnchor VerticalAnchor { System::Windows::FigureVerticalAnchor get(); void set(System::Windows::FigureVerticalAnchor value); };
public System.Windows.FigureVerticalAnchor VerticalAnchor { get; set; }
member this.VerticalAnchor : System.Windows.FigureVerticalAnchor with get, set
Public Property VerticalAnchor As FigureVerticalAnchor

属性值

FigureVerticalAnchor

FigureVerticalAnchor 枚举的一个成员,它指定 Figure 的垂直锚定位置。

默认值是 ParagraphTop

示例

以下示例演示如何设置 VerticalAnchor 元素的属性 Figure

<FlowDocument>
  <Paragraph>
    <Figure
      Name="myFigure"              
      Width="140" Height="50" 
      HorizontalAnchor="PageCenter"
      VerticalAnchor="PageCenter"
      HorizontalOffset="100" 
      VerticalOffset="20" 
      WrapDirection="Both"
      />
  </Paragraph>
</FlowDocument>

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

Figure figx = new Figure();
figx.Name = "myFigure";
figx.Width = new FigureLength(140);
figx.Height = new FigureLength(50);
figx.HorizontalAnchor = FigureHorizontalAnchor.PageCenter;
figx.VerticalAnchor = FigureVerticalAnchor.PageCenter;
figx.HorizontalOffset = 100;
figx.VerticalOffset = 20;
figx.WrapDirection = WrapDirection.Both;

Paragraph parx = new Paragraph(figx);
FlowDocument flowDoc = new FlowDocument(parx);
Dim figx As New Figure()
With figx
    .Name = "myFigure"
    .Width = New FigureLength(140)
    .Height = New FigureLength(50)
    .HorizontalAnchor = FigureHorizontalAnchor.PageCenter
    .VerticalAnchor = FigureVerticalAnchor.PageCenter
    .HorizontalOffset = 100
    .VerticalOffset = 20
    .WrapDirection = WrapDirection.Both
End With

Dim parx As New Paragraph(figx)
Dim flowDoc As New FlowDocument(parx)

注解

依赖项属性信息

标识符字段 VerticalAnchorProperty
元数据属性设置为 true AffectsParentMeasure

适用于