Reputation: 11
This code is changing my Main Form background color after I open it.
private void button1_Click(object sender, EventArgs e)
{
this.IsMdiContainer = true;
NewCustomer openform1 = new NewCustomer();
openform1.MdiParent = this;
openform1.Show();
}
Also is creating a border in the top of my borderless form.
Upvotes: 0
Views: 141
Reputation: 23225
When you set this.IsMdiContainer = true
WinForms is basically inserting an MdiClient
control into the form for you, and that's what you're seeing rather than the actual form itself. By default it has a grey background and a sort of sunken-in appearance that was quite common in early Windows UI.
Changing the background is fairly trivial, as you can just set it on the MdiClient
itself. You can find examples of that here:
Change Background of an MDI Form
Getting rid of the border is trickier because it's not directly exposed by the control itself, but you can find some approaches for that as well:
How to remove 3d border (sunken) from MDIClient component in MDI parent form?
Upvotes: 1