Redigera

Dela via


Stroke.GetClipResult Method

Definition

Returns segments of the current Stroke that are within the specified area.

Overloads

GetClipResult(IEnumerable<Point>)

Returns segments of the current Stroke that are within the specified bounds.

GetClipResult(Rect)

Returns segments of the current Stroke that are within the specified rectangle.

GetClipResult(IEnumerable<Point>)

Returns segments of the current Stroke that are within the specified bounds.

public:
 System::Windows::Ink::StrokeCollection ^ GetClipResult(System::Collections::Generic::IEnumerable<System::Windows::Point> ^ lassoPoints);
public System.Windows.Ink.StrokeCollection GetClipResult (System.Collections.Generic.IEnumerable<System.Windows.Point> lassoPoints);
member this.GetClipResult : seq<System.Windows.Point> -> System.Windows.Ink.StrokeCollection
Public Function GetClipResult (lassoPoints As IEnumerable(Of Point)) As StrokeCollection

Parameters

lassoPoints
IEnumerable<Point>

The points that specify the line which defines where to clip.

Returns

A StrokeCollection that contains copies of the segments of the current Stroke that are within the specified bounds.

Examples

The following example removes the ink that is outside of the specified bounds.

Point[] myPoints = new Point[] {
    new Point(100, 100),
    new Point(200, 100),
    new Point(200, 200),
    new Point(100, 200)};

StrokeCollection clipResults = aStroke.GetClipResult(myPoints);

// inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke);
inkCanvas1.Strokes.Add(clipResults);
Dim myPoints() As System.Windows.Point = _
              {New System.Windows.Point(100, 100), _
               New System.Windows.Point(200, 100), _
               New System.Windows.Point(200, 200), _
               New System.Windows.Point(100, 200)}

Dim clipResults As StrokeCollection = aStroke.GetClipResult(myPoints)

' inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke)
inkCanvas1.Strokes.Add(clipResults)

Remarks

The GetClipResult method returns a StrokeCollection that contains strokes that represent the segments of the Stroke that is within lassoPoints. GetClipResult does not change the original Stroke.

The GetClipResult method connects the first and last points in lassoPoints to create the lasso.

Applies to

GetClipResult(Rect)

Returns segments of the current Stroke that are within the specified rectangle.

public:
 System::Windows::Ink::StrokeCollection ^ GetClipResult(System::Windows::Rect bounds);
public System.Windows.Ink.StrokeCollection GetClipResult (System.Windows.Rect bounds);
member this.GetClipResult : System.Windows.Rect -> System.Windows.Ink.StrokeCollection
Public Function GetClipResult (bounds As Rect) As StrokeCollection

Parameters

bounds
Rect

A Rect that specifies the area to clip.

Returns

A StrokeCollection that contains copies of the segments of the current Stroke that are within the bounds of bounds.

Examples

The following example removes the ink that is outside of the specified bounds.

Rect myRect = new Rect(100, 100, 100, 100);

StrokeCollection clipResults = aStroke.GetClipResult(myRect);

// inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke);
inkCanvas1.Strokes.Add(clipResults);
Dim myRect As New Rect(100, 100, 100, 100)

Dim clipResults As StrokeCollection = aStroke.GetClipResult(myRect)

' inkCanvas1 is the InkCanvas on which we update the strokes
inkCanvas1.Strokes.Remove(aStroke)
inkCanvas1.Strokes.Add(clipResults)

Remarks

The GetClipResult method returns a StrokeCollection that contains strokes that represent the segments of the Stroke that is within bounds. GetClipResult does not change the original Stroke.

Applies to