Flicker when drawing owner-drawn control
- From: eepcat <eepcat@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Aug 2008 08:24:01 -0700
WinCE 5.0 / EVC 4.0
I am dealing with a flicker issue when drawing an owner drawn custom
control. I am hopeful that someone here can help me out.
I made a subclass of the CButton class which handles all of the drawing
functions.
The class already addresses the usual suspects:
- double-buffering
- override OnEraseBkgnd and return 1
....but I still have flicker when drawing the control, whether I call
Invalidate or InvalidateRect on the object.
This object is redrawn in response to data received on the main dialog
(parent), which then calls object->Invalidate(). Is there anything wrong
with this approach?
Below is an abridged version of my DrawItem( ) method...
***************************************
this->GetClientRect(&DrawRect);
pDC = this->GetDC();
MemDC.CreateCompatibleDC(pDC);
MemBitmap.CreateCompatibleBitmap(pDC, (DrawRect.right - DrawRect.left),
(DrawRect.bottom - DrawRect.top));
// drawing code here //
pDC->BitBlt(DrawRect.left, DrawRect.top, (DrawRect.right - DrawRect.left),
(DrawRect.bottom - DrawRect.top), &MemDC, 0, 0, SRCCOPY);
// cleanup code here //
****************************************
The OnPaint( ) method simply calls CButton::OnPaint( );
Originally, I had the drawing code as part of the main dialog - with no
flicker. It made more sense for the object to draw itself, so I went the
owner drawn control route, but now I have flicker.
Thanks for helping,
- eepcat
.
- Follow-Ups:
- RE: Flicker when drawing owner-drawn control
- From: eepcat
- RE: Flicker when drawing owner-drawn control
- Prev by Date: Re: accessing dll in eVC
- Next by Date: RE: Flicker when drawing owner-drawn control
- Previous by thread: Can not warp mstscax.dll in Windows CE thin client
- Next by thread: RE: Flicker when drawing owner-drawn control
- Index(es):