FigureLength 結構

定義

描述 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 時, WidthFigure 會減少。 以下是範例的 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 的程式碼。

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

<object property="length"/>  

-或-

<object property="qualifiedDouble"/>  

XAML 值

length (長度)
以圖元為單位的 Figure 寬度或高度,以 Double 值描述。 或者,這個值可以使用單位宣告字串限定, (pxin 、、、 cm) pt 請參閱下方 的 qualifiedDouble

qualifiedDouble
上述的 雙精度 浮點數,後面接著下列其中一個單位宣告字串: px 、、 incmpt

px (預設) 是裝置獨立單位 (每單位 1/96 英吋)

in 為英吋;1in==96px

cm 為公分;1cm== (96/2.54) px

pt 為點;1pt== (96/72) px

建構函式

FigureLength(Double)

使用指定像素的長度,初始化 FigureLength 類別的新執行個體。

FigureLength(Double, FigureUnitType)

使用指定的 FigureLengthValue,初始化 FigureUnitType 類別的新執行個體。

屬性

FigureUnitType

取得 Value 的單位類型。

IsAbsolute

取得值,這個值決定此 FigureLength 是否為絕對值 (以像素為單位)。

IsAuto

取得值,這個值決定此 FigureLength 是否為自動 (未指定)。

IsColumn

取得值,這個值決定此 FigureLength 是否擁有 FigureUnitTypeColumn 屬性值。

IsContent

取得值,這個值決定此 FigureLength 是否擁有 FigureUnitTypeContent 屬性值。

IsPage

取得值,這個值決定此 FigureLength 是否擁有 FigureUnitTypePage 屬性值。

Value

取得這個 FigureLength 的值。

方法

Equals(FigureLength)

比較兩個 FigureLength 結構是否相等。

Equals(Object)

判斷所指定 Object 是否為 FigureLength,且是否與這個 FigureLength 相同。

GetHashCode()

傳回這個 FigureLength 的雜湊程式碼。

ToString()

建立這個 StringFigureLength 表示。

運算子

Equality(FigureLength, FigureLength)

比較兩個 FigureLength 結構是否相等。

Inequality(FigureLength, FigureLength)

比較兩個 FigureLength 結構是否相等。

適用於