howto avoid cdc drawing done not in onPaint to be erased?
- From: Equilibrium <ryariv@xxxxxxxxx>
- Date: Wed, 11 Jul 2007 00:06:40 -0700
hi all,
I have a static control in which i want to draw a circle.
I have subclassed the static control to a "CMyStatic" class.
added a CDC member -> CDC * pDC;
Initialize this member in OnMove function ->
void CMyStatic::OnMove(int x, int y)
{
CStatic::OnMove(x, y);
pDC = GetDC();
pDC->SelectStockObject(GRAY_BRUSH);
}
draw an ellipse on mouse click ->
void CMyStatic::OnLButtonDown(UINT nFlags, CPoint point)
{
pDC->Ellipse(0,0,100,100) ;
CStatic::OnLButtonDown(nFlags, point);
}
and ran the application.
everything was great till I'ved minimize , or covered the dialog , the
drawing disappeard.
I know i need to do something regurding MemDC ' but i can't find any
sample.
The goal is to draw items dinamically with the mouse or any other
place rather that the OnPaint function/
Please assist.
Yariv
.
- Follow-Ups:
- Re: howto avoid cdc drawing done not in onPaint to be erased?
- From: Joseph M . Newcomer
- Re: howto avoid cdc drawing done not in onPaint to be erased?
- From: David Webber
- Re: howto avoid cdc drawing done not in onPaint to be erased?
- From: David Wilkinson
- Re: howto avoid cdc drawing done not in onPaint to be erased?
- Prev by Date: Disabling System Menu on the dialog
- Next by Date: Re: Problem with Base64 Decoding for a CBitmap
- Previous by thread: Disabling System Menu on the dialog
- Next by thread: Re: howto avoid cdc drawing done not in onPaint to be erased?
- Index(es):
Loading