Share via


Stroke.Clip Method

Removes the portions of the Stroke object 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 Stroke 
Dim r As Rectangle

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

Parameters

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, each selected Stroke object of an InkOverlay is modified. First, the GetBoundingBox method is called to determine the bounding rectangle for a selected Stroke. The resultant rectangle is then modified to be half of its original width. Then the Clip method is called to clip the right half of the Stroke.

For Each S As Stroke In mInkOverlay.Selection
    Dim sBounds As Rectangle = S.GetBoundingBox()
    ' decrease width by half
    sBounds.Width -= sBounds.Width / 2
    ' clip the stroke
    S.Clip(sBounds)
Next
foreach (Stroke S in mInkOverlay.Selection)
{
    Rectangle sBounds = S.GetBoundingBox();
    // decrease width by half
    sBounds.Width -= sBounds.Width / 2;
    // clip the stroke
    S.Clip(sBounds);
}

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

See Also

Reference

Stroke Class

Stroke Members

Microsoft.Ink Namespace

BoundingBoxMode

Stroke.GetBoundingBox

Strokes.Clip