Click here to Skip to main content
15,914,905 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi guy's
i'm used this code :

C#
this.LayoutMdi(MdiLayout.Cascade);


in Mdi Child Form ...
Butt When the form is no border does not work (border style = None)
What I do ?
Posted
Comments
Sergey Alexandrovich Kryukov 5-May-15 10:58am    
First of all, don't use MDI... :-)
I would really strongly recommend it: no MDI, ever.
—SA

1 solution

First, I suggest that if it's possible you discontinue use of MDI WinForms. It's an Application Windowing model that is really outmoded, and, it is "quirky," to say the least.

You are right Mdi can't tile borderless child Forms under "normal" circumstances.

I found the standard tiling behavior in Mdi (last time I used it, which was many years ago) so bad that I just wrote my own tiling code.

If you really have to cascade borderless MdiChild windows here's an ugly hack:
C#
private void Cascade()
{
    this.SuspendLayout();

    foreach (Form frm in this.MdiChildren) frm.FormBorderStyle = FormBorderStyle.FixedSingle;

    this.LayoutMdi(MdiLayout.Cascade);

    foreach (Form frm in this.MdiChildren) frm.FormBorderStyle = FormBorderStyle.None;

    this.ResumeLayout();
}
But, don't blame me if this leads to some other strange behavior :)
 
Share this answer
 
Comments
ghasem110deh 5-May-15 15:26pm    
thanks
Do not use the MDI in your project !?
BillWoodruff 5-May-15 20:28pm    
I don't use Mdi, and I think the multiple-independent=window application model is, in general, a better model for WinForms leading to a cleaner UI/UX ... but, I recognize a lot of people do use Mdi, and may not have a choice about that.

cheers, Bill
ghasem110deh 6-May-15 0:48am    
OKi don't use in next project :)
very thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900