CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Apr 2000
    Location
    Washington (state)
    Posts
    125

    ToolBar WON'T Re-size

    I use CToolBarCtrl::HideButton to hide or reveal a button on a toolbar. I cannot seem to make the toolbar resize itself to fit the buttons that are actually visible on the toolbar after the hide/reveal function. I have tried:
    CToolBar::Invalidate
    CToolBarCtrl::Invalidate
    CToolBarCtrl::AutoSize
    CToolBar::SetHeight

    Example Befoe Hide:


    Example After Hide:


    Example After left-click on toolbar:


    How can I get it to resize (like third example)???

  2. #2
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: ToolBar WON'T Re-size

    Tried calling CToolBarCtrl::AutoSize after the HideButton ?

  3. #3
    Join Date
    Apr 2000
    Location
    Washington (state)
    Posts
    125

    Re: ToolBar WON'T Re-size

    Thanks for the suggestion, but in my original post I said that I had already tried these functions:
    CToolBar::Invalidate
    CToolBarCtrl::Invalidate
    CToolBarCtrl::AutoSize
    CToolBar::SetHeight

    In fact I got the idea to try CToolBarCtrl::AutoSize from another post you made on this forum... Unfortunately, it doesn't seem to work for me...

  4. #4
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: ToolBar WON'T Re-size

    Sorry. Didn't notice that.
    This code should do it..
    Code:
    m_wndToolBar.GetToolBarCtrl().HideButton(ID_FILE_OPEN);
    m_wndToolBar.GetToolBarCtrl().GetParentFrame()->RecalcLayout();
    Last edited by kirants; November 13th, 2008 at 06:25 PM.

  5. #5
    Join Date
    Apr 2000
    Location
    Washington (state)
    Posts
    125

    Thumbs up Re: ToolBar WON'T Re-size

    THANKS kirants!!! That did it!

    Now if I can just figure out how to mark the thread as "Resolved"...
    VictorN Suggested I do this, but for some reason I don't have the fifth item in the Thread Tools menu...

    This is what it looks like for me...


    Any thoughts on how I can get at the "Mark Thread as Resolved" feature???

  6. #6
    Join Date
    Feb 2000
    Location
    San Diego, CA
    Posts
    10,354

    Re: ToolBar WON'T Re-size

    Cool ! Isn't it amazing sometimes the solutions can be so simple and sweet !

    As for the resolved thing, it seems to have disappeared for me too. Recently the forum s/w got upgraded. Wondering if this disappearance has something to do with it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured