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. Transparent background and colored text for radio button

Transparent background and colored text for radio button

Scheduled Pinned Locked Moved C / C++ / MFC
6 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.
  • K Offline
    K Offline
    kiranin
    wrote on last edited by
    #1

    I am trying for a transpaerent radio button with colored text, i tried so many options by overwriting WM_CTRL_CLR or WM_ERASE_BKGND etcc.. its working for static and buttons but radio buttons not working... can any throw a light on this.. how we can do it

    N M P K 5 Replies Last reply
    0
    • K kiranin

      I am trying for a transpaerent radio button with colored text, i tried so many options by overwriting WM_CTRL_CLR or WM_ERASE_BKGND etcc.. its working for static and buttons but radio buttons not working... can any throw a light on this.. how we can do it

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      From comctrl6,if theme enabled you cannot change the text color of the raido button usign the WM_CTLCOLOR color. AFAIK, one thing we can do is, disable theme only for radio button. After this your code in the CTL color will work. eg: SetWindowTheme( GetDlgItem( IDC_RAIOD_BTN_ID)->m_hWnd, L"", L"" ); where IDC_RAIOD_BTN_ID is the id of the radio button

      nave [My Articles] [My Blog]

      1 Reply Last reply
      0
      • K kiranin

        I am trying for a transpaerent radio button with colored text, i tried so many options by overwriting WM_CTRL_CLR or WM_ERASE_BKGND etcc.. its working for static and buttons but radio buttons not working... can any throw a light on this.. how we can do it

        M Offline
        M Offline
        Mohan Ramachandra
        wrote on last edited by
        #3

        Hope this may help 1.Create a CBrush member variable in Dialog class

        CBrush m_brush;

        2.In OnInitDialog, Create the brush with background color of the dialog

        m_brush.CreateSolidBrush(RGB(200,100,0));

        3.Handle the WM_CTLCOLOR message of the dialog and change the OnCtlColor function

        HBRUSH CTestRadioDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
        {
        if(pWnd->GetDlgCtrlID()==IDC_RADIO1)
        {
        // Text Background
        pDC->SetBkColor(RGB(200,100,0));
        // Text color
        pDC->SetTextColor(RGB(0,100,200));
        return m_brush;
        }
        return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
        }

        1 Reply Last reply
        0
        • K kiranin

          I am trying for a transpaerent radio button with colored text, i tried so many options by overwriting WM_CTRL_CLR or WM_ERASE_BKGND etcc.. its working for static and buttons but radio buttons not working... can any throw a light on this.. how we can do it

          P Offline
          P Offline
          Paresh Chitte
          wrote on last edited by
          #4

          Have you tried

          CDC::SetBkMode(TRANSPARENT)

          . Regards, Paresh.

          1 Reply Last reply
          0
          • K kiranin

            I am trying for a transpaerent radio button with colored text, i tried so many options by overwriting WM_CTRL_CLR or WM_ERASE_BKGND etcc.. its working for static and buttons but radio buttons not working... can any throw a light on this.. how we can do it

            M Offline
            M Offline
            Mohan Ramachandra
            wrote on last edited by
            #5

            What is the background of your dialog or window? A Image, or just filled with a color?

            1 Reply Last reply
            0
            • K kiranin

              I am trying for a transpaerent radio button with colored text, i tried so many options by overwriting WM_CTRL_CLR or WM_ERASE_BKGND etcc.. its working for static and buttons but radio buttons not working... can any throw a light on this.. how we can do it

              K Offline
              K Offline
              KarstenK
              wrote on last edited by
              #6

              you can also use the radio button without text and paint the text yourself or in another static.

              Press F1 for help or google it. Greetings from Germany

              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