Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. help in DrawItem()

help in DrawItem()

Scheduled Pinned Locked Moved C / C++ / MFC
help
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tripura K
    wrote on last edited by
    #1

    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); }

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups