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. Draw on the none-client area [modified]

Draw on the none-client area [modified]

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

    I want to draw on the none-client area(acturely on the title bar).So,I implement the WM_NCPAINT message by OnNcPaint(); But now,I wan to modify the title height to ajust a bitmap. What should I do? Thanks. GOOD LUCK

    J N 2 Replies Last reply
    0
    • K kcynic

      I want to draw on the none-client area(acturely on the title bar).So,I implement the WM_NCPAINT message by OnNcPaint(); But now,I wan to modify the title height to ajust a bitmap. What should I do? Thanks. GOOD LUCK

      J Offline
      J Offline
      Jason Teagle
      wrote on last edited by
      #2

      Calling OnNcPaint() directly won't work; you must let the system call it so that you know it has invalidated the right area. I'm not sure why it doesn't call your OnNcPaint() handler when going inactive; I suspect it is a bit of a loophole in the MFC framework whereby it doesn't behave consistently. Perhaps if you tell us why you are trying to paint in this area, we can suggest an alternative approach? Trying to override the system is always erratic at best {:v)

      K 1 Reply Last reply
      0
      • K kcynic

        I want to draw on the none-client area(acturely on the title bar).So,I implement the WM_NCPAINT message by OnNcPaint(); But now,I wan to modify the title height to ajust a bitmap. What should I do? Thanks. GOOD LUCK

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

        WM_NCCALSIZE..

        nave [OpenedFileFinder]

        K 1 Reply Last reply
        0
        • J Jason Teagle

          Calling OnNcPaint() directly won't work; you must let the system call it so that you know it has invalidated the right area. I'm not sure why it doesn't call your OnNcPaint() handler when going inactive; I suspect it is a bit of a loophole in the MFC framework whereby it doesn't behave consistently. Perhaps if you tell us why you are trying to paint in this area, we can suggest an alternative approach? Trying to override the system is always erratic at best {:v)

          K Offline
          K Offline
          kcynic
          wrote on last edited by
          #4

          I want to change the height of the title bar of a dialog.But I don't know how to do. Thanks.

          1 Reply Last reply
          0
          • N Naveen

            WM_NCCALSIZE..

            nave [OpenedFileFinder]

            K Offline
            K Offline
            kcynic
            wrote on last edited by
            #5

            But I don't know the right step. Thanks

            N 1 Reply Last reply
            0
            • K kcynic

              But I don't know the right step. Thanks

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

              Overide the WM_NCCALSIZE, and in the OnNcCalcSize() function, you will get rect of the dialog pstncsp->rgrc[0] And that rect contains you present client area. So if you wanne increase the nonclient area, decrease the client area. Say in your case you want to increase the no client area on the top. For that do do as follows.. void MyDlg::OnNcCalcSize( BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* pstncsp ) { CDialog::OnNcCalcSize( bCalcValidRects_i, pstncsp_i ); pstncsp_i->rgrc[0].top += 50;// Increases the non client area by 50 }

              nave [OpenedFileFinder]

              K 1 Reply Last reply
              0
              • N Naveen

                Overide the WM_NCCALSIZE, and in the OnNcCalcSize() function, you will get rect of the dialog pstncsp->rgrc[0] And that rect contains you present client area. So if you wanne increase the nonclient area, decrease the client area. Say in your case you want to increase the no client area on the top. For that do do as follows.. void MyDlg::OnNcCalcSize( BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* pstncsp ) { CDialog::OnNcCalcSize( bCalcValidRects_i, pstncsp_i ); pstncsp_i->rgrc[0].top += 50;// Increases the non client area by 50 }

                nave [OpenedFileFinder]

                K Offline
                K Offline
                kcynic
                wrote on last edited by
                #7

                It works well now,Thank you very much.

                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