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. OnPaint overriding?

OnPaint overriding?

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
3 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.
  • F Offline
    F Offline
    Fredrik
    wrote on last edited by
    #1

    Hi! How would the code for overriding the OnPaint() function look like? I have been trying to set the color of a slider I created with MFC. I managed to color it's background but didn't manage to change the slider "knob" or "path" color, how is this done? I also have a Combobox wich I would like to change the color of as well, but it didn't work out either. Then there's the frame of the window, I beieve I should override OnNcPaint() function for this but either I'm wrong or doig it wrong. =) And changing the color of the entire application menu would be very nice if I could do this too. Thanks in advance! /Fredrik

    M 1 Reply Last reply
    0
    • F Fredrik

      Hi! How would the code for overriding the OnPaint() function look like? I have been trying to set the color of a slider I created with MFC. I managed to color it's background but didn't manage to change the slider "knob" or "path" color, how is this done? I also have a Combobox wich I would like to change the color of as well, but it didn't work out either. Then there's the frame of the window, I beieve I should override OnNcPaint() function for this but either I'm wrong or doig it wrong. =) And changing the color of the entire application menu would be very nice if I could do this too. Thanks in advance! /Fredrik

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

      OnPaint() is the wrong way to do it. You can change the thumb and track colors pretty easily using custom draw. As for the combobox, look up the docs on CWnd::OnCtlColor().

      F 1 Reply Last reply
      0
      • M Michael Dunn

        OnPaint() is the wrong way to do it. You can change the thumb and track colors pretty easily using custom draw. As for the combobox, look up the docs on CWnd::OnCtlColor().

        F Offline
        F Offline
        Fredrik
        wrote on last edited by
        #3

        Ah, I have tried to do custom draw but I don't get it to work, how do I make menu and the other things(mentioned earlier) with custom draw, I could use some samples of code, since I seem to be doing something wrong when I don't get it to work. =) Thanks, /Fredrik

        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