FigureLength 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化一個新的實例。FigureLength
多載
| 名稱 | Description |
|---|---|
| FigureLength(Double) |
初始化一個以指定像素數長度的新類別實例 FigureLength 。 |
| FigureLength(Double, FigureUnitType) |
初始化一個新的類別實例 FigureLength ,並指定為 ValueFigureUnitType和 。 |
FigureLength(Double)
初始化一個以指定像素數長度的新類別實例 FigureLength 。
public:
FigureLength(double pixels);
public FigureLength(double pixels);
new System.Windows.FigureLength : double -> System.Windows.FigureLength
Public Sub New (pixels As Double)
參數
- pixels
- Double
構成長度的裝置無關像素數(每英吋 96 像素)。
範例
以下範例中,當使用者點擊 Figure時,的 Width 會Figure減少。 以下是該範例的 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>
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);
}
}
}
}
適用於
FigureLength(Double, FigureUnitType)
初始化一個新的類別實例 FigureLength ,並指定為 ValueFigureUnitType和 。
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)
參數
- value
- Double
班 Value 上最棒 FigureLength 的。
- type
- FigureUnitType
班 Value 上最棒 FigureUnitType 的。
範例
以下範例中,當使用者點擊 Figure時,的 Width 會Figure減少。 以下是該範例的 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>
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);
}
}
}
}