多边形有两种填充模式:
这两种填充模式可以通过对应的API函数来设置
我们通过:
SetPolyFillMode();
函数来设置填充模式
填充模式有两种:
#define ALTERNATE 1 //上图图一样式
#define WINDING 2 //上图图二样式
具体案例:
POINT apt[5] = {
{ 0,200 },
{ 600,200 },
{ 100,600 },
{ 300,0 },
{ 500,600 }
};
SelectObject(hdc, GetStockObject(BLACK_BRUSH));
SelectObject(hdc, GetStockObject(NULL_PEN));
SetPolyFillMode(hdc, WINDING); //设置模式
Polygon(hdc, apt, 5);
效果图: