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 34 35 36 37 38 39 40
|
PAINTSTRUCT ps;
HDC hdc;
HDC hdcmem;
HBITMAP bitmap;
hdc = GetDC(hwnd);
hdcmem = CreateCompatibleDC(hdc);
bitmap = CreateCompatibleBitmap(hdc,300,300);
//Start drawing
HPEN hPenOld;
//Red Rectangle
HPEN hLinePen;
COLORREF qLineColor;
qLineColor = RGB(0,0,0);
hLinePen = CreatePen(PS_SOLID,1,qLineColor);
hPenOld = (HPEN)SelectObject(hdc,hLinePen);
Rectangle(hdc,info.rec1,info.rec2,info.rec3,info.rec3);
qLineColor = RGB(0,0,255);
hLinePen = CreatePen(PS_SOLID,5,qLineColor);
hPenOld = (HPEN)SelectObject(hdc,hLinePen);
MoveToEx(hdc,info.posX,info.posY,NULL);
LineTo(hdc,info.posX,info.posY);
BitBlt(hdc,0,0,300,300,hdcmem,0,0,SRCCOPY);
SelectObject(hdc,hPenOld);
DeleteObject(hLinePen);
DeleteDC(hdcmem);
DeleteObject(bitmap);
ReleaseDC(hwnd, hdc);
|