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. Set TitleBAr

Set TitleBAr

Scheduled Pinned Locked Moved C / C++ / MFC
4 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
    kumar sanghvi
    wrote on last edited by
    #1

    Hi, Is it possible to change the height of titlebar of all Dialogs which are used only in my application using WM_NCCALCSIZE or DrawCaption() and if there is any better way..pls let me know....please suggest me any sample which does the same....

    K 1 Reply Last reply
    0
    • K kumar sanghvi

      Hi, Is it possible to change the height of titlebar of all Dialogs which are used only in my application using WM_NCCALCSIZE or DrawCaption() and if there is any better way..pls let me know....please suggest me any sample which does the same....

      K Offline
      K Offline
      kumar sanghvi
      wrote on last edited by
      #2

      Hi, i tried using BEGIN_MESSAGE_MAP(CMyDlg, CDialog) ON_WM_NCCALCSIZE() END_MESSAGE_MAP() void CMyDlg::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp) { CRect& rc = (CRect&)lpncsp->rgrc[0]; rc.top += 20; // Increase the height of tittle bar CWnd::OnNcCalcSize(bCalcValidRects, lpncsp); } but the increased height of the title bar is not shown properly...and even the caption and the close button were not increased...(title bar was increased but not shown properly..)

      D B 2 Replies Last reply
      0
      • K kumar sanghvi

        Hi, i tried using BEGIN_MESSAGE_MAP(CMyDlg, CDialog) ON_WM_NCCALCSIZE() END_MESSAGE_MAP() void CMyDlg::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp) { CRect& rc = (CRect&)lpncsp->rgrc[0]; rc.top += 20; // Increase the height of tittle bar CWnd::OnNcCalcSize(bCalcValidRects, lpncsp); } but the increased height of the title bar is not shown properly...and even the caption and the close button were not increased...(title bar was increased but not shown properly..)

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        kumar sanghvi wrote:

        rc.top += 20; // Increase the height of tittle bar

        This looks as though it would shrink the height. Why not use the InflateRect() method?

        "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        1 Reply Last reply
        0
        • K kumar sanghvi

          Hi, i tried using BEGIN_MESSAGE_MAP(CMyDlg, CDialog) ON_WM_NCCALCSIZE() END_MESSAGE_MAP() void CMyDlg::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp) { CRect& rc = (CRect&)lpncsp->rgrc[0]; rc.top += 20; // Increase the height of tittle bar CWnd::OnNcCalcSize(bCalcValidRects, lpncsp); } but the increased height of the title bar is not shown properly...and even the caption and the close button were not increased...(title bar was increased but not shown properly..)

          B Offline
          B Offline
          Bacon Ultimate Cheeseburger
          wrote on last edited by
          #4

          kumar sanghvi wrote:

          but the increased height of the title bar is not shown properly

          This is because you are changing the bounding rectangle of the client area not the caption bar. The default window procedure will adjust this rectangle based on the height of the title bar, the height of the menu (if present) and any other non-client component managed by the window. You have however gotten one step close as you now have extra space reserved at the top of the window for your caption bar. The next step is to handle the WM_NCPAINT message and draw your custom caption bar with the desired height.

          I am a lean mean ground beef machine!!!

          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