Google Answers Logo
View Question
Q: Visual Basic.NET MDI Child ( Answered 5 out of 5 stars,   0 Comments )
Subject: Visual Basic.NET MDI Child
Category: Computers > Programming
Asked by: jthoma1-ga
List Price: $5.00
Posted: 30 Dec 2002 14:30 PST
Expires: 29 Jan 2003 14:30 PST
Question ID: 135136
In Visual Basic.NET how do I remove or hide the title bar (min/max
buttons, caption, icon, etc...) on an MDI Child that is maximized?

Request for Question Clarification by cerebrate-ga on 30 Dec 2002 17:07 PST
Do you require a pure .NET solution?

Using the .NET framework alone, I can remove all the title bar
elements except for the window's icon/control menu, but I think that
I'd need to call unmanaged code to remove that, which may well be - is
probably? - undesirable for your application.



Clarification of Question by jthoma1-ga on 30 Dec 2002 17:52 PST
Yes, it can be unmanaged code if that is the only solution.  The
parent MDI form has an outlook bar docked on the left side of the
screen, and a toolbar docked on the top of the screen.  I want to use
the rest of the screen to show different forms, but the user should
NOT be able to tile or cascade the forms. And of course, I don't want
the MDI Child forms to have their own title that appears.  Is this
enough clarification?

Request for Question Clarification by cerebrate-ga on 31 Dec 2002 04:24 PST
Yes, I believe I have a good handle on it, now.

I'm working on the possible unmanaged solution to this now, but I'd
also like to ask if you'd be interested in a possible alternate
solution - to the requirement of displaying different 'forms' in the
rest of your window without carrying along all the MDI title-bar and
other window functionality - that would be simpler to implement and
wouldn't require unmanaged code? (Am I right in thinking that you're
using the Outlook bar to switch between forms?) There's actually quite
a convenient way to do this using User Controls.



Clarification of Question by jthoma1-ga on 31 Dec 2002 06:34 PST
An alternate solution sounds better than an unmanaged code solution. 
Yes, the outlook bar is being used to switch between forms.
Subject: Re: Visual Basic.NET MDI Child
Answered By: cerebrate-ga on 31 Dec 2002 11:29 PST
Rated:5 out of 5 stars
Dear jthoma1-ga,

I have coded up the alternate solution for you. It's rather large to
present on this site, so I have uploaded it to some of my web space
for you:

(One caveat I will mention is that I'm away from home for the New Year
at the moment, and unfortunately I only have C# installed on my
laptop, not VB.NET, and I couldn't find this sample anywhere in VB. It
doesn't use any language-specific tricks, though, so I hope it should
be understandable. If not, please request a clarification and I'll
post a VB.NET version as soon as I'm back with my main machine. Thanks
for your understanding.)


What this solution does, rather than use MDI child windows as the
subwindows called up by the Outlook bar, is to make those subwindows
User Controls, which you can design in the visual designer. I've
created two, PanelA and PanelB, in the sample; their only special
characteristic is that they both inherit from OutlookPanel, so that
you can handle them through a single data type.

The magic happens in the main form. To simulate your layout, although
I don't have an Outlook Bar control here, I've added two toolbars to
this form, at the top and left.

Each panel (subwindow) you wish to use is stored in a private member
of the form - I create them in the MainForm constructor, and store
them all, and another private member holds the currently visible

The panels are changed by the ChangePanel method. It first performs a
couple of checks to see if the requested panel is already visible, or
no panel is visible (as you would expect when the form first appears,
then removes the old panel from the Controls collection of the form,
hiding it, and adds the new panel into the Controls collection, making
it visible. It then resizes and places the new panel to fill the main
window, less the space occupied by the toolbars, anchors it to the
window so that it will keep filling it even if the form is resized,
and calls Refresh to repaint the window with the new panel in place.

ChangePanel simply takes a reference to one of the panel member
variables, and can be called from wherever you like - here, I call it
from two toolbar buttons, but there's no reason why it couldn't be
called from the Outlook bar, menu items, etceters.

At the moment this is a simple implementation which used a fixed
number of panels, but it could easily be extended to use a dynamic
collection of panels rather than the private member variables I use
here. It also preserves all panel contents while they're hidden;
additional logic would be needed if you want to alter their state at
this time.

I hope this alternate solution achieves the effect you're looking for.
I have had a look at the possibilites of the unmanaged solution, but
it appears to be significantly harder than I initially thought, with
scope for some interesting problems.

If this answer isn't quite what you're looking for, please feel free
to request a clarification,
jthoma1-ga rated this answer:5 out of 5 stars and gave an additional tip of: $2.00
This answer was exceptional and solved my problem 100%!!!!  Thanks so much.

There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy