Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I got extra close button on mdi child window?

Tags:

c#

winforms

I got a strange problem. My mdi child form has 2 close buttons and 2 maximized buttons.

A screenshot of the problem:

enter image description here

I create the mdi child like this:

 summaryForm.MdiParent = ContainerForm;  
 summaryForm.WindowState = FormWindowState.Maximized;  
 summaryForm.Show();

If I get rid of "summaryForm.WindowState = FormWindowState.Maximized;", the window style is correct. But I hope to make the mdi child form maximized when created.

like image 227
bucherren Avatar asked Dec 15 '11 07:12

bucherren


1 Answers

It's a bug in Winforms. This will happen when the child is created by the parent's constructor. Move it to the Load event.

like image 98
Shimmy Weitzhandler Avatar answered Oct 18 '22 20:10

Shimmy Weitzhandler