Läs på engelska Redigera

Dela via


FigureUnitType Enum

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Describes the unit type associated with the width or height of a FigureLength.

C#
public enum FigureUnitType
Inheritance
FigureUnitType

Fields

Name Value Description
Auto 0

Default value when the FigureLength is not specified which creates a value for the width or height of the Figure that is calculated without constraints. Note: When FigureUnitType is set to Auto, the Value property of FigureLength is set to 1.

Pixel 1

The value of the width or height of the Figure is expressed in pixels (96 pixels-per-inch).

Column 2

The value of the width or height of the Figure is expressed as a fraction (including fractions greater then 1) of the width of the column the Figure is in.

Content 3

The value of the width or height of the Figure is expressed as a fraction (including fractions greater then 1) of the content width of the Figure. Note: Note: When FigureUnitType is set to Content, the Value property of FigureLength must be set to a value between 0 and 1.

Page 4

The value of the width or height of the Figure is expressed as a fraction (including fractions greater then 1) of the page width of that the Figure is in. Note: Note: When FigureUnitType is set to Page, the Value property of FigureLength must be set to a value between 0 and 1.

Examples

In the following example, when the user clicks on the Figure, the Width of the Figure decreases. Below is the XAML for the sample.

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>

Below is the code used to decrease the Width of the Figure using the Pixel to specify the unit type.

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);
            }
        }
    }
}

Applies to

Produkt Versioner
.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, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10