Figure.HorizontalOffset 属性

定义

获取或设置一个值,该值表示 Figure 沿水平方向从其基线偏移的距离。

public:
 property double HorizontalOffset { double get(); void set(double value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))]
public double HorizontalOffset { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.LengthConverter))>]
member this.HorizontalOffset : double with get, set
Public Property HorizontalOffset As Double

属性值

Figure 沿水平方向从其基线偏移的距离(以与设备无关的像素为单位)。

默认值为 0.0

属性

示例

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

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

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

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)

注解

XAML 属性用法

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

XAML 值

double
Double

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

qualifiedDouble
如上所述的 双精度 值, () Auto 后跟以下单位说明符之一: pxincmpt

px (默认) 是与设备无关的单位, (单位) 1/96 英寸

in 为英寸;1in==96px

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

pt 是磅;1pt== (96/72) px

依赖项属性信息

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

适用于