Stroke Class

Definition

Represents a single ink stroke.

public class Stroke : System.ComponentModel.INotifyPropertyChanged
Inheritance
Stroke
Implements

Remarks

A Stroke is the data object that is collected from a pointing device, such as a tablet pen or a mouse. The Stroke can be created and manipulated programmatically, and can be represented visually on an ink-enabled element, such as the InkCanvas. A Stroke contains information about both its position and appearance. The StylusPoints property is a collection of StylusPoint objects that specifies the position of the Stroke. The DrawingAttributes property specifies a stroke's appearance.

Constructors

Stroke(StylusPointCollection, DrawingAttributes)

Initializes a new instance of the Stroke class.

Stroke(StylusPointCollection)

Initializes a new instance of the Stroke class.

Properties

DrawingAttributes

Gets or sets the DrawingAttributes for the Stroke object.

StylusPoints

Returns the stylus points of the Stroke.

Methods

AddPropertyData(Guid, Object)

Adds a custom property to the Stroke object.

Clone()

Returns a deep copy of the existing Stroke object.

ContainsPropertyData(Guid)

Returns a value that indicates whether the Stroke object contains the specified custom property.

Draw(DrawingContext, DrawingAttributes)

Renders the Stroke object based upon the specified DrawingContext and DrawingAttributes.

Draw(DrawingContext)

Renders the Stroke object based upon the specified DrawingContext.

DrawCore(DrawingContext, DrawingAttributes)

Renders the Stroke on the specified DrawingContext using the specified DrawingAttributes.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetBezierStylusPoints()

Returns the stylus points the Stroke uses when FitToCurve is true.

GetBounds()

Retrieves the bounding box for the Stroke object.

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.

GetEraseResult(IEnumerable<Point>, StylusShape)

Returns the segments of the current Stroke after it is dissected by the designated path using the specified StylusShape.

GetEraseResult(IEnumerable<Point>)

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

GetEraseResult(Rect)

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

GetGeometry()

Gets the Geometry of the current Stroke.

GetGeometry(DrawingAttributes)

Gets the Geometry of the current Stroke using the specified DrawingAttributes.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetPropertyData(Guid)

Retrieves the property data for the specified GUID.

GetPropertyDataIds()

Retrieves the GUIDs of any custom properties associated with the Stroke object.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
HitTest(IEnumerable<Point>, Int32)

Returns a value that indicates whether the current Stroke is within the specified bounds.

HitTest(IEnumerable<Point>, StylusShape)

Returns whether the specified path intersects the Stroke using the specified StylusShape.

HitTest(Point, Double)

Returns a value that indicates whether current Stroke intersects the specified area.

HitTest(Point)

Returns a value that indicates whether current Stroke intersects the specified point.

HitTest(Rect, Int32)

Returns a value that indicates whether the Stroke is within the bounds of the specified rectangle.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnDrawingAttributesChanged(PropertyDataChangedEventArgs)

Allows derived classes to modify the default behavior of the DrawingAttributesChanged event.

OnDrawingAttributesReplaced(DrawingAttributesReplacedEventArgs)

Allows derived classes to modify the default behavior of the DrawingAttributesReplaced event.

OnInvalidated(EventArgs)

Raises the Invalidated event.

OnPropertyChanged(PropertyChangedEventArgs)

Occurs when any Stroke property changes.

OnPropertyDataChanged(PropertyDataChangedEventArgs)

Allows derived classes to modify the default behavior of the PropertyDataChanged event.

OnStylusPointsChanged(EventArgs)

Raises the StylusPointsChanged event.

OnStylusPointsReplaced(StylusPointsReplacedEventArgs)

Raises the StylusPointsReplaced event.

RemovePropertyData(Guid)

Deletes a custom property from the Stroke object.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
Transform(Matrix, Boolean)

Performs a transformation based upon the specified Matrix object.

Events

DrawingAttributesChanged

Occurs when the DrawingAttributes associated with the Stroke object change.

DrawingAttributesReplaced

Occurs when the drawing attributes of a Stroke object are replaced.

Invalidated

Occurs when the appearance of the Stroke changes.

PropertyDataChanged

Occurs when the custom properties on a Stroke object changes.

StylusPointsChanged

Occurs when the StylusPoints property changes.

StylusPointsReplaced

Occurs when the StylusPoints property is assigned a new StylusPointCollection.

Explicit Interface Implementations

INotifyPropertyChanged.PropertyChanged

This API supports the product infrastructure and is not intended to be used directly from your code.

Occurs when the value of any Stroke property has changed.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also