语言

FigureLength 结构

定义

描述 a Figure. 的高度或宽度。

public value class FigureLength : IEquatable<System::Windows::FigureLength>
[System.ComponentModel.TypeConverter(typeof(System.Windows.FigureLengthConverter))]
public struct FigureLength : IEquatable<System.Windows.FigureLength>
[<System.ComponentModel.TypeConverter(typeof(System.Windows.FigureLengthConverter))>]
type FigureLength = struct
Public Structure FigureLength
Implements IEquatable(Of FigureLength)
继承
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>

下面是用于减少 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);
            }
        }
    }
}

注解

XAML 属性用法

<object property="length"/>

-或-

<object property="qualifiedDouble"/>

XAML 值

长度 以像素为单位的 Figure 宽度或高度,描述为值 Double 。 或者,此值可以使用单元声明字符串(px、、in、cmpt)进行限定,请参阅下面的 qualifiedDouble。

qualifiedDouble如上所述的双精度值,后跟以下单位声明字符串之一:px、、incmpt、 。

px (默认值) 是独立于设备的单位(每单位 1/96 英寸)

in 为英寸;1in==96px

cm 为厘米;1cm==(96/2.54) px

pt is points;1pt==(96/72) px

构造函数

名称 说明
FigureLength(Double, FigureUnitType)

使用指定的FigureLength和 Value. 初始化类的新实例FigureUnitType。

FigureLength(Double)

用指定的像素数初始化类的新实例 FigureLength (长度)。

属性

名称 说明
FigureUnitType

获取 . 的 Value单位类型。

IsAbsolute

获取一个值,该值确定是否 FigureLength 保存绝对值(以像素为单位)。

IsAuto

获取一个值,该值确定是否 FigureLength 是自动的(未指定)。

IsColumn

获取一个值,该值确定是否FigureLength具有FigureUnitType属性值 。Column

IsContent

获取一个值,该值确定是否FigureLength具有FigureUnitType属性值 。Content

IsPage

获取一个值,该值确定是否FigureLength具有FigureUnitType属性值 。Page

Value

获取此值 FigureLength。

方法

名称 说明
Equals(FigureLength)

比较两 FigureLength 个结构是否相等。

Equals(Object)

确定指定 Object 是否为一个 FigureLength ,以及它是否与此 FigureLength相同。

GetHashCode()

返回此 FigureLength代码的哈希代码。

ToString()

String创建此FigureLength表示形式。

运算符

名称 说明
Equality(FigureLength, FigureLength)

比较两 FigureLength 个结构是否相等。

Inequality(FigureLength, FigureLength)

比较两 FigureLength 个不相等结构。

适用于