FigureLength FigureLength FigureLength FigureLength Struct

定義

描述 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)
繼承
FigureLengthFigureLengthFigureLengthFigureLength
屬性
實作

範例

在下列範例中, 當使用者按一下上的FigureWidth , Figure的會減少。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>

以下是用來減少Width Figure之的程式碼。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 Attribute UsageXAML 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. 或者, 您可以使用單位px宣告字串 (、 incmpt) 來限定此值, 請參閱下面的qualifiedDoubleAlternatively, this value can be qualified with a unit declaration string (px, in, cm, pt) see qualifiedDouble below.

qualifiedDoublequalifiedDouble
如上面所述的double值, 後面接著下列其中一個單元宣告字串px: incmpt、。A 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(Double) FigureLength(Double) FigureLength(Double)

使用指定像素的長度,初始化 FigureLength 類別的新執行個體。Initializes a new instance of the FigureLength class with the specified number of pixels in length.

FigureLength(Double, FigureUnitType) FigureLength(Double, FigureUnitType) FigureLength(Double, FigureUnitType) FigureLength(Double, FigureUnitType)

使用指定的 FigureLengthValue,初始化 FigureUnitType 類別的新執行個體。Initializes a new instance of the FigureLength class with the specified Value and FigureUnitType.

屬性

FigureUnitType FigureUnitType FigureUnitType FigureUnitType

取得 Value 的單位類型。Gets the unit type of the Value.

IsAbsolute IsAbsolute IsAbsolute IsAbsolute

取得值,這個值決定此 FigureLength 是否為絕對值 (以像素為單位)。Gets a value that determines whether this FigureLength holds an absolute value (in pixels).

IsAuto IsAuto IsAuto IsAuto

取得值,這個值決定此 FigureLength 是否為自動 (未指定)。Gets a value that determines whether this FigureLength is automatic (not specified).

IsColumn IsColumn IsColumn IsColumn

取得值,這個值決定此 FigureLength 是否擁有 FigureUnitTypeColumn 屬性值。Gets a value that determines whether this FigureLength has a FigureUnitType property value of Column.

IsContent IsContent IsContent IsContent

取得值,這個值決定此 FigureLength 是否擁有 FigureUnitTypeContent 屬性值。Gets a value that determines whether this FigureLength has a FigureUnitType property value of Content.

IsPage IsPage IsPage IsPage

取得值,這個值決定此 FigureLength 是否擁有 FigureUnitTypePage 屬性值。Gets a value that determines whether this FigureLength has a FigureUnitType property value of Page.

Value Value Value Value

取得這個 FigureLength 的值。Gets the value of this FigureLength.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷所指定 Object 是否為 FigureLength,且是否與這個 FigureLength 相同。Determines whether the specified Object is a FigureLength and whether it is identical to this FigureLength.

Equals(FigureLength) Equals(FigureLength) Equals(FigureLength) Equals(FigureLength)

比較兩個 FigureLength 結構是否相等。Compares two FigureLength structures for equality.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

傳回這個 FigureLength 的雜湊程式碼。Returns the hash code for this FigureLength.

ToString() ToString() ToString() ToString()

建立這個 StringFigureLength 表示。Creates a String representation of this FigureLength.

運算子

Equality(FigureLength, FigureLength) Equality(FigureLength, FigureLength) Equality(FigureLength, FigureLength) Equality(FigureLength, FigureLength)

比較兩個 FigureLength 結構是否相等。Compares two FigureLength structures for equality.

Inequality(FigureLength, FigureLength) Inequality(FigureLength, FigureLength) Inequality(FigureLength, FigureLength) Inequality(FigureLength, FigureLength)

比較兩個 FigureLength 結構是否相等。Compares two FigureLength structures for inequality.

適用於