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. control color

control color

Scheduled Pinned Locked Moved C / C++ / MFC
5 Posts 5 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.
  • Y Offline
    Y Offline
    yogendra kaushik
    wrote on last edited by
    #1

    can be change button color if yes plz send me code for his Please mail me

    S L H 3 Replies Last reply
    0
    • Y yogendra kaushik

      can be change button color if yes plz send me code for his Please mail me

      S Offline
      S Offline
      see me
      wrote on last edited by
      #2

      I think it is better to derive a class for the button from CButton and override DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct).Here u can draw the button, and can give color u wanted to your button. :cool: yours faithfully ajeeshcv

      1 Reply Last reply
      0
      • Y yogendra kaushik

        can be change button color if yes plz send me code for his Please mail me

        L Offline
        L Offline
        Laxman Auti
        wrote on last edited by
        #3

        yogendra kaushik wrote:

        can be change button color

        Have a look on CBitmapButton class Knock out 't' from can't, You can if you think you can :cool:

        1 Reply Last reply
        0
        • Y yogendra kaushik

          can be change button color if yes plz send me code for his Please mail me

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          you can derived CButton and use from WM_DRAWITEM of course you need to set OwnerDrae for button from property window_**


          **_

          whitesky


          A 1 Reply Last reply
          0
          • H Hamid Taebi

            you can derived CButton and use from WM_DRAWITEM of course you need to set OwnerDrae for button from property window_**


            **_

            whitesky


            A Offline
            A Offline
            ANIL KUMAR SHARMA INDIA
            wrote on last edited by
            #5

            I like to autosize the owner draw button depending upon the text that it load dynamically based on localization strings. so some strings are large than others. Keeping this I override DrawItem in the inherited class from CButton. (In below i tried unconditionally to increase the size at runtime, once it is achived, i think i can go ahead for resize code) The sample code is below void CMyGraphicButton::DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct) { CString cs; CString cslong; ASSERT(lpDrawItemStruct->CtlType == ODT_BUTTON); LPCTSTR lpszText = (LPCTSTR) lpDrawItemStruct->itemData; if (!lpszText || lpszText == (LPCTSTR)-1) { GetWindowText (cs); } else cs = lpszText; // now i m trying to resize , so let try to increase the size of button unconditioally // I get //lpDrawItemStruct>rcItem.left =0 //lpDrawItemStruct>rcItem.right =75 //lpDrawItemStruct>rcItem.top = 0 //lpDrawItemStruct>rcItem.bottom = 25 //As my button is on extreme right side of dialog so i tried to extend/increase the size of // button of the left side as follows lpDrawItemStruct>rcItem.left -= 25 ; // but the above causes the text to be moved on right side insead of resize/increase the //button size. Any idea or help is appriciated. Thanks Anil }

            [AKS]

            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