I posted the following message to the Windows Forms FAQ forum but thought I would try here as well and see if this can be accomplished somehow using Essential Tools...
I have an application in which I would like to emulate the MDI behavior as seen in some of the Microsoft Office applications, particularly Word.
However I can't seem to figure out how to do this with the traditional MDI development in .NET.
I would like to have the following behavior as shown in Word 2000 for example:
1. Each MDI child is it's own complete window that shows in the task bar.
2. Merged menus and toolbars aren't needed (as shown in Word when no MDI child is loaded, all the menu/toolbar items stick around and just become disabled.
3. The list of MDI children appears in a Window list (however for my app I don't need to do any Arranging or Splitting).
4. When only one document is opened in Word, a Close Window button (a "X") appears on the right-hand side of the main menu bar. As soon as more than one document is opened, this System-like button disappears. There is no way to maximize or minimize the document within the 'parent'.
I have been able to programmatically duplicate the first three above by just using regular Windows Forms and having the 'child' be made up of User Controls and Panels that appear in the 'parent' form. And then behind the scenes I have an 'organizer' object that manages the Windows and things common between them.
But item #4 eludes me. Is this possible? Trying to have an 'always maximized' MDI child within each main window doesn't work as the system buttons will always appear no matter what (and will even allow you to Restore to a non-maximized state).
Do I have to somehow be able to fake it by having a regular button on the main menu to act like a System Close button? Is there anyway to add some sort of button BarItem that is part of a MainMenu toolbar that can be flush with the right end of the toolbar?
Thanks in advance for any pointers,
RPRamesh Praveen Syncfusion Team July 17, 2003 01:49 PM
I recommend that you use a mdi-child in a maximized state. So you would do the following for the child form to appear always maximized:
1) Set WindowState to Maximized.
2) Set MaximizeBox and MinimizeBox to false.
This will now show the child maximized to begin with. In fact the minimize and maximize buttons will not even be visible while using .net menus. I however noticed that in XPMenus the minimize/maximize buttons were not getting hidden, we will fix this in our next patch release.
DPDavid PalauJuly 17, 2003 02:13 PM
That's what I thought as well but I noticed that the Mininmize/Maximize buttons were showing up as well and even allowed a 'Restore' to normal size.
And then there was really no way for the user to maixmize it again.
I tried this with the MS supplied controls and not Tools however.
RPRamesh Praveen Syncfusion Team July 18, 2003 09:46 AM
I see that the .net menus seem to ignore those MinimizeBox, MaximizeBox settings when maximized. But, we will however be updating our xpmenus framework to take into account these settings, so you should consider using our menus instead of the .net ones (you probably already did?).
RPRamesh Praveen Syncfusion Team July 18, 2003 11:04 AM
Also, note that if you listen to the MdiChildActivate event in the parent and set the active child form's WindowState to Maximized, then you will not have the problem of the framework automatically restoring your child form.
DPDavid PalauJuly 18, 2003 12:32 PM
Thanks for the info. It helps.
I was just messing around with the .net supplied MDI stuff, not Tools. We will definitely be using your stuff.