What am i doing wrong with this function?
I get an error on the DeleteObject() line. Why would it want to convert it to int.
Code:
void DrawPolygon (HWND hwnd, HDC hdc)
int i ;
POINT apt[10] ;
static POINT aptFigure [10] = { 10,70, 50,70, 50,10, 90,10, 90,50,
30,50, 30,90, 70,90, 70,30, 10,30 };
HBRUSH hbr = CreateSolidBrush (RGB (rand () % 256, rand () % 256, rand () % 256)) ;
HBRUSH hOld = (HBRUSH) SelectObject (hdc,hbr);
for (i = 0 ; i < 10 ; i++)
{
apt[i].x = cxClient * aptFigure[i].x / 200 ;
apt[i].y = cyClient * aptFigure[i].y / 100 ;
}
SetPolyFillMode (hdc, ALTERNATE) ;
Polygon (hdc, apt, 10) ;
for (i = 0 ; i < 10 ; i++)
{
apt[i].x += cxClient / 2 ;
}
SetPolyFillMode (hdc, WINDING) ;
Polygon (hdc, apt, 10) ;
SelectObject (hdc,hOld) ;
DeleteObject (hbr) ; //cannot convert from 'HBRUSH' to 'int'
There is no context in which this conversion is possible