FigureLength Costruttori

Definizione

Inizializza una nuova istanza di FigureLength.

Overload

Nome Descrizione
FigureLength(Double)

Inizializza una nuova istanza della FigureLength classe con il numero specificato di pixel di lunghezza.

FigureLength(Double, FigureUnitType)

Inizializza una nuova istanza della FigureLength classe con l'oggetto e ValuespecificatoFigureUnitType.

FigureLength(Double)

Inizializza una nuova istanza della FigureLength classe con il numero specificato di pixel di lunghezza.

public:
 FigureLength(double pixels);
public FigureLength(double pixels);
new System.Windows.FigureLength : double -> System.Windows.FigureLength
Public Sub New (pixels As Double)

Parametri

pixels
Double

Numero di pixel indipendenti dal dispositivo (96 pixel per pollice) che costituiscono la lunghezza.

Esempio

Nell'esempio seguente, quando l'utente fa clic su Figure, l'oggetto Width dell'oggetto Figure diminuisce. Di seguito è riportato il codice XAML per l'esempio.

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

Di seguito è riportato il codice usato per ridurre l'oggetto WidthFiguredi .

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

Si applica a

FigureLength(Double, FigureUnitType)

Inizializza una nuova istanza della FigureLength classe con l'oggetto e ValuespecificatoFigureUnitType.

public:
 FigureLength(double value, System::Windows::FigureUnitType type);
public FigureLength(double value, System.Windows.FigureUnitType type);
new System.Windows.FigureLength : double * System.Windows.FigureUnitType -> System.Windows.FigureLength
Public Sub New (value As Double, type As FigureUnitType)

Parametri

value
Double

Classe Value della FigureLength classe .

type
FigureUnitType

Classe Value della FigureUnitType classe .

Esempio

Nell'esempio seguente, quando l'utente fa clic su Figure, l'oggetto Width dell'oggetto Figure diminuisce. Di seguito è riportato il codice XAML per l'esempio.

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

Di seguito è riportato il codice usato per ridurre l'oggetto WidthFiguredi .

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

Si applica a