C
Okay zwei Probleme sind gelöst, nur das Fokus Problem besteht noch.
Du meintest ich solte den nicht zeichnen, aber ich zeichne ihn gar nicht.
Hier der Code:
case WM_DRAWITEM:
{
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT*)lParam;
int move;
if( dis->hwndItem == TreeView )
{
COLORREF bgColor;
char buf[100];
SendMessage(TreeView,LB_GETTEXT,dis->itemID,(LPARAM)buf);
string listitems;
string rest;
HBRUSH hbr;
SetTextColor(dis->hDC,RGB(0,0,0));
if(dis->itemID==0||dis->itemID==3||dis->itemID==5||dis->itemID==7)
{
SetBkColor(dis->hDC,RGB(237,237,254));
hbr = CreateSolidBrush( RGB(237,237,254) );
move=7;
}
else
{
SetBkColor(dis->hDC,RGB(255,255,255));
hbr = (HBRUSH) GetStockObject(WHITE_BRUSH);
if( dis->itemState & ODS_SELECTED )
{
SetBkColor(dis->hDC,RGB(197,231,246));
hbr = CreateSolidBrush( RGB(197,231,246) );
}
move=18;
}
FillRect(dis->hDC,&dis->rcItem,hbr);
DeleteObject(hbr);
TextOut(dis->hDC, dis->rcItem.left+move, dis->rcItem.top+3, buf, strlen(buf));
}
}
break;
case WM_MEASUREITEM:
LPMEASUREITEMSTRUCT mis = (LPMEASUREITEMSTRUCT)lParam;
mis->itemHeight= 20;
break;
case WM_CTLCOLORLISTBOX:
return (LRESULT)CreateSolidBrush(RGB(255,255,255));