Strokes.Clip Method
Removes the portions of every Stroke object in the Strokes collection that are outside a given rectangle.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in Microsoft.Ink.dll)
Syntax
'Declaration
Public Sub Clip ( _
r As Rectangle _
)
'Usage
Dim instance As Strokes
Dim r As Rectangle
instance.Clip(r)
public void Clip(
Rectangle r
)
public:
void Clip(
Rectangle r
)
public function Clip(
r : Rectangle
)
Parameters
- r
Type: System.Drawing.Rectangle
Remarks
The R parameter is specified in ink space coordinates.
This method updates the parent Ink object. Whenever ink is removed from an Ink object, any Stroke objects or Strokes collections defined for that Ink object may be invalidated.
After you call the Clip method , the properties of each Stroke object may change. For example, if a Stroke object begins within the area of the clip rectangle, exits the clip rectangle, and then returns to within the clip rectangle; it becomes two Stroke objects, at least one of which has a new Id property. Despite this behavior, all Id properties are guaranteed to be unique within an Ink object, even if they change. Other properties for the Stroke object may also undergo similar change.
Examples
In this example, a Strokes collection of an InkOverlay,object is clipped to the right half of the Strokes collection. First, the bounding rectangle of the Strokes collection is obtained by calling the GetBoundingBox method. A new rectangle with the right half clipped is then created and passed to the Clip method.
' 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);
}
Platforms
Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information
.NET Framework
Supported in: 3.0