I basically have two problems with C # .NET MDI. You can download the VS2010 solution that reproduces the errors here .
1) When programmatically hiding and re-playing the maximized child form, it does not maximize properly and does not become either maximized or normal.
childForm = new Form(); childForm.Text = "Child Form"; childForm.MdiParent = this; ... private void showButton_Click(object sender, EventArgs e) { childForm.Visible = true; } ... private void hideButton_Click(object sender, EventArgs e) { childForm.Visible = false; }
When the child form is maximized, then programmatically hides and displayed again, it becomes something like this (note that the control window for the child form appears on the menu bar, but the child form is not maximized):

At this point, the child form cannot be moved. However, I found a workaround for this by simply showing and hiding the mannequin child form, which causes the actual child form to become properly maximized. But this makes the MDI area flicker. Tried the Invalidate, Refresh, Update methods, but they do not help. Perhaps there are other ways to work around this problem in order not to measure MDI areas with a dummy child form?
private void workaround1Button_Click(object sender, EventArgs e) { dummyForm.Visible = true; dummyForm.Visible = false; }
2) When the child form is maximized, the child form icon is displayed in the menu bar. However, if you need to change the icon when the child form is maximum, the icon in the menu bar is not updated (see Image above). I found a workaround for this too, which basically hides and shows the menu bar. The icon is updated, but it does everything below the flicker menu bar. Tried the Invalidate, Refresh, Update methods, but they do not help. Is there any other way to make the menu bar refresh the child form icon?
private void workaround2Button_Click(object sender, EventArgs e) { menuStrip.Visible = false; menuStrip.Visible = true; }
I also noticed that when the parent form is in the normal window state mode (not maximized) and you change the width or height of the form by 1 pixel, the child form becomes as possible as it should be, and the icon of the child form in the menu bar gets updated properly, and you donβt need another workaround as described above. If I resize the form programmatically, the form flickers by 1 pixel, and I cannot do this when the parent form is maximized. Is there any way in which I could call the repaint / refresh function, which is called when the form is resized and which makes the child form as possible as possible, and the icon in the menu bar is updated?