次の方法で共有


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 void Clip (
    Rectangle r
)
public function Clip (
    r : Rectangle
)
Not applicable.

Parameters

  • r

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.

Example

This C# example calls the GetBoundingBox method to determine the bounding rectangle for a Strokes collection of an InkOverlay, theInkOverlay. It then calls the Clip method to clip the right half of the Strokes collection in theInkOverlay.

//Determine the bounding box for the Strokes collection.
Rectangle inkBounds = theInkOverlay.Ink.Strokes.GetBoundingBox();
//Create rectangle for Clip method.
Rectangle halfRectangle = new Rectangle(inkBounds.Left,
    inkBounds.Top, inkBounds.Width / 2, inkBounds.Height);
//Clip the Strokes collection.
theInkOverlay.Ink.Strokes.Clip(halfRectangle);

This Microsoft Visual Basic.NET example calls the GetBoundingBox method to determine the bounding rectangle for a Strokes collection of an InkOverlay, theInkOverlay. It then calls the Clip method to clip the right half of the Strokes collection in theInkOverlay.

'Determine the bounding box for the Strokes collection.
Dim inkBounds As Rectangle = theInkOverlay.Ink.Strokes.GetBoundingBox()
'Create rectangle for Clip method.
Dim halfRectangle As New Rectangle(inkBounds.Left, _
    inkBounds.Top, inkBounds.Width / 2, inkBounds.Height)
'Clip the Strokes collection.
theInkOverlay.Ink.Strokes.Clip(halfRectangle)

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Strokes Class
Strokes Members
Microsoft.Ink Namespace
BoundingBoxMode
Stroke.Clip
GetBoundingBox