开发者

how to show a child form in MDI container without the apperance of the controls in the Container Form in the Child Form?

开发者 https://www.devze.com 2023-01-24 11:08 出处:网络
in my project in the container form i use buttons to open the child forms , not Strip Menu but the buttons in the container always appears on the child form

in my project in the container form i use buttons to open the child forms , not Strip Menu but the buttons in the container always appears on the child form how to privet the buttons or any other controls form being above the child form i am using Visual Studio 2008 professional edition C# programming lang开发者_如何学Gouage

how to show a child form in MDI container without the apperance of the controls in the Container Form in the Child Form?

as in this Image the button suppose to be in form1 and not to be seen in Form2 (Child) and also the other controls in the Container


sir i have best solution for

create new empty form and than set following property of this form

set in Form_load event

private void bg_Load(object sender, EventArgs e)
        {
            this.ControlBox = false;
            this.FormBorderStyle = FormBorderStyle.None;
            this.WindowState = FormWindowState.Maximized;
        }

than after write following code in mdi form load event

  private void Main_Load(object sender, EventArgs e)
        {


            bg bg = new bg(); // create object of empty form my empty form name is "bg"
            bg.MdiParent = this;
            bg.Show();
        }

what ever you want in background add into empty form....] Enjoy


You should use ToolStrip or MenuStrip to call your child form. In your case, I assume you just drag and drop a Button into your Form1. That's why the button is floating.

But if you are persistent and still don't want to use ToolStrip and MenuStrip, you can hide the button after showing the childform.. Ex:

private void button1_Click(object sender, EventArgs e)
{
     Form2 f2 = new Form2();
     f2.MdiParent = form1;
     f2.Show();
     button1.Visible = false; // This will cause your button to be hidden.
}
0

精彩评论

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

关注公众号