FigureLength 结构

定义

描述 Figure 的高度或宽度。Describes the height or width of a Figure.

public value class FigureLength : IEquatable<System::Windows::FigureLength>
[System.ComponentModel.TypeConverter(typeof(System.Windows.FigureLengthConverter))]
public struct FigureLength : IEquatable<System.Windows.FigureLength>
type FigureLength = struct
Public Structure FigureLength
Implements IEquatable(Of FigureLength)
继承
FigureLength
属性
实现

示例

在下面的示例中,当用户单击 Figure时,FigureWidth 会降低。In the following example, when the user clicks on the Figure, the Width of the Figure decreases. 下面是示例的 XAML。Below is the XAML for the sample.

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

下面是用于减少 FigureWidth 的代码。Below is the code used to decrease the Width of the 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 属性用法XAML Attribute Usage

<object property="length"/>  

- 或 --or-

<object property="qualifiedDouble"/>  

XAML 值XAML Values

lengthlength
Figure 的宽度或高度(以像素为单位),描述为 Double 值。The width or height of the Figure in pixels, described as a Double value. 或者,可以使用单元声明字符串(pxincm``pt)来限定此值,请参阅下面的qualifiedDoubleAlternatively, this value can be qualified with a unit declaration string (px, in, cm, pt) see qualifiedDouble below.

qualifiedDoublequalifiedDouble
前面所述的双精度值,后面跟以下单元声明字符串之一: pxincm``ptA double value as described above followed by one of the following unit declaration strings: px, in, cm, pt.

px (默认值)为 与设备无关的单位(每个单位 1/96 英寸)device-independent units (1/96th inch per unit)px (default) is 与设备无关的单位(每个单位 1/96 英寸)device-independent units (1/96th inch per unit)

in 为英寸;1in = = 96pxin is inches; 1in==96px

cm 是厘米;1cm = = (96/2.54) pxcm is centimeters; 1cm==(96/2.54) px

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

构造函数

FigureLength(Double)

用指定的长度像素数初始化 FigureLength 类的一个新实例。Initializes a new instance of the FigureLength class with the specified number of pixels in length.

FigureLength(Double, FigureUnitType)

使用指定的 FigureLengthValue 初始化 FigureUnitType 类的新实例。Initializes a new instance of the FigureLength class with the specified Value and FigureUnitType.

属性

FigureUnitType

获取 Value 的单位类型。Gets the unit type of the Value.

IsAbsolute

获取一个值,该值确定此 FigureLength 是否包含绝对值(以像素为单位)。Gets a value that determines whether this FigureLength holds an absolute value (in pixels).

IsAuto

获取一个值,该值确定此 FigureLength 是否为自动(未指定)。Gets a value that determines whether this FigureLength is automatic (not specified).

IsColumn

获取一个值,该值确定此 FigureLength 是否具有 FigureUnitType 属性值 ColumnGets a value that determines whether this FigureLength has a FigureUnitType property value of Column.

IsContent

获取一个值,该值确定此 FigureLength 是否具有 FigureUnitType 属性值 ContentGets a value that determines whether this FigureLength has a FigureUnitType property value of Content.

IsPage

获取一个值,该值确定此 FigureLength 是否具有 FigureUnitType 属性值 PageGets a value that determines whether this FigureLength has a FigureUnitType property value of Page.

Value

获取此 FigureLength 的值。Gets the value of this FigureLength.

方法

Equals(FigureLength)

比较两个 FigureLength 结构是否相等。Compares two FigureLength structures for equality.

Equals(Object)

确定指定的 Object 是否为 FigureLength,以及它是否与此 FigureLength 相同。Determines whether the specified Object is a FigureLength and whether it is identical to this FigureLength.

GetHashCode()

返回此 FigureLength 的哈希代码。Returns the hash code for this FigureLength.

ToString()

创建此 StringFigureLength 表示形式。Creates a String representation of this FigureLength.

运算符

Equality(FigureLength, FigureLength)

比较两个 FigureLength 结构是否相等。Compares two FigureLength structures for equality.

Inequality(FigureLength, FigureLength)

比较两个 FigureLength 结构是否不相等。Compares two FigureLength structures for inequality.

适用于