I am using Visual C++ 6.0 to design a dialog-based GUI.
I first put a few CStatic bitmap controls in the dialog with ResourceView,
then I decide to draw a solid square and a few circles underneath as
background. To draw the background, I first created a compatible memory
device, then draw on the memory device, finally use Bitblt function to copy
the memory device context to the current device context. The centers of the
solid square and circles are not static, actually every second my software
redraw them. However, I found only for the first second the CStatic bitmap
controls are displayed in the dialog, then it disappeared, obviously was
overwritten by the "background".
It confused me since the same codes I wrote in eMbedded Visual C++ 4.0
worked perfect for PPC2003, and the bitmap controls were never overwritten
by the background.
I partly solved this problem by setting the visibility state of the bitmap
controls to off and then on for every second. However, I do not like the
flicker associated.
Could anybody please help me solve the problem? Thanks in advance.
John
//////////////////////////////////////////////////////////////
Iin Resource file, the control is defined as :
CONTROL 213,IDC_AZIMUTH_E,"Static",SS_BITMAP | NOT WS_VISIBLE |
WS_EX_TOPMOST,
123,121,15,13
Codes::
//Define the Memory Bitmap. Required!
CBitmap memBitmap;
memBitmap.CreateCompatibleBitmap (&clientDC,
SCREEN_WIDTH,
SCREEN_LENGTH); //Width, Height
dlgDC.SelectObject (&memBitmap);
// codes to draw on the memory device
.
.
.
//
clientDC.BitBlt(xStart, yStart,
SCREEN_WIDTH, SCREEN_LENGTH,
& dlgDC, xStart, yStart, SRCCOPY) ;