问题
In my application when I make a form as a child form of my main MDI parent form, the child form stops showing Windows 7 default shadow effect behind forms. How do I get child forms shadow to show?
Form obj = Application.OpenForms["My_form"];
if (obj != null)
{
obj.Focus();
}
else
{
My_form c = new My_form();
c.MdiParent = this;
c.Show();
}
回答1:
This is normal, entirely by design. MDI child windows are not top-level windows, but rather a special type of child window that is designed to be hosted in an MDI parent window.
The Desktop Window Manager (DWM), which is what is responsible for the Aero effects in Windows Vista and 7, only adds drop shadows and glass transparency to top-level windows. Your MDI child windows don't qualify for this treatment. In fact, the shadow isn't the only thing they're missing--they look like they're drawn using the Aero Basic theme, which is pretty visually jarring on a machine that is using the Aero theme for everything else.
Unfortunately, there's no fix for this other than to switch away from MDI altogether. The multiple document interface has been pretty much deprecated nowadays anyway. Such interfaces provided more difficult for people to use than was originally expected, and they've fallen into almost complete disuse, particularly by Microsoft's own software. You'll notice that rather than using MDI, Microsoft Office uses multiple top-level windows. You should probably consider doing the same thing with your own software.
Another popular alternative to MDI is a tabbed interface, commonly used by web browsers. Here, you have a single, top-level window and all of the child windows appear as "tabs" at the top of this main window. The user can switch among child windows much more easily and intuitively as tabs rather than as independent MDI children.
回答2:
I got the answer finally , if i make a form as child form like
c.MdiParent =this;
It makes the appearance of the form as flat , If you like to show the form as default windows like forms dont make the form's mdi parent !
来源:https://stackoverflow.com/questions/11610613/why-arent-my-mdi-child-forms-showing-a-shadow