CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2008
    Posts
    29

    Header in MDIChildFrameWnd

    I'd like to have a header bar in an mdichildframewnd which displays a title for the current view. I'd like a toolbar to go below this.

    I can create this bar overiding ondraw in a CView, but wondered if I could directly draw in the CMDIChildFrameWnd and get everything else to go below it? Using a CView involves a lot of refactoring which I'd like to avoid.

    The result would be something like this:

    -----------------------------------------------------
    | Header
    -----------------------------------------------------
    | btn1 btn2 btn3
    -----------------------------------------------------

    The top row is my custom drawn header and the second row is a CToolBar

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

    Re: Header in MDIChildFrameWnd

    Why don't you want to use the CMDIChildFrameWnd title bar to display current view title?
    Victor Nijegorodov

  3. #3
    Join Date
    Dec 2008
    Posts
    29

    Re: Header in MDIChildFrameWnd

    The child frame will be maximised. I'd a nice big label to show the user where they are. It has a different background color and I'd like to put an icon there too eventually.

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

    Re: Header in MDIChildFrameWnd

    Quote Originally Posted by rioch View Post
    The child frame will be maximised.
    In this case the text is displayed on the MainFrame title bar!
    Victor Nijegorodov

  5. #5
    Join Date
    Dec 2008
    Posts
    29

    Re: Header in MDIChildFrameWnd

    I think you've misunderstood me. I'd like the same as what is in the attached project, but without using views.

    Well without views isn't totally true. The problem is that I don't want to use more than a single view. The view needs to contain dialog resources/other views, and I want them all below the top label bar.

    Additionally, I'd like a toolbar to go below that label. I've seen an answer for this somewhere (well at least to get the toolbar on the view). I'm sure it's possible to move it afterwards (hopefully).
    Attached Files Attached Files

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

    Re: Header in MDIChildFrameWnd

    Could you post a screenshot (since I have no time to test this project)?
    Victor Nijegorodov

  7. #7
    Join Date
    Dec 2008
    Posts
    29

    Re: Header in MDIChildFrameWnd

    This is the screenshot. The label bit is custom drawn (no CStatic is involved).
    Attached Images Attached Images

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

    Re: Header in MDIChildFrameWnd

    I think you should not draw in CView yourself. Nor in CMDIChildFrameWnd.
    Just add a dialogbar to the CMDIChildFrameWnd and doc it on top.
    Victor Nijegorodov

  9. #9
    Join Date
    Dec 2008
    Posts
    29

    Re: Header in MDIChildFrameWnd

    The CDialogBar works great! Thanks. How can I set it's background colour?

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

    Re: Header in MDIChildFrameWnd

    Try OnEraseBkgnd or OnCtlColor
    Victor Nijegorodov

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