FigureUnitType 列舉
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
描述與 FigureLength 的寬度或高度相關聯的單位型別。
public enum class FigureUnitType
public enum FigureUnitType
type FigureUnitType =
Public Enum FigureUnitType
- 繼承
Auto | 0 | 未指定 FigureLength 時的預設值,它所建立之 Figure 的寬度或高度值是在無任何條件約束 (Constraint) 的情況下計算的。 注意: 當 FigureUnitType 設定為 Auto 時,FigureLength 的 Value 屬性會設定為 |
Column | 2 | |
Content | 3 | Figure 的寬度或高度值以 Figure 的內容寬度之分數 (包括大於 1 的分數) 來表示。 注意: 當 FigureUnitType 設定為 Content 時,FigureLength 的 Value 屬性必須設定為介於 |
Page | 4 | Figure 的寬度或高度值以 Figure 所在頁面之寬度的分數 (包括大於 1 的分數) 來表示。 注意: 當 FigureUnitType 設定為 Page 時,FigureLength 的 Value 屬性必須設定為介於 |
Pixel | 1 | Figure 的寬度或高度值以像素來表示 (每英吋 96 個像素)。 |
在下列範例中,當使用者按一下 時 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 來指定單位類型的 ,用來減少 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);
}
}
}
}
產品 | 版本 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 |
Windows Desktop | 3.0, 3.1, 5, 6, 7 |