help in DrawItem()
-
Hi all, I have a dialogbox created in an SDI application on which i placed a ownerdraw buttons and i am displaying some characters on the buttons and when i open the dialog box for the first time with shift key pressed on keyboard i am able to see capital letters on the buttons and when i open the dialog box with out pressing the shift key small letters are apperaring and if I press shift key on the keyboard after opening the dialog box and click on the button i could see the capital letter on the button but my reqirement is when i click shift key on my keyboard after opening the dialog box i shold be able to see capital letters on all the buttons without clicking them my drawitem function is as follow: void MybutCls::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { ::DrawFrameControl(lpDrawItemStruct->hDC, &lpDrawItemStruct->rcItem, DFC_BUTTON, BS_PUSHBUTTON); int iSaveDC; CDC* pDC; pDC=CDC::FromHandle(lpDrawItemStruct->hDC); VERIFY(pDC); short caps=GetKeyState(20); if((0x8000 ==(0x8000 & GetKeyState(16))&& !caps)||(0x8000 !=(0x8000 & GetKeyState(16))&& caps)) { if(lpDrawItemStruct->CtlID==IDC_BUTTON65) ::DrawText(lpDrawItemStruct->hDC,"A",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER); if(lpDrawItemStruct->CtlID==IDC_BUTTON66) ::DrawText(lpDrawItemStruct->hDC,"B",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER); if(lpDrawItemStruct->CtlID==IDC_BUTTON67) ::DrawText(lpDrawItemStruct->hDC,"C",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER); } if((0x8000 ==(0x8000 & GetKeyState(16))&& caps)||(0x8000 !=(0x8000 & GetKeyState(16))&& !caps)) { if(lpDrawItemStruct->CtlID==IDC_BUTTON65) ::DrawText(lpDrawItemStruct->hDC,"a",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER); if(lpDrawItemStruct->CtlID==IDC_BUTTON66) ::DrawText(lpDrawItemStruct->hDC,"b",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER); if(lpDrawItemStruct->CtlID==IDC_BUTTON67) ::DrawText(lpDrawItemStruct->hDC,"c",1,&lpDrawItemStruct->rcItem, DT_SINGLELINE|DT_VCENTER|DT_CENTER); } iSaveDC=pDC->SaveDC(); pDC->RestoreDC(iSaveDC); // Invalidate(FALSE); }