Strokes.Clip 方法

移除 Strokes 集合中每个 Stroke 对象在给定矩形以外的部分。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public Sub Clip ( _
    r As Rectangle _
)
用法
Dim instance As Strokes
Dim r As Rectangle

instance.Clip(r)
public void Clip(
    Rectangle r
)
public:
void Clip(
    Rectangle r
)
public void Clip(
    Rectangle r
)
public function Clip(
    r : Rectangle
)

参数

备注

R 参数是用墨迹空间坐标指定的。

此方法更新父 Ink 对象。无论何时从 Ink 对象移除墨迹,任何为该 Ink 对象定义的 Stroke 对象或 Strokes 集合都将无效。

调用 Clip 方法后,每个 Stroke 对象的属性都可能发生更改。例如,如果 Stroke 对象在裁剪矩形区域中开始,退出裁剪矩形,然后返回裁剪矩形中;则它将成为两个 Stroke 对象,其中至少一个具有新的 Id 属性。尽管有此行为,即使发生更改,Ink 对象中的所有 Id 属性仍保证是唯一的。Stroke 对象的其他属性也可能发生类似更改。

示例

在此示例中,InkOverlay 对象的 Strokes 集合裁剪至 Strokes 集合的右半边。首先,通过调用 GetBoundingBox 方法获得 Strokes 集合的边框。然后,创建裁剪了右半部分的新边框并传递给 Clip 方法。

' 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
    ' Determine the bounding box for the Strokes collection.
    Dim bounds As Rectangle = allStrokes.GetBoundingBox()
    'Create rectangle for Clip method.
    Dim halfRectangle As Rectangle = _
            New Rectangle(bounds.Left, bounds.Top, bounds.Width / 2, bounds.Height)
    ' Clip the Strokes collection.
    allStrokes.Clip(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)
{
    // Determine the bounding box for the Strokes collection.
    Rectangle bounds = allStrokes.GetBoundingBox();
    //Create rectangle for Clip method.
    Rectangle halfRectangle = 
        new Rectangle(bounds.Left, bounds.Top, bounds.Width / 2, bounds.Height);
    // Clip the Strokes collection.
    allStrokes.Clip(halfRectangle);
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

Strokes 类

Strokes 成员

Microsoft.Ink 命名空间

BoundingBoxMode

Stroke.Clip

GetBoundingBox