Compartir a través de


Ink.Clip Method

Ink.Clip Method

Removes the portions of a Stroke object or Strokes collection that are outside a given rectangle.

Definition

Visual Basic .NET Public Sub Clip( _
ByVal r As Rectangle _
)
C# public void Clip(
Rectangle r
);
Managed C++ public: void Clip(
Rectangle *r
);

Parameters

r System.Drawing.Rectangle. The rectangle outside of which the Stroke object or Strokes collection are clipped.

Exceptions

ObjectDisposedException Leave Site: The Ink object is disposed.

Remarks

The r paramter is specified in ink space coordinates.

Portions of the ink outside of the rectangle are deleted from the Ink object. Because of this, the Clip method may add new points to a Stroke object at the point where the Stroke object intersects the rectangle.

After you call the Clip method on an Ink object, the properties of each Stroke object in the Ink object's Strokes collection 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.

This method does not take the pen width into account when clipping. It clips only the actual ink or stroke data.

For a Stroke object or Strokes collection, the Clip 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.

For more information about how ink data is manipulated, see Ink Data.

Examples

[C#]

This C# example uses the Clip method to remove the portions of Stroke objects on an InkCollector control, theInkCollector, that are outside of a rectangle, theRectangle.

theInkCollector.Ink.Clip(theRectangle);

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example uses the Clip method to remove the portions of Stroke objects on an InkCollector control, theInkCollector, that are outside of a rectangle, theRectangle.

theInkCollector.Ink.Clip(theRectangle)

See Also