Compartilhar via


Stroke.Clip Method

Stroke.Clip Method

Removes the portions of the Stroke object 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 each Stroke object is clipped.

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

[C#]

This C# example calls the GetBoundingBox method to determine the bounding rectangle for a Stroke object, theStroke. It then calls the Clip method to clip the right half of theStroke.

Rectangle strokeBounds = theStroke.GetBoundingBox();
Rectangle halfRectangle = new Rectangle(strokeBounds.Left,
    strokeBounds.Top, strokeBounds.Width / 2, strokeBounds.Height);
theStroke.Clip(halfRectangle);
                

[VB.NET]

This Microsoft® Visual Basic® .NET example calls the GetBoundingBox method to determine the bounding rectangle for a Stroke object, theStroke. It then calls the Clip method to clip the right half of theStroke.

Dim strokeBounds As Rectangle = theStroke.GetBoundingBox()
Dim halfRectangle As New Rectangle(strokeBounds.Left, _
    strokeBounds.Top, strokeBounds.Width / 2, strokeBounds.Height)
theStroke.Clip(halfRectangle)
                

See Also