Editar

Compartir vía


FigureUnitType Enum

Definition

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

public enum class FigureUnitType
public enum FigureUnitType
type FigureUnitType = 
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.

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

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