I am building Windows CE 6.0 R3 image for VIA board.I have added Start Menu Banner(.bmp) displaying Windows CE to the Start Menu.
When i am scrolling the mouse or keyboard over the start menu, The banner gets erased.Its not refreshed.
I have tried the functions like RedrawWindow(),Invalidate(). but i can't be able to solve the problem. Here is the code related to draw start menu, can any one help me to redraw the start menu banner,
int StartMenu_DrawMenuItem(DRAWITEMSTRUCT *lpdis)
{
LPSTMENUDATA lpst;
RECT rc; HICON hicon;
CStringRes szMenu(g_hInstance);
if (!lpdis)
{
ASSERT(lpdis);
return FALSE;
}
lpst = (LPSTMENUDATA)lpdis->itemData;
if (!lpst)
{
ASSERT(lpst);
return FALSE;
}
CopyRect(&rc, &lpdis->rcItem);
if (lpst->idMenuCmd <= IDM_START_LAST_BANNER)
{
rc.left += sizeSTPegasus.cx; }
if (lpst->idMenuCmd == IDM_START_LOGOFF || lpst->idMenuCmd == IDM_START_SHUTDOWN)
{
rc.left += sizeSTPegasus.cx;
}
switch (lpdis->itemAction)
{
case ODA_DRAWENTIRE:
if (idFirstMenu == lpst->idMenuCmd)
{
CopyRect(&rcMenu, &lpdis->rcItem);
rcMenu.right = rcMenu.left + sizeSTPegasus.cx; }
else if (idLastMenu == lpst->idMenuCmd)
{
rcMenu.bottom = lpdis->rcItem.bottom;
if (hbmSTPegasus) {
HDC hdcmem = CreateCompatibleDC(lpdis->hDC);
if (hdcmem)
{
SelectObject(hdcmem, hbmSTPegasus);
FillRect(lpdis->hDC, &rcMenu,
GetSysColorBrush(COLOR_ACTIVECAPTION));
BitBlt(lpdis->hDC, 0, rcMenu.bottom - sizeSTPegasus.cy,
sizeSTPegasus.cx, sizeSTPegasus.cy, hdcmem, 0, 0,
SRCCOPY);
DeleteDC(hdcmem);
}
}
}
case ODA_SELECT: if ((lpdis->itemState & ODS_SELECTED) && lpst->idMenuCmd)
{
HBRUSH hbrush = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT));
SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
FillRect(lpdis->hDC, &rc, hbrush);
}
else
{
HBRUSH hbrush = CreateSolidBrush(GetSysColor(COLOR_MENU));
SetTextColor(lpdis->hDC, GetSysColor(COLOR_MENUTEXT));
FillRect(lpdis->hDC, &rc, hbrush);
DeleteObject((HGDIOBJ)hbrush);
}
break;
default:
break;