FigureUnitType 列舉

定義

描述與 FigureLength 的寬度或高度相關聯的單位型別。

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

欄位

Auto 0

未指定 FigureLength 時的預設值,它所建立之 Figure 的寬度或高度值是在無任何條件約束 (Constraint) 的情況下計算的。 注意:FigureUnitType 設定為 Auto 時,FigureLengthValue 屬性會設定為 1

Column 2

Figure 的寬度或高度值以 Figure 所在欄之寬度的分數 (包括大於 1 的分數) 來表示。

Content 3

Figure 的寬度或高度值以 Figure 的內容寬度之分數 (包括大於 1 的分數) 來表示。 注意:FigureUnitType 設定為 Content 時,FigureLengthValue 屬性必須設定為介於 01 之間的值。

Page 4

Figure 的寬度或高度值以 Figure 所在頁面之寬度的分數 (包括大於 1 的分數) 來表示。 注意:FigureUnitType 設定為 Page 時,FigureLengthValue 屬性必須設定為介於 01 之間的值。

Pixel 1

Figure 的寬度或高度值以像素來表示 (每英吋 96 個像素)。

範例

在下列範例中,當使用者按一下 時 FigureWidthFigure 會減少。 以下是範例的 XAML。

<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>

以下是使用 Pixel 來指定單位類型的 ,用來減少 Width Figure 的程式碼。

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);
            }
        }
    }
}

適用於