开发者

C# WinForms MDI problem

Hello guyes i have one problem i have 1 parent form and 3 children i just want to open them maxi开发者_如何学JAVAmized but when i do that in left side comes this 3 controls. How can i open one form without this controls. If im doing this with wrong way please advice me something does mdi good for such things?

please see this pictures http://img440.imageshack.us/img440/6831/mdinz.jpg http://img139.imageshack.us/img139/4687/mdi1.jpg


This is a known bug in the MDI implementation, triggered when you create a maximized child window in the parent constructor. This is an example:

public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
        var child = new Form2();
        child.MdiParent = this;
        child.WindowState = FormWindowState.Maximized;
        child.Show();
    }
}

You'll see the min/max/restore glyphs displayed twice, restoring the child window leaves the MDI bar on the screen, just as in your first screen shot. The workaround is to move the child creation code to the OnLoad() method. Like this:

public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
    }
    protected override void OnLoad(EventArgs e) {
        base.OnLoad(e);
        var child = new Form2();
        child.MdiParent = this;
        child.WindowState = FormWindowState.Maximized;
        child.Show();
    }
}


You can use the ControlBox, FormBorderStyle, MaximizeBox and MinimizeBox properties to remove the various window UI elements from a form, if you wish.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜