what is difference between
BeginPaint()
EndPaint()
and
GetDC()
ReleaseDC()
I am getting problem with this.
While using beginpaint and end paint is works well but in another
the objects drawn are flicker.
Printable View
what is difference between
BeginPaint()
EndPaint()
and
GetDC()
ReleaseDC()
I am getting problem with this.
While using beginpaint and end paint is works well but in another
the objects drawn are flicker.
BeginPaint() -- Start Painting To An Object
EndPaint() -- Stop Painting To An Object
and
GetDC() -- Get Device Context (The Device To Paint To)
ReleaseDC() -- Release Device Context (The Device To Paint To)
If you zip up your code (Or if you dont want to do that you can post your problem code) I will take a look at it if you want. With out it I can't really tell you what your problem is
PAINTSTRUCT pc;
hDc=BeginPaint(hwnd,&pc);
//hDc=GetDC(hwnd);
Rectangle(hDc,10,10,30,40);
Ellipse(hDc,10,10,30,40);
MoveToEx(hDc,20,40,NULL);
LineTo(hDc,100,100);
Polygon(hDc,A,4);
RECT R;
R.top =50;
R.left =50;
R.right =100;
R.bottom=100;
InvertRect(hDc,&R);
//ReleaseDC(hwnd,hDc);
EndPaint(hwnd,&pc);
Well I dont see anything that jumps out at me. One thing you might try is to do:
BeginPaint(hwnd,&pc);
EndPaint(hwnd,&pc);
Before the rest of your paint code. Don't ask me why but it seems to take care of the flicker.
Also you need to put back in the ReleaseDC, because if you don't then you have a memory leak. If you are still having problems, then I am going to need to see your whole code.
Never use the *Paint and the *DC functions together. Use the *Paint functions ONLY in response to the WM_PAINT message, and *DC in all other situations. Then you shouldn't have problems.