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. Ownerdraw CProgressCtrl with XP Themes

Ownerdraw CProgressCtrl with XP Themes

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
6 Posts 2 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.
  • M Offline
    M Offline
    madmax0001
    wrote on last edited by
    #1

    Hi, I have derived a class from CProgressCtrl. In OnPaint() I do my painting of the current progress which works fine. But there is a problem when the application uses XP themes: There is no border drawn around the control. I can draw the border myself, but then I got problems with win2000 (-> 2 borders). Does anyone know how to enable the border for a ownerdraw progress control ? thanks

    M 1 Reply Last reply
    0
    • M madmax0001

      Hi, I have derived a class from CProgressCtrl. In OnPaint() I do my painting of the current progress which works fine. But there is a problem when the application uses XP themes: There is no border drawn around the control. I can draw the border myself, but then I got problems with win2000 (-> 2 borders). Does anyone know how to enable the border for a ownerdraw progress control ? thanks

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

      You use DrawThemeBackground() to paint a themed control. For a progress bar, call it with the PP_BAR part to draw the border/background, then call it with the PP_CHUNK part to draw the progress indicator.

      --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ VB > soccer

      M 1 Reply Last reply
      0
      • M Michael Dunn

        You use DrawThemeBackground() to paint a themed control. For a progress bar, call it with the PP_BAR part to draw the border/background, then call it with the PP_CHUNK part to draw the progress indicator.

        --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ VB > soccer

        M Offline
        M Offline
        madmax0001
        wrote on last edited by
        #3

        Hi, thank you for your fast reply. I think DrawThemeBackground with PP_BAR will draw the "theme'd" border with round edges. What I want to do is a progress control that looks like a sunken static. The control should just look like a non themed control.

        M 1 Reply Last reply
        0
        • M madmax0001

          Hi, thank you for your fast reply. I think DrawThemeBackground with PP_BAR will draw the "theme'd" border with round edges. What I want to do is a progress control that looks like a sunken static. The control should just look like a non themed control.

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

          ah, in that case I would recommend just drawing the entire control (border and all) so it looks consistent across all OSes.

          --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ VB > soccer

          M 1 Reply Last reply
          0
          • M Michael Dunn

            ah, in that case I would recommend just drawing the entire control (border and all) so it looks consistent across all OSes.

            --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ VB > soccer

            M Offline
            M Offline
            madmax0001
            wrote on last edited by
            #5

            Yes, ok that's what I want to do. But 1.) Win2000 and 2.) Win XP with DEACTIVATED themes draw the border alone. I can't prevent this. And 3.) Windows XP with themes ACTIVATED doesn't draw the border. So if I put some code in the OnPait Proc. to draw a border, the control looks fine in condition 3.). But in condition 1.) + 2.) I got two borders: The one that I draw myself and the one that the OS draw. So I don't know how to solve this...

            M 1 Reply Last reply
            0
            • M madmax0001

              Yes, ok that's what I want to do. But 1.) Win2000 and 2.) Win XP with DEACTIVATED themes draw the border alone. I can't prevent this. And 3.) Windows XP with themes ACTIVATED doesn't draw the border. So if I put some code in the OnPait Proc. to draw a border, the control looks fine in condition 3.). But in condition 1.) + 2.) I got two borders: The one that I draw myself and the one that the OS draw. So I don't know how to solve this...

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

              Oh, sorry, I didn't finish my thought in my earlier post. It would probably be easier to draw the entire thing yourself (that's where I was going with the "so it looks the same on all OSes"). Use some other control like a button that has an owner-draw style, and then do all the drawing in response to the WM_DRAWITEM message sent by the control.

              --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ VB > soccer

              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