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. under text color not changed

under text color not changed

Scheduled Pinned Locked Moved C / C++ / MFC
help
6 Posts 4 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

    plz solve my problem as i change the color of static control but as it contain text so under text it does not change color i use folloowing code to change color HBRUSH CAdmin::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); { if(nCtlColor== CTLCOLOR_STATIC ) hbr=CreateSolidBrush(RGB(0,100,0)); } return hbr; } Please mail me

    stefanmihaimogaS S V 3 Replies Last reply
    0
    • Y yogendra kaushik

      plz solve my problem as i change the color of static control but as it contain text so under text it does not change color i use folloowing code to change color HBRUSH CAdmin::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); { if(nCtlColor== CTLCOLOR_STATIC ) hbr=CreateSolidBrush(RGB(0,100,0)); } return hbr; } Please mail me

      stefanmihaimogaS Offline
      stefanmihaimogaS Offline
      stefanmihaimoga
      wrote on last edited by
      #2

      Please have a look on Ali Rafiee's Yet Another Transparent Static Control[^] Good luck!

      Y 1 Reply Last reply
      0
      • Y yogendra kaushik

        plz solve my problem as i change the color of static control but as it contain text so under text it does not change color i use folloowing code to change color HBRUSH CAdmin::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); { if(nCtlColor== CTLCOLOR_STATIC ) hbr=CreateSolidBrush(RGB(0,100,0)); } return hbr; } Please mail me

        S Offline
        S Offline
        Sarath C
        wrote on last edited by
        #3

        I didnt sea any problems with you code.

        yogendra kaushik wrote:

        as i change the color of static control but as it contain text so under text it does not change color i use folloowing code to change color

        I didnt get you actually can you be more specific? SaRath.
        "Do Next Thing..." Understanding State Pattern in C++

        1 Reply Last reply
        0
        • stefanmihaimogaS stefanmihaimoga

          Please have a look on Ali Rafiee's Yet Another Transparent Static Control[^] Good luck!

          Y Offline
          Y Offline
          yogendra kaushik
          wrote on last edited by
          #4

          it will transparent all dialog box Please mail me

          1 Reply Last reply
          0
          • Y yogendra kaushik

            plz solve my problem as i change the color of static control but as it contain text so under text it does not change color i use folloowing code to change color HBRUSH CAdmin::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); { if(nCtlColor== CTLCOLOR_STATIC ) hbr=CreateSolidBrush(RGB(0,100,0)); } return hbr; } Please mail me

            V Offline
            V Offline
            Viorel
            wrote on last edited by
            #5

            Maybe you should try this?

            HBRUSH CAdmin::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
            {
                HBRUSH hbr;
                if(nCtlColor == CTLCOLOR_STATIC )
                {
                    hbr=CreateSolidBrush(RGB(0,100,0));
                    pDC->SetBkColor(RGB(0,100,0));
                    //for text colour, also use this: pDC->SetTextColor(RGB(0,0,0));
                }
                else
                {
                    hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
                }
                return hbr;
            }
            
            Y 1 Reply Last reply
            0
            • V Viorel

              Maybe you should try this?

              HBRUSH CAdmin::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
              {
                  HBRUSH hbr;
                  if(nCtlColor == CTLCOLOR_STATIC )
                  {
                      hbr=CreateSolidBrush(RGB(0,100,0));
                      pDC->SetBkColor(RGB(0,100,0));
                      //for text colour, also use this: pDC->SetTextColor(RGB(0,0,0));
                  }
                  else
                  {
                      hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
                  }
                  return hbr;
              }
              
              Y Offline
              Y Offline
              yogendra kaushik
              wrote on last edited by
              #6

              thank s a lot .................again Please mail me

              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