共用方式為


Strokes.ScaleToRectangle 方法

縮放 Strokes 集合,以符合指定的矩形 (英文) 結構。

命名空間:  Microsoft.Ink
組件:  Microsoft.Ink (在 Microsoft.Ink.dll 中)

語法

'宣告
Public Sub ScaleToRectangle ( _
    scaleRectangle As Rectangle _
)
'用途
Dim instance As Strokes
Dim scaleRectangle As Rectangle

instance.ScaleToRectangle(scaleRectangle)
public void ScaleToRectangle(
    Rectangle scaleRectangle
)
public:
void ScaleToRectangle(
    Rectangle scaleRectangle
)
public void ScaleToRectangle(
    Rectangle scaleRectangle
)
public function ScaleToRectangle(
    scaleRectangle : Rectangle
)

參數

備註

Strokes 集合會縮放並轉譯,以便讓 Stroke 集合的週框方塊符合矩形。

範例

在這個範例中,會縮放 InkOverlay 物件的 Strokes 集合,以配合原始週框方塊的左半部。首先會藉由使用 BoundingBoxMode 列舉型別的 CurveFit 值呼叫 GetBoundingBox 方法判斷週框方塊的界限,以取得 Strokes 集合的週框。接著會建立只有原始寬度一半的新矩形,並將它傳遞至 ScaleToRectangle 方法。

' Access to the Strokes property returns a copy of the Strokes object.
' This copy must be implicitly (via using statement) or explicitly
' disposed of in order to avoid a memory leak.
Using allStrokes As Strokes = mInkOverlay.Ink.Strokes
    Dim bounds As Rectangle = allStrokes.GetBoundingBox(BoundingBoxMode.CurveFit)
    Dim halfRectangle As Rectangle = _
            New Rectangle(bounds.Left, bounds.Top, bounds.Width / 2, bounds.Height)
    allStrokes.ScaleToRectangle(halfRectangle)
End Using
// Access to the Strokes property returns a copy of the Strokes object.
// This copy must be implicitly (via using statement) or explicitly
// disposed of in order to avoid a memory leak.
using (Strokes allStrokes = mInkOverlay.Ink.Strokes)
{
    Rectangle bounds = allStrokes.GetBoundingBox(BoundingBoxMode.CurveFit);
    Rectangle halfRectangle = 
        new Rectangle(bounds.Left, bounds.Top, bounds.Width / 2, bounds.Height);
    allStrokes.ScaleToRectangle(halfRectangle);
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Framework

支援版本:3.0

請參閱

參考

Strokes 類別

Strokes 成員

Microsoft.Ink 命名空間

Stroke.ScaleToRectangle

Strokes.GetBoundingBox

Strokes.Scale

Strokes.Transform