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. Invoke WM_NCPAINT

Invoke WM_NCPAINT

Scheduled Pinned Locked Moved C / C++ / MFC
comquestion
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.
  • N Offline
    N Offline
    Naveen
    wrote on last edited by
    #1

    Hi, I have a List control and I have to change the border color of it dynamically such as, on mouse hover, on focus etc. So I handled the WM_NCPAINT and draw the border with my own color. But when I have to change the color, how will I invoke the WM_NCPAINT. Can I send that message directly? Or is there any other functions that invokes this message indireclty? N.B - I need to paint only the non client area. Thanks Naveen [OpenedFileFinder]

    S N 2 Replies Last reply
    0
    • N Naveen

      Hi, I have a List control and I have to change the border color of it dynamically such as, on mouse hover, on focus etc. So I handled the WM_NCPAINT and draw the border with my own color. But when I have to change the color, how will I invoke the WM_NCPAINT. Can I send that message directly? Or is there any other functions that invokes this message indireclty? N.B - I need to paint only the non client area. Thanks Naveen [OpenedFileFinder]

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      If you're using MFC try something like this:

      m_ctl.RedrawWindow(NULL, NULL, RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_UPDATENOW);

      For raw Win32:

      RedrawWindow(m_hWnd, NULL, NULL, RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_UPDATENOW);

      Steve

      N 1 Reply Last reply
      0
      • N Naveen

        Hi, I have a List control and I have to change the border color of it dynamically such as, on mouse hover, on focus etc. So I handled the WM_NCPAINT and draw the border with my own color. But when I have to change the color, how will I invoke the WM_NCPAINT. Can I send that message directly? Or is there any other functions that invokes this message indireclty? N.B - I need to paint only the non client area. Thanks Naveen [OpenedFileFinder]

        N Offline
        N Offline
        Nibu babu thomas
        wrote on last edited by
        #3

        Naveen.R wrote:

        Can I send that message directly? Or is there any other functions that invokes this message indireclty?

        Call SetWindowPos with SWP_DRAWFRAME.


        Nibu thomas A Developer Code must be written to be read, not by the compiler, but by another human being. http:\\nibuthomas.wordpress.com

        N 1 Reply Last reply
        0
        • S Stephen Hewitt

          If you're using MFC try something like this:

          m_ctl.RedrawWindow(NULL, NULL, RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_UPDATENOW);

          For raw Win32:

          RedrawWindow(m_hWnd, NULL, NULL, RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_UPDATENOW);

          Steve

          N Offline
          N Offline
          Naveen
          wrote on last edited by
          #4

          But in this case paint message is also generated. I want to invoke only the WM_NCPAINT message.

          nave [OpenedFileFinder]

          1 Reply Last reply
          0
          • N Nibu babu thomas

            Naveen.R wrote:

            Can I send that message directly? Or is there any other functions that invokes this message indireclty?

            Call SetWindowPos with SWP_DRAWFRAME.


            Nibu thomas A Developer Code must be written to be read, not by the compiler, but by another human being. http:\\nibuthomas.wordpress.com

            N Offline
            N Offline
            Naveen
            wrote on last edited by
            #5

            Thanks Nibu. It worked.

            nave [OpenedFileFinder]

            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