MDI forms lost sub control box
See original GitHub issue- .NET Core Version:
- Have you experienced this same bug with .NET Framework?: No
Problem description:
-
.NET 5 current master and Preview2

-
.NET Core 3.1

Expected behavior:
.NET 5 variant must look like .NET Core 3.1 variant.
Minimal repro:
Run a repro app provided in #2979
Issue Analytics
- State:
- Created 3 years ago
- Comments:32 (30 by maintainers)
Top Results From Across the Web
Skinned MDI application - the control box disappears after ...
Disable form skinning in the application, and you'll notice that the mdi child's control box is displayed properly. The problem only occurs when ......
Read more >Prevent MDI child Control box from showing
i Solved it !! simply add this line and disable any changes you made in the Properties window. Child.FormBorderStyle =(FormBorderStyle) ...
Read more >Thread: Problem with controls on an MDI Form
I have a project with an MDI form The MDI form has a menu on the top. When the user selects a menu...
Read more >MDI Child Form Problem (not showing)
I am having difficulty with a MDI child/parent relationship for my C# winforms project. I currently have a several controls (button, ...
Read more >[Solved] Controls inside MDI container form
I have an MDI form and I've put some controls inside it. But when I open any MDI child forms, the controls appear...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

#4388 is a dup, I just never realised the buttons were the all along. @kirsan31 I ran your sample on a 5.0-rc2, and the issue was there, so it would be the result of bad merge of 3.1->5.0.
I do kind of feel like an archeologist, dig through an ancient codebase, not really knowing where to start. Here’s my understanding of how MDI control box is working. Posting here to provide more context, and so I can recall after I’m back from holidays.
Whenever an MDI windows is being maximised or minimised there’s a call to update MDI parent’s toolstrip: https://github.com/dotnet/winforms/blob/4bca5b30aea871a2c1761b39f8ff8128cb155119/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs#L5613 If the child is being maximised - we merge its menu into the main menu of the parent (line:5671): https://github.com/dotnet/winforms/blob/4bca5b30aea871a2c1761b39f8ff8128cb155119/src/System.Windows.Forms/src/System/Windows/Forms/Form.cs#L5654-L5676 For that we create
MdiControlStripthat contains three buttons: “Minimize”, “Maximize” and “Close”: https://github.com/dotnet/winforms/blob/4bca5b30aea871a2c1761b39f8ff8128cb155119/src/System.Windows.Forms/src/System/Windows/Forms/MDIControlStrip.cs#L32-L40 These buttons get native Windows images for respective operations viaGetNativeMenuItemImage()call, which retrieves those via https://github.com/dotnet/winforms/blob/4bca5b30aea871a2c1761b39f8ff8128cb155119/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripMenuItem.cs#L795-L800 …and fails. Because the default system menu doesn’t have any images.Notice the menu in .NET 5.0 version doesn’t have any images:
Whilst in .NET Framework does:
Just for laughs I decided to set images manually, and voila:
#3461 addresses the issue by creating a new menu, which has images (magic?). Granted that PR isn’t complete like-for-like, and needs further work.
I wouldn’t be surprised if there are still things that I missed, and hopefully @JeremyKuhne and @weltkante can help me filling the gaps.
I rolled back to 922e41002e66fb10d703705d9be700c8b30cd63d (my branch), the last commit on 3.1 branch before the merge, it is working as far as the broken use case is concerned:
I then rolled back to a0e12b1408ae45a3cc08dfd3e928c9ab8b5a45df (my branch), the last commit on 5.0 branch before the merge, and with global.json some trickery was able to build it. The broken use case is working correctly too:
I then build 07ae71178eda9d1e4ebf73be44879d969cea7dc5 and lo and behold the icons are there:
…3 hours bisecting later…
The images disappeared in https://github.com/dotnet/winforms/pull/2659 (21821568afe4f566f2d18cfece56cff666de1955)
So, yes, there are two distinct issues here: