1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
case WM_PAINT:
BeginPaint(hwnd,&ps);
//change color of lines
hPen = CreatePen(PS_SOLID,1,RGB(r++ % 255,g++ % 255,b++ % 255));
SelectObject(ps.hdc ,hPen);
j=0;
k=0;
//make seven parallel squares
while(k<7)
{
MoveToEx(ps.hdc ,cxCenter[0]+j,cyCenter[0]+j,NULL);
LineTo(ps.hdc ,cxCenter[1]+j,cyCenter[1]+j);
MoveToEx(ps.hdc ,cxCenter[1]+j,cyCenter[1]+j,NULL);
LineTo(ps.hdc ,cxCenter[2]+j,cyCenter[2]+j);
MoveToEx(ps.hdc ,cxCenter[2]+j,cyCenter[2]+j,NULL);
LineTo(ps.hdc ,cxCenter[3]+j,cyCenter[3]+j);
MoveToEx(ps.hdc ,cxCenter[3]+j,cyCenter[3]+j,NULL);
LineTo(ps.hdc ,cxCenter[0]+j,cyCenter[0]+j);
j += 3;
k++;
}
//for (k=0;k<500;k++)
// SetPixel(ps.hdc ,pd.Point[k].x ,pd.Point [k].y ,pd.Color[k]);
DeleteObject(hPen);
return 0;
|