> For the complete documentation index, see [llms.txt](https://docs.wisej.com/system.drawing.managed/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspathiterator.md).

# GraphicsPathIterator

Namespace: **System.Drawing.Drawing2D**

Assembly: **System.Drawing.Managed** (4.0.0.0)

Provides the ability to iterate through subpaths in a [GraphicsPath](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md) and test the types of shapes contained in each subpath. This class cannot be inherited.

{% tabs %}
{% tab title="C#" %}

```csharp
public class GraphicsPathIterator : MarshalByRefObject, IDisposable
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class GraphicsPathIterator
    Inherits MarshalByRefObject
    Implements IDisposable
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/gN3G3VR5GgQngV3jdnfJ) GraphicsPathIterator(path)

Initializes a new instance of the [GraphicsPathIterator](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspathiterator.md) class.

| Name     | Type                                                                                                          | Description                                                                                                                                                                |
| -------- | ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **path** | [GraphicsPath](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md) | The [GraphicsPath](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md) object for which this helper class is to be initialized. |

## Properties

### ![](/files/gN3G3VR5GgQngV3jdnfJ) Count

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Gets the number of points in the path.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) SubpathCount

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Gets the number of sub paths in the path.

## Methods

### ![](/files/gN3G3VR5GgQngV3jdnfJ) CopyData(points, types, startIndex, endIndex)

Copies the [PathPoints](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md#pathpoints) property and [PathTypes](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md#pathtypes) property arrays of the associated [GraphicsPath](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md) into the two specified arrays.

| Parameter                                                                                              | Type                                                                      | Description                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **points** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg) | [PointF\[\]](https://docs.microsoft.com/dotnet/api/system.drawing.pointf) | Upon return, contains an array of [PointF](https://docs.microsoft.com/dotnet/api/system.drawing.pointf) structures that represents the points in the path. |
| **types** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg)  | [Byte\[\]](https://docs.microsoft.com/dotnet/api/system.byte)             | Upon return, contains an array of bytes that represents the types of points in the path.                                                                   |
| **startIndex**                                                                                         | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)               | Specifies the starting index of the arrays.                                                                                                                |
| **endIndex**                                                                                           | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)               | Specifies the ending index of the arrays.                                                                                                                  |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The number of points copied.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) Dispose()

### ![](/files/gN3G3VR5GgQngV3jdnfJ) Enumerate(points, types)

Copies the [PathPoints](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md#pathpoints) property and [PathTypes](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md#pathtypes) property arrays of the associated [GraphicsPath](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md) into the two specified arrays.

| Parameter                                                                                              | Type                                                                      | Description                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **points** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg) | [PointF\[\]](https://docs.microsoft.com/dotnet/api/system.drawing.pointf) | Upon return, contains an array of [PointF](https://docs.microsoft.com/dotnet/api/system.drawing.pointf) structures that represents the points in the path. |
| **types** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg)  | [Byte\[\]](https://docs.microsoft.com/dotnet/api/system.byte)             | Upon return, contains an array of bytes that represents the types of points in the path.                                                                   |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The number of points copied.

### ![](/files/k27LziTvwi3FA4zj3c22) Finalize()

Finalizes an instance of the [GraphicsPathIterator](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspathiterator.md) class.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) HasCurve()

Indicates whether the path associated with this [GraphicsPathIterator](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspathiterator.md) contains a curve.

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). This method returns `true` if the current subpath contains a curve; otherwise, `false`.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) NextMarker(path)

Moves the iterator to the next marker in the path.

| Parameter | Type                                                                                                          | Description                                                                                                                                                  |
| --------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **path**  | [GraphicsPath](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md) | The [GraphicsPath](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md) object to which the points will be copied. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The number of points between this marker and the next.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) NextMarker(startIndex, endIndex)

Increments the [GraphicsPathIterator](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspathiterator.md) to the next marker in the path and returns the start and stop indexes by way of the parameters.

| Parameter                                                                                                  | Type                                                        | Description                                                                                                                          |
| ---------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| **startIndex** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg) | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The integer reference supplied to this parameter receives the index of the point that starts a subpath.                              |
| **endIndex** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg)   | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | The integer reference supplied to this parameter receives the index of the point that ends the subpath to which *startIndex* points. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The number of points between this marker and the next.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) NextPathType(pathType, startIndex, endIndex)

Gets the starting index and the ending index of the next group of data points that all have the same type.

| Parameter                                                                                                  | Type                                                        | Description                                                                                                                                                                                                                      |
| ---------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **pathType** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg)   | [Byte](https://docs.microsoft.com/dotnet/api/system.byte)   | Receives the point type shared by all points in the group. Possible types can be retrieved from the [PathPointType](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.pathpointtype.md) enumeration. |
| **startIndex** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg) | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | Receives the starting index of the group of points.                                                                                                                                                                              |
| **endIndex** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg)   | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | Receives the ending index of the group of points.                                                                                                                                                                                |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). This method returns the number of data points in the group. If there are no more groups in the path, this method returns 0.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) NextSubpath(path, isClosed)

Gets the next figure (subpath) from the associated path of this [GraphicsPathIterator](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspathiterator.md).

| Parameter                                                                                                | Type                                                                                                          | Description                                                                                                                                                                                                                       |
| -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **path**                                                                                                 | [GraphicsPath](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md) | A [GraphicsPath](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md) that is to have its data points set to match the data points of the retrieved figure (subpath) for this iterator. |
| **isClosed** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg) | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                               | Indicates whether the current subpath is closed. It is `true` if the figure is closed, otherwise it is `false`.                                                                                                                   |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The number of data points in the retrieved figure (subpath). If there are no more figures to retrieve, zero is returned.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) NextSubpath(startIndex, endIndex, isClosed)

Moves the [GraphicsPathIterator](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspathiterator.md) to the next subpath in the path. The start index and end index of the next subpath are contained in the parameters.

| Parameter                                                                                                  | Type                                                            | Description                                                                                                     |
| ---------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| **startIndex** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg) | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)     | Receives the starting index of the next subpath.                                                                |
| **endIndex** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg)   | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)     | Receives the ending index of the next subpath.                                                                  |
| **isClosed** ![](https://github.com/iceteagroup/wisej-docs-sdm/blob/NET/.gitbook/assets/badge-byref.svg)   | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | Indicates whether the current subpath is closed. It is `true` if the figure is closed, otherwise it is `false`. |

**Returns:** [Int32](https://docs.microsoft.com/dotnet/api/system.int32). The number of subpaths in the [GraphicsPath](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspath.md) object.

### ![](/files/gN3G3VR5GgQngV3jdnfJ) Rewind()

Rewinds this [GraphicsPathIterator](/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspathiterator.md) to the beginning of its associated path.

The first time you call the [NextSubpath](#nextsubpath-path-isclosed) method of an iterator, it gets the first figure (subpath) of that iterator's associated path. The second time, it gets the second figure, and so on. When you call the [Rewind](#rewind) method, the sequence starts over; that is, after you call [Rewind](#rewind), the next call to [NextSubpath](#nextsubpath-path-isclosed) gets the first figure in the path. The [NextMarker](#nextmarker-path) and [NextPathType](#nextpathtype-pathtype-startindex-endindex) methods behave similarly.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.wisej.com/system.drawing.managed/api/system.drawing.drawing2d/system.drawing.drawing2d.graphicspathiterator.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
