FigureUnitType 枚举

定义

描述与 FigureLength 的宽度或高度关联的单位类型。Describes the unit type associated with the width or height of a FigureLength.

public enum class FigureUnitType
public enum FigureUnitType
type FigureUnitType = 
Public Enum FigureUnitType
继承
FigureUnitType

字段

Auto 0

未指定 FigureLength 时的默认值,该值将为不带约束计算的 Figure 的宽度或高度创建一个值。Default value when the FigureLength is not specified which creates a value for the width or height of the Figure that is calculated without constraints. 注意:FigureUnitType 设置为 Auto 时,FigureLengthValue 属性设置为 1Note: When FigureUnitType is set to Auto, the Value property of FigureLength is set to 1.

Column 2

Figure 的宽度或高度的值表示为 Figure 所在列的宽度的几分之几(包括大于 1 的分数)。The value of the width or height of the Figure is expressed as a fraction (including fractions greater then 1) of the width of the column the Figure is in.

Content 3

Figure 的宽度或高度的值表示为 Figure 内容宽度的几分之几(包括大于 1 的分数)。The value of the width or height of the Figure is expressed as a fraction (including fractions greater then 1) of the content width of the Figure. 注意:注意:FigureUnitType 设置为 Content 时,FigureLengthValue 属性必须设置为介于 01 之间的值。Note: Note: When FigureUnitType is set to Content, the Value property of FigureLength must be set to a value between 0 and 1.

Page 4

Figure 的宽度或高度的值表示为 Figure 所在页面宽度的几分之几(包括大于 1 的分数)。The value of the width or height of the Figure is expressed as a fraction (including fractions greater then 1) of the page width of that the Figure is in. 注意:注意:FigureUnitType 设置为 Page 时,FigureLengthValue 属性必须设置为介于 01 之间的值。Note: Note: When FigureUnitType is set to Page, the Value property of FigureLength must be set to a value between 0 and 1.

Pixel 1

Figure 的宽度或高度的值用像素表示(每英寸 96 像素)。The value of the width or height of the Figure is expressed in pixels (96 pixels-per-inch).

示例

在下面的示例中, 当用户单击Figure时, 的将Width Figure减少。In the following example, when the user clicks on the Figure, the Width of the Figure decreases. 下面是示例的 XAML。Below is the XAML for the sample.

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="SDKSample.FigureLengthExample" >

  <FlowDocumentReader>
    <FlowDocument >
      <Paragraph>
        Raw text inside the paragraph
        <Figure Name="myFigure" Width="300">
          <Paragraph FontStyle="Italic" MouseDown="OnMouseDownDecreaseWidth" >
            Text inside of paragraph that is inside Figure...
          </Paragraph>
        </Figure>
      </Paragraph>
    </FlowDocument>
  </FlowDocumentReader>



</Page>

下面是用于减少Width的代码, 该Figure代码使用像素来指定单位类型。Below is the code used to decrease the Width of the Figure using the Pixel to specify the unit type.

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace SDKSample
{
    public partial class FigureLengthExample : Page
    {

        void OnMouseDownDecreaseWidth(object sender, MouseButtonEventArgs args)
        {
            FigureLength myFigureLength = myFigure.Width;
            double widthValue = myFigureLength.Value;
            if (widthValue > 0)
            {
                myFigure.Width = new FigureLength((widthValue - 10), FigureUnitType.Pixel);
            }
        }
    }
}

适用于