FigureUnitType 列舉
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
描述與 FigureLength寬度或高度相關聯的單位類型。
public enum class FigureUnitType
public enum FigureUnitType
type FigureUnitType =
Public Enum FigureUnitType
- 繼承
欄位
| 名稱 | 值 | Description |
|---|---|---|
| Auto | 0 | 預設值當未指定時 FigureLength ,會產生一個寬度或高度 Figure 的值,該值計算時沒有限制。
註: 當 FigureUnitType 設為 Auto時, Value 的 FigureLength 性質 設為 |
| Pixel | 1 | 寬 Figure 度或高度的值以像素數表示(每英吋96像素)。 |
| Column | 2 | |
| Content | 3 | 寬 Figure 度或高度的值以內容寬度 Figure的分數(包含大於1的分數)表示。 注意: 注意: 當 FigureUnitType 設定為 Content時, Value 的 FigureLength 性質必須設定為介於 |
| Page | 4 | 寬 Figure 度或高度的值以所屬頁面寬度 Figure 的分數(包含大於1的分數)表示。 注意: 注意: 當 FigureUnitType 設定為 Page時, Value 的 FigureLength 性質必須設定為介於 |
範例
以下範例中,當使用者點擊 Figure時,的 Width 會Figure減少。 以下是該範例的 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 來指定單位類型的程式碼WidthFigure。
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);
}
}
}
}