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. Graphics
  4. DrawThemeBackground

DrawThemeBackground

Scheduled Pinned Locked Moved Graphics
comquestionannouncement
5 Posts 2 Posters 13 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.
  • PJ ArendsP Offline
    PJ ArendsP Offline
    PJ Arends
    wrote on last edited by
    #1

    [previously posted on the VC board, no satisfactory answer there so I thought I would repost it on this new forum that may be better suited] Hey all, I am busy updating my CFileEditCtrl class[^] to support XP themes. As part of that update I want the browse button to be drawn the same as a combo box dropdown button, except without the arrow. Using DrawThemeBackground automatically draws the arrow.

    HTHEME hTheme = OpenThemeData(*this, L"COMBOBOX");
    LRESULT ret = DrawThemeBackground(hTheme, dc, CP_DROPDOWNBUTTON, CBXS_NORMAL, CRect(10, 10, 27, 27), NULL);

    Is there any option that will draw the themed button background without the arrow? I tried using the scroll bar's thumb as the background as it works fine in silver colour, but not in blue or green.


    You may be right
    I may be crazy
    -- Billy Joel --

    Within you lies the power for good, use it!!!

    Within you lies the power for good; Use it!

    M 1 Reply Last reply
    0
    • PJ ArendsP PJ Arends

      [previously posted on the VC board, no satisfactory answer there so I thought I would repost it on this new forum that may be better suited] Hey all, I am busy updating my CFileEditCtrl class[^] to support XP themes. As part of that update I want the browse button to be drawn the same as a combo box dropdown button, except without the arrow. Using DrawThemeBackground automatically draws the arrow.

      HTHEME hTheme = OpenThemeData(*this, L"COMBOBOX");
      LRESULT ret = DrawThemeBackground(hTheme, dc, CP_DROPDOWNBUTTON, CBXS_NORMAL, CRect(10, 10, 27, 27), NULL);

      Is there any option that will draw the themed button background without the arrow? I tried using the scroll bar's thumb as the background as it works fine in silver colour, but not in blue or green.


      You may be right
      I may be crazy
      -- Billy Joel --

      Within you lies the power for good, use it!!!

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      I'd guess your problem is you're using the wrong theme data. Why draw a plain button using a combo box theme? This article might be helpful: Color Picker for WTL with XP themes[^] - the code there draws a button with a dropdown arrow, I imagine you could use the same code, just leave out the arrow drawing.

      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

      PJ ArendsP 1 Reply Last reply
      0
      • M Michael Dunn

        I'd guess your problem is you're using the wrong theme data. Why draw a plain button using a combo box theme? This article might be helpful: Color Picker for WTL with XP themes[^] - the code there draws a button with a dropdown arrow, I imagine you could use the same code, just leave out the arrow drawing.

        --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

        PJ ArendsP Offline
        PJ ArendsP Offline
        PJ Arends
        wrote on last edited by
        #3

        Thanks for the hint, but that is not what I am after.

        Michael Dunn wrote:

        Why draw a plain button using a combo box theme?

        I do not want a plain button. In the default blue theme a plain button has a whitish background with a dark blue border and it shows hot by drawing a yellow box around the client area. A combo box button is different shades of blue depending on it's state. My control is supposed to have the look and feel of a combo box, but the button is supposed to bring up a dialog, not just drop down a list box. As such I want to be able to draw my own icon on the button instead of the arrow. ie I want to draw a disk for saving files, a folder for opening files, a book for opening the windows address book, a printer for selecting a printer, an eye dropper for picking colours, etc. Maybe I am just picky, but there must be a way to draw a button using the same colours as a combobox button. I have no problem doing all the drawing in my own code, I just need to know which APIs I have to call to get the colours needed, how to draw the borders so it matches the current theme and all the fun stuff like that. With a scroll bar thumb the thumb background and the grip are drawn seperately so it is possible to draw the thumb without a grip. I had thought I could use the thumb theme instead of the combo box button for what I want but unfortunately the borders are drawn differently so it just did not look right. If the combo box button had the same drawing principle as the scroll bar thumb and had seperate code for the background and the arrow I would be set, but it does not so I am screwed in my quest.


        You may be right
        I may be crazy
        -- Billy Joel --

        Within you lies the power for good, use it!!!

        Within you lies the power for good; Use it!

        M 1 Reply Last reply
        0
        • PJ ArendsP PJ Arends

          Thanks for the hint, but that is not what I am after.

          Michael Dunn wrote:

          Why draw a plain button using a combo box theme?

          I do not want a plain button. In the default blue theme a plain button has a whitish background with a dark blue border and it shows hot by drawing a yellow box around the client area. A combo box button is different shades of blue depending on it's state. My control is supposed to have the look and feel of a combo box, but the button is supposed to bring up a dialog, not just drop down a list box. As such I want to be able to draw my own icon on the button instead of the arrow. ie I want to draw a disk for saving files, a folder for opening files, a book for opening the windows address book, a printer for selecting a printer, an eye dropper for picking colours, etc. Maybe I am just picky, but there must be a way to draw a button using the same colours as a combobox button. I have no problem doing all the drawing in my own code, I just need to know which APIs I have to call to get the colours needed, how to draw the borders so it matches the current theme and all the fun stuff like that. With a scroll bar thumb the thumb background and the grip are drawn seperately so it is possible to draw the thumb without a grip. I had thought I could use the thumb theme instead of the combo box button for what I want but unfortunately the borders are drawn differently so it just did not look right. If the combo box button had the same drawing principle as the scroll bar thumb and had seperate code for the background and the arrow I would be set, but it does not so I am screwed in my quest.


          You may be right
          I may be crazy
          -- Billy Joel --

          Within you lies the power for good, use it!!!

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          I see now... Unfortunately, the combo box theme only defines one part, CP_DROPDOWNBUTTON. If the button border, background, and arrow were separate parts, you could just draw the parts you wanted and leave out the arrow. But it doesn't look like the combo box was set up to do that. :|

          --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

          PJ ArendsP 1 Reply Last reply
          0
          • M Michael Dunn

            I see now... Unfortunately, the combo box theme only defines one part, CP_DROPDOWNBUTTON. If the button border, background, and arrow were separate parts, you could just draw the parts you wanted and leave out the arrow. But it doesn't look like the combo box was set up to do that. :|

            --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?

            PJ ArendsP Offline
            PJ ArendsP Offline
            PJ Arends
            wrote on last edited by
            #5

            Yeah, I figured that much out too, hence my question of is there a work around that will allow me to do what I want. Surely there must be a way, even if it ends up being a little convoluted. All I need is a pointer to the correct APIs. So far my searches in MSDN has led nowhere.


            You may be right
            I may be crazy
            -- Billy Joel --

            Within you lies the power for good, use it!!!

            Within you lies the power for good; Use it!

            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