聚美优品是正品么:在vc里面怎样用简单的图案填充一个多边形

来源:百度文库 编辑:中科新闻网 时间:2024/04/30 00:23:10
比如设个数组用一串字符填充多边形 或者是用位图填充多边形 刷子或什么的都可以
在自己画完多边形后自动完成填充
最好能举个例子给出部分源码
谢谢

使用FloodFill函数就可以完成填充
BOOL FloodFill(

HDC hdc, // handle to device context
int nXStart, // x-coordinate, where fill begins
int nYStart, // y-coordinate, where fill begins
COLORREF crFill // fill color
);

Parameters

hdc

Identifies a device context.

nXStart

Specifies the logical x-coordinate of the point where filling is to begin.

nYStart

Specifies the logical y-coordinate of the point where filling is to begin.

crFill

Specifies the color of the boundary or of the area to be filled.

Return Values

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Following are reasons this function might fail:

?The fill could not be completed.
?The given point has the boundary color specified by the crFill parameter.
?The given point lies outside the current clipping region ?that is, it is not visible on the device.

See Also