FigureLength Konstruktorer
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Initierar en ny instans av FigureLength.
Överlagringar
| Name | Description |
|---|---|
| FigureLength(Double) |
Initierar en ny instans av FigureLength klassen med det angivna antalet bildpunkter i längd. |
| FigureLength(Double, FigureUnitType) |
Initierar en ny instans av FigureLength klassen med angivet Value och FigureUnitType. |
FigureLength(Double)
Initierar en ny instans av FigureLength klassen med det angivna antalet bildpunkter i längd.
public:
FigureLength(double pixels);
public FigureLength(double pixels);
new System.Windows.FigureLength : double -> System.Windows.FigureLength
Public Sub New (pixels As Double)
Parametrar
- pixels
- Double
Antalet enhetsoberoende pixlar (96 bildpunkter per tum) som utgör längden.
Exempel
När användaren klickar på FigureWidthFigure minskar i följande exempel. Nedan visas XAML för exemplet.
<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>
Nedan visas den kod som används för att minska Width .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);
}
}
}
}
Gäller för
FigureLength(Double, FigureUnitType)
Initierar en ny instans av FigureLength klassen med angivet Value och FigureUnitType.
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)
Parametrar
- value
- Double
Klassens ValueFigureLength .
- type
- FigureUnitType
Klassens ValueFigureUnitType .
Exempel
När användaren klickar på FigureWidthFigure minskar i följande exempel. Nedan visas XAML för exemplet.
<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>
Nedan visas den kod som används för att minska Width .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);
}
}
}
}