Strokes.ScaleToRectangle 方法

根据指定的 Rectangle 结构缩放 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