CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2013
    Location
    USA
    Posts
    30

    MFCPropertySheet and MFCToolBar

    Is it possible to add a MFCToolBar to the header of a MFCPropertySheet because every page which will be dynamically added during runtime will be using the same toolbar and if it IS possible I would much rather do it this way instead of putting the same toolbar on every page. I have enabled the header with height of 48 and have implemented the MFCToolBar code first in the constructor then in OnCreate. It does not generate any errors during compiling or at runtime however the toolbar does not show.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: MFCPropertySheet and MFCToolBar

    Quote Originally Posted by RobNHood View Post
    ... I have enabled the header with height of 48 and have implemented the MFCToolBar code first in the constructor then in OnCreate. It does not generate any errors during compiling or at runtime however the toolbar does not show.
    Could you show your code?
    Last edited by VictorN; November 5th, 2013 at 05:21 PM.
    Victor Nijegorodov

  3. #3
    Join Date
    Jul 2013
    Location
    USA
    Posts
    30

    Re: MFCPropertySheet and MFCToolBar

    IN HEADER

    Code:
    CMFCToolBar    m_wndToolBar;
    IN CONSTRUCTOR

    Code:
    EnablePageHeader(48);
    IN OnCreate

    Code:
     if(!m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE,IDR_TOOLBAR )){
    TRACE0("Failed to create toolbar\n\n");
    return FALSE;
    }
    
    m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_ANY));
    
    m_wndToolBar.LoadToolBar(IDR_TOOLBAR,0,0,TRUE);
    m_wndToolBar.CleanUpLockedImages();
    m_wndToolBar.LoadBitmap(IDB_TOOLBAR,0,0,TRUE);
    m_wndToolBar.SetOwner(this);
    m_wndToolBar.SetRouteCommandsViaFrame(FALSE);
    
    CSize sizeToolBar = m_wndToolBar.CalcFixedLayout(FALSE,TRUE);
    m_wndToolBar.SetWindowPos(NULL,10,10,sizeToolBar.cx + 10, sizeToolBar.cy + 10,SWP_NOACTIVATE | SWP_NOZORDER);

  4. #4
    Join Date
    Jul 2013
    Location
    USA
    Posts
    30

    Re: MFCPropertySheet and MFCToolBar

    I just went ahead and embedded the CMFCPropertySheet inside a dialog and then created the CMFCToolBar from OnInitDialog and it works fine.

Tags for this Thread

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