# Geometry.StrokeContains Method

## Definition

Determines whether the geometry's stroke contains the specified Point.

 StrokeContains(Pen, Point) Determines whether the specified Point is contained in the stroke produced by applying the specified Pen to the geometry. StrokeContains(Pen, Point, Double, ToleranceType) Determines whether the specified Point is contained in the stroke produced by applying the specified Pen to the geometry, given the specified margin of error.

## StrokeContains(Pen, Point)

Determines whether the specified Point is contained in the stroke produced by applying the specified Pen to the geometry.

``````public:
bool StrokeContains(System::Windows::Media::Pen ^ pen, System::Windows::Point hitPoint);``````
``public bool StrokeContains (System.Windows.Media.Pen pen, System.Windows.Point hitPoint);``
``member this.StrokeContains : System.Windows.Media.Pen * System.Windows.Point -> bool``
``Public Function StrokeContains (pen As Pen, hitPoint As Point) As Boolean``

#### Parameters

pen
Pen

An object that determines the area of the geometry's stroke.

hitPoint
Point

The point to test for containment.

#### Returns

Boolean

`true` if `hitPoint` is contained in the stroke produced by applying the specified Pen to the geometry; otherwise, `false`.

### Remarks

The default tolerance factor (specified by the StandardFlatteningTolerance property) is used when determining whether the specified point is located in the geometry's stroke. To specify your own tolerance factor, use the StrokeContains overload.

Some Geometry methods (such as StrokeContains) produce or use a polygonal approximation of the geometry. The tolerance factor specifies the maximum distance between points in this polygonal approximation. Smaller tolerance values produce better approximations, but require more processing than an approximation with a large tolerance factor.

## StrokeContains(Pen, Point, Double, ToleranceType)

Determines whether the specified Point is contained in the stroke produced by applying the specified Pen to the geometry, given the specified margin of error.

``````public:
bool StrokeContains(System::Windows::Media::Pen ^ pen, System::Windows::Point hitPoint, double tolerance, System::Windows::Media::ToleranceType type);``````
``public bool StrokeContains (System.Windows.Media.Pen pen, System.Windows.Point hitPoint, double tolerance, System.Windows.Media.ToleranceType type);``
``member this.StrokeContains : System.Windows.Media.Pen * System.Windows.Point * double * System.Windows.Media.ToleranceType -> bool``
``Public Function StrokeContains (pen As Pen, hitPoint As Point, tolerance As Double, type As ToleranceType) As Boolean``

#### Parameters

pen
Pen

An object that defines the stroke of a geometry.

hitPoint
Point

The point to test for containment.

tolerance
Double

The maximum bounds on the distance between points in the polygonal approximation of the geometry. Smaller values produce more accurate results but cause slower execution. If `tolerance` is less than .000001, .000001 is used instead.

type
ToleranceType

One of the ToleranceType values that specifies whether the tolerance factor is an absolute value or relative to the area of the geometry.

#### Returns

Boolean

`true` if the stroke created by applying the specified Pen to the geometry contains the specified point, given the specified tolerance factor; otherwise, `false`.

### Remarks

Some Geometry methods (such as StrokeContains) produce or use a polygonal approximation of the geometry. The tolerance factor specifies the maximum distance between points in this polygonal approximation. Smaller tolerance values produce better approximations, but require more processing than an approximation with a large tolerance factor.