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. ListBox Question (non-MFC)

ListBox Question (non-MFC)

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

    I have created a List box using CreateWindow in my app's client area. Is there any way I can make the background of my list box transparent so that it is the same color as the background of my main window? Thanks in advance, Paddy.

    D 1 Reply Last reply
    0
    • P Paddy

      I have created a List box using CreateWindow in my app's client area. Is there any way I can make the background of my list box transparent so that it is the same color as the background of my main window? Thanks in advance, Paddy.

      D Offline
      D Offline
      Dominik Reichl
      wrote on last edited by
      #2

      Get the handle to the device context of the listbox (HDC) and use the Win32 function SetBkColor to set the color you want. For more, see function SetBkColor in MSDN. If you would like to use the same color as in your main window, you first have to get the standard color of your window, which is usually done by a call to GetSysColor. Hope this helps, -Dominik

      P P 2 Replies Last reply
      0
      • D Dominik Reichl

        Get the handle to the device context of the listbox (HDC) and use the Win32 function SetBkColor to set the color you want. For more, see function SetBkColor in MSDN. If you would like to use the same color as in your main window, you first have to get the standard color of your window, which is usually done by a call to GetSysColor. Hope this helps, -Dominik

        P Offline
        P Offline
        palbano
        wrote on last edited by
        #3

        ummm i don't believe that 'transparent' is the same as setting the background color to the same as the background window. Not to mention how do you know what window and what background color it is, and what about if it has something in it... or am I totaly lost?

        "No matter where you go, there your are..." - Buckaoo Banzi

        -pete

        P 1 Reply Last reply
        0
        • D Dominik Reichl

          Get the handle to the device context of the listbox (HDC) and use the Win32 function SetBkColor to set the color you want. For more, see function SetBkColor in MSDN. If you would like to use the same color as in your main window, you first have to get the standard color of your window, which is usually done by a call to GetSysColor. Hope this helps, -Dominik

          P Offline
          P Offline
          Paddy
          wrote on last edited by
          #4

          Thanks that exactly what I was looking for. I knew there was some simple way of doing it but I didn't know what to look for! Paddy.

          1 Reply Last reply
          0
          • P palbano

            ummm i don't believe that 'transparent' is the same as setting the background color to the same as the background window. Not to mention how do you know what window and what background color it is, and what about if it has something in it... or am I totaly lost?

            "No matter where you go, there your are..." - Buckaoo Banzi

            -pete

            P Offline
            P Offline
            Paddy
            wrote on last edited by
            #5

            I understand what you are saying, they are not the same thing but for this particular case changing the background colour will work fine for me. Thanks, Paddy.

            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