We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to duplicate MS Office like MDI behavior

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, -David

5 Replies

RP Ramesh Praveen Syncfusion Team July 17, 2003 06:49 PM UTC

David, 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. Regards, Praveen

DP David Palau July 17, 2003 07:13 PM UTC

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.

RP Ramesh Praveen Syncfusion Team July 18, 2003 02:46 PM UTC

David, 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?). Regards, Praveen

RP Ramesh Praveen Syncfusion Team July 18, 2003 04:04 PM UTC

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. Regards, Praveen

DP David Palau July 18, 2003 05:32 PM UTC

Praveen, 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. Thanks again, -David

Live Chat Icon For mobile
Up arrow icon