FigureUnitType 枚举
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
描述与 FigureLength 的宽度或高度关联的单位类型。
public enum class FigureUnitType
C#
public enum FigureUnitType
type FigureUnitType =
Public Enum FigureUnitType
- 继承
Auto | 0 | 未指定 FigureLength 时的默认值,该值将为不带约束计算的 Figure 的宽度或高度创建一个值。 注意: 当 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。
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>
下面是用于减少WidthFigure使用 Pixel 指定单位类型的代码。
C#
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 |