-
Fill polygon????
Hi,
I'm Phoenix a beginnen with C++ I controle Java and I'm working on a tic-tac-toe game but I have a problem.
I'm trying to fill a polygon shape. I already tryed FillRect and FloodFill And I hope that some one can help me here.
The polygon shape is:
POINT line[6] = {100,13, 107,268, 104,253, 106,285, 100,265, 96,286};
Polygon(hDC, line, 6);
Can anyone help me with this??
-
-
I also tryed that but it didn't work I will try again but can you an example?? Thank anyway!
Greets Phoenix
-
FLOODFILLBORDER:
Code:
case WM_PAINT:
{
/*draw triangle with green border and fill it with red stripes*/
int nDC;
PAINTSTRUCT ps;
POINT pts[]={{100,10},{200,110},{10,110},{100,10}};
COLORREF clr=RGB(0,128,0);
HBRUSH hbr=CreateHatchBrush(HS_BDIAGONAL,RGB(128,0,0));
HPEN hPen=CreatePen(PS_SOLID,1,clr);
BeginPaint(hwnd,&ps);
nDC=SaveDC(ps.hdc);
SelectObject(ps.hdc,hPen);
Polyline(ps.hdc,pts,4);
SelectObject(ps.hdc,hbr);
ExtFloodFill(ps.hdc,100,70,clr,FLOODFILLBORDER);
RestoreDC(ps.hdc,nDC);
EndPaint(hwnd,&ps);
DeleteObject(hPen);
return 0;
}
FLOODFILLSURFACE:
Code:
case WM_PAINT:
{
/*draw triangle and fill it with red stripes*/
int nDC;
PAINTSTRUCT ps;
POINT pts[]={{100,10},{200,110},{10,110},{100,10}};
COLORREF clr;
HBRUSH hbr=CreateHatchBrush(HS_BDIAGONAL,RGB(128,0,0));
BeginPaint(hwnd,&ps);
nDC=SaveDC(ps.hdc);
Polyline(ps.hdc,pts,4);
clr=GetPixel(ps.hdc,100,70);
SelectObject(ps.hdc,hbr);
ExtFloodFill(ps.hdc,100,70,clr,FLOODFILLSURFACE);
RestoreDC(ps.hdc,nDC);
EndPaint(hwnd,&ps);
return 0;
}
Please post future windows questions on the windows board.
-
Dude Thank you very must and sorry for posting on the wrong board!1
Greets Phoenix!