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. CheckBox and Static control problem

CheckBox and Static control problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++
8 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.
  • D Offline
    D Offline
    Dhiraj kumar Saini
    wrote on last edited by
    #1

    Hello, I am working on an mfc application. In it I am using a static control and a checkbox. I am using a Picture control on top of it i have placed the checkbox and static control. The problem is that the background of checkbox and static control is not tranparent as a result of which the picture colour and background colours of the controls are not matching.. please help me. Thanks & regards. Dhiraj Kumar Saini

    G A 2 Replies Last reply
    0
    • D Dhiraj kumar Saini

      Hello, I am working on an mfc application. In it I am using a static control and a checkbox. I am using a Picture control on top of it i have placed the checkbox and static control. The problem is that the background of checkbox and static control is not tranparent as a result of which the picture colour and background colours of the controls are not matching.. please help me. Thanks & regards. Dhiraj Kumar Saini

      G Offline
      G Offline
      gothic_coder
      wrote on last edited by
      #2

      You might want this.

      case WM_CTLCOLORDLG:
      case WM_CTLCOLORSTATIC:
      {
      HDC hdc = (HDC) wParam;
      HWND hwndStatic = (HWND) lParam;
      HBRUSH hbrBkcolor = (HBRUSH)GetStockObject(NULL_BRUSH);

      if (hwndStatic == GetDlgItem(hWnd, IDC\_STATIC\_CONTROL))
      {
      	SetBkMode(hdc, TRANSPARENT);
      	return (LRESULT) hbrBkcolor;
      }
          break;
      

      }

      Same stuff do with your Check Box also.. Hope this help.

      D 1 Reply Last reply
      0
      • D Dhiraj kumar Saini

        Hello, I am working on an mfc application. In it I am using a static control and a checkbox. I am using a Picture control on top of it i have placed the checkbox and static control. The problem is that the background of checkbox and static control is not tranparent as a result of which the picture colour and background colours of the controls are not matching.. please help me. Thanks & regards. Dhiraj Kumar Saini

        A Offline
        A Offline
        AtomAnt
        wrote on last edited by
        #3

        Greets. You could try handling the WM_CTLCOLOR (or WM_CTLCOLORBTN and/or WM_CTLCOLORSTATIC) messages in the parent window and return a NULL brush. Am not sure that would work, haven't tried it but it's worth a shot.

        AtomAnt - If God wanted man to code, man would have been born without the need to sleep.

        1 Reply Last reply
        0
        • G gothic_coder

          You might want this.

          case WM_CTLCOLORDLG:
          case WM_CTLCOLORSTATIC:
          {
          HDC hdc = (HDC) wParam;
          HWND hwndStatic = (HWND) lParam;
          HBRUSH hbrBkcolor = (HBRUSH)GetStockObject(NULL_BRUSH);

          if (hwndStatic == GetDlgItem(hWnd, IDC\_STATIC\_CONTROL))
          {
          	SetBkMode(hdc, TRANSPARENT);
          	return (LRESULT) hbrBkcolor;
          }
              break;
          

          }

          Same stuff do with your Check Box also.. Hope this help.

          D Offline
          D Offline
          Dhiraj kumar Saini
          wrote on last edited by
          #4

          I am using MFC and not win32 . Please help me with MFC code as i dont know win32. Thanks

          G 1 Reply Last reply
          0
          • D Dhiraj kumar Saini

            I am using MFC and not win32 . Please help me with MFC code as i dont know win32. Thanks

            G Offline
            G Offline
            gothic_coder
            wrote on last edited by
            #5

            May be this help.. http://bobmoore.mvps.org/Win32/w32tip37.htm[^]

            D 1 Reply Last reply
            0
            • G gothic_coder

              May be this help.. http://bobmoore.mvps.org/Win32/w32tip37.htm[^]

              D Offline
              D Offline
              Dhiraj kumar Saini
              wrote on last edited by
              #6

              Its not working. Please tell me whats the problem.

              I 1 Reply Last reply
              0
              • D Dhiraj kumar Saini

                Its not working. Please tell me whats the problem.

                I Offline
                I Offline
                Iain Clarke Warrior Programmer
                wrote on last edited by
                #7

                Please tell him what is not working. Unless one of you two has psychic powers, you need to help him to help you. Iain.

                G 1 Reply Last reply
                0
                • I Iain Clarke Warrior Programmer

                  Please tell him what is not working. Unless one of you two has psychic powers, you need to help him to help you. Iain.

                  G Offline
                  G Offline
                  gothic_coder
                  wrote on last edited by
                  #8

                  :^) I also think so...

                  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