Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
The GraphicsPathIterator::Enumerate method copies the path's data points to a PointF array and copies the path's point types to a BYTE array.
Syntax
INT Enumerate(
[out] PointF *points,
[out] BYTE *types,
[in] INT count
);
Parameters
[out] points
Type: PointF*
Pointer to an array that receives the path's data points.
[out] types
Type: BYTE*
Pointer to an array that receives the path's point types.
[in] count
Type: INT
Integer that specifies the number of elements in the points array. This is the same as the number of elements in the types array.
Return value
Type: INT
This method returns the number of points retrieved.
Remarks
This GraphicsPathIterator object is associated with a GraphicsPath object. That GraphicsPath object has an array of points and an array of types. Each element in the array of types is a byte that specifies the point type and a set of flags for the corresponding element in the array of points. Possible point types and flags are listed in the PathPointType enumeration.
You can call the GraphicsPathIterator::GetCount method to determine the number of data points in the path. The points parameter points to a buffer that receives the data points, and the types parameter points to a buffer that receives the types. Before you call the GraphicsPathIterator::Enumerate method, you must allocate memory for those buffers. The size of the points buffer should be the return value of GraphicsPathIterator::GetCount multiplied by sizeof(PointF). The size of the types buffer should be the return value of GraphicsPathIterator::GetCount.
Examples
The following example creates a GraphicsPath object and adds three lines to the path. The code creates a GraphicsPathIterator object and calls its GraphicsPathIterator::Enumerate method to retrieve the path's data points and point types. Then the code displays the count returned by the GraphicsPathIterator::Enumerate method.
#define BUFFER_SIZE 30
TCHAR numPointsEnum[BUFFER_SIZE];
// Add some lines to a path.
Point pts[] = {Point(20, 20),
Point(100, 20),
Point(100, 50),
Point(20, 50)};
GraphicsPath path;
path.AddLines(pts, 4);
// Create a GraphicsPathIterator object, and associate it with the path.
GraphicsPathIterator pathIterator(&path);
// Create destination arrays, and copy the path data to them.
UINT c = pathIterator.GetCount();
PointF* pEnumPoints = new PointF[c];
BYTE* pTypes = new BYTE[c];
INT count = pathIterator.Enumerate(pEnumPoints, pTypes, c);
// Confirm that the points were enumerated.
StringCchPrintf(
numPointsEnum, BUFFER_SIZE, TEXT("%d points were enumerated."), count);
MessageBox(hWnd, numPointsEnum, TEXT("Enumerate"), NULL);
delete[] pEnumPoints;
delete[] pTypes;
Requirements
| Requirement | Value |
|---|---|
| Minimum supported client | Windows XP, Windows 2000 Professional [desktop apps only] |
| Minimum supported server | Windows 2000 Server [desktop apps only] |
| Target Platform | Windows |
| Header | gdipluspath.h (include Gdiplus.h) |
| Library | Gdiplus.lib |
| DLL | Gdiplus.dll |
See also
Constructing and Drawing Paths
GraphicsPathIterator::CopyData