Leer en inglés

Compartir a través de


FigureLength Constructores

Definición

Inicializa una nueva instancia de FigureLength.

Sobrecargas

FigureLength(Double)

Inicializa una nueva instancia de la clase FigureLength con el número especificado de píxeles en longitud.

FigureLength(Double, FigureUnitType)

Inicializa una nueva instancia de la clase FigureLength con los parámetros Value y FigureUnitType especificados.

FigureLength(Double)

Inicializa una nueva instancia de la clase FigureLength con el número especificado de píxeles en longitud.

C#
public FigureLength (double pixels);

Parámetros

pixels
Double

Número de píxeles independientes del dispositivo (96 píxeles por pulgada) que constituyen la longitud.

Ejemplos

En el ejemplo siguiente, cuando el usuario hace clic en , Figureel Width de Figure disminuye. A continuación se muestra el código XAML del ejemplo.

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>

A continuación se muestra el código usado para reducir el WidthFigurede .

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

Se aplica a

.NET Framework 4.8.1 y otras versiones
Producto Versiones
.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

FigureLength(Double, FigureUnitType)

Inicializa una nueva instancia de la clase FigureLength con los parámetros Value y FigureUnitType especificados.

C#
public FigureLength (double value, System.Windows.FigureUnitType type);

Parámetros

value
Double

Value de la clase FigureLength.

type
FigureUnitType

Value de la clase FigureUnitType.

Ejemplos

En el ejemplo siguiente, cuando el usuario hace clic en , Figureel Width de Figure disminuye. A continuación se muestra el código XAML del ejemplo.

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>

A continuación se muestra el código usado para reducir el WidthFigurede .

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

Se aplica a

.NET Framework 4.8.1 y otras versiones
Producto Versiones
.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