StrokeCollection.Clip Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Removes all strokes in the StrokeCollection that are outside the specified bounds.
Overloads
Clip(IEnumerable<Point>) |
Removes all strokes in the StrokeCollection that are outside the bounds of the specified Point array. |
Clip(Rect) |
Replaces all strokes that are clipped by the specified rectangle with new strokes that do not extend beyond the specified rectangle. |
Clip(IEnumerable<Point>)
Removes all strokes in the StrokeCollection that are outside the bounds of the specified Point array.
public:
void Clip(System::Collections::Generic::IEnumerable<System::Windows::Point> ^ lassoPoints);
public void Clip (System.Collections.Generic.IEnumerable<System.Windows.Point> lassoPoints);
member this.Clip : seq<System.Windows.Point> -> unit
Public Sub Clip (lassoPoints As IEnumerable(Of Point))
Parameters
- lassoPoints
- IEnumerable<Point>
An array of type Point that specifies the area to be clipped.
Examples
The following example demonstrates how to clip the strokes in a StrokeCollection. This example assumes that there is an InkPresenter called presenter
.
// Clip the selected strokes.
public void ClipStrokes(Stroke lasso)
{
Point[] strokePoints = (Point[])lasso.StylusPoints;
presenter.Strokes.Clip(strokePoints);
}
' Clip the selected strokes.
Public Overloads Sub ClipStrokes(ByVal lasso As Stroke)
If lasso Is Nothing Then
Return
End If
Dim strokePoints() As Point = CType(lasso.StylusPoints, Point())
presenter.Strokes.Clip(strokePoints)
End Sub
Remarks
The Clip method connects the first and last points in lassoPoints
to create the lasso.
The Clip method raises the StrokesChanged event for each Stroke it clips.
Applies to
Clip(Rect)
Replaces all strokes that are clipped by the specified rectangle with new strokes that do not extend beyond the specified rectangle.
public:
void Clip(System::Windows::Rect bounds);
public void Clip (System.Windows.Rect bounds);
member this.Clip : System.Windows.Rect -> unit
Public Sub Clip (bounds As Rect)
Parameters
Examples
The following example demonstrates how to erase the ink that is outside the bounds of a Rect. This example assumes that there is an InkPresenter called presenter
.
Rect rect = new Rect(100, 100, 200, 200);
presenter.Strokes.Clip(rect);
Dim rect As Rect = New Rect(100, 100, 200, 200)
presenter.Strokes.Clip(rect)
Remarks
All strokes that are entirely outside the specified rectangle are removed.