Hi, everybody
Here's my problem: I'm trying to write a simple drawing app (just for =
exercise) and so far its been going OK. I can draw lines in client area =
in different colors, but when ever I minimize or maximize the window, or =
something similar happenes, all the content of the window is gone. I =
tried to use a memory DC an bitmap to save the contents in, and BitBlt =
it back in response to WM_PAINT message, but the program just "froze". =
Can anybody give me a hint how to do it? Here's the code used for =
drawing lines without any restoring parts:
case WM_MOUSEMOVE:
{
switch(iTool) /* iTool is used for dtetrmining =
which drawing tool is selected(line, rect etc.)*/
{
case 0:
{
if(wParam=3D=3DMK_LBUTTON) /*if line is selected =
(itool=3D0) and left button presed*/
{
HDC hDC=3DGetDC(hwnd); =20
=20
HPEN =
hPen=3DCreatePen(PS_SOLID,iCurWidth,crCurColor);
HPEN hOldPen=3D(HPEN)SelectObject(hDC,hPen);
CLine* pLine=3Dnew =
CLine(ptPrevPos,MAKEPOINTS(lParam),iCurWidth,crCurColor); /*create new =
line object*/
pLine->DrawLine(hDC);
ptPrevPos=3DMAKEPOINTS(lParam);
SelectObject(hDC,hOldPen);
DeleteDC(hDC);
}
}
break;
case 1: /* nothing here yet*/
break;
}
}
|