question

VAer-4038 avatar image
0 Votes"
VAer-4038 asked DanielZhang-MSFT edited

Menustrip covers form panel

I have code for form: ChildForm1.WindowState = FormWindowState.Maximized

Property: FormBorderStyle = None

I have panel dock at the top of ChildForm1, and I have some contents at the top.

When I open ChildForm1, menustrip covers some content of form panel.

When maximize form, can it be maximized under menustrip, not behind menustrip.

Thanks.

windows-forms
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @VAer-4038
First, I can't reproduce the situation with you description.
And what is your content of form panel? How did you add text to the panel?
Could you show the "cover"and provide some detailed steps to reproduce it?
Best Regards,
Daniel Zhang

0 Votes 0 ·

Actually, it happens when I set ChildFormBorderStyle = none. See the screenshot, I put a label at the top of form, then the label is covered by menustrip.

Another issue: when I set ChildFormBorderStyle = sizeable, there is an icon at the left of menustrip, this system icon is on the menustrip, not on the parent form. This icon is not child form icon.

If I change FormBorderStyle back to none (FormBorderStyle = none), child form icon shows up on the menu strip. Yes, ChildFormBorderStyle = none, while ChildForm icon appears on menu strip. When there is sizeable ChildFormBorderStyle, then child form icon does not appear on menu strip. I am not saying the icon being part of menustrip, I am just saying icon appears on the menustrip.

However, when I minimize child form, form icon disappears from menustrip; at this moment menustrip has buttons only.

Let me put screenshot in another post, it exceeds 1000 characters.

0 Votes 0 ·

This continues above post.

53452-top-label.jpg

53472-menustrip-cover-text.jpg


53473-menustrip-icon.jpg


0 Votes 0 ·

1 Answer

DanielZhang-MSFT avatar image
0 Votes"
DanielZhang-MSFT answered DanielZhang-MSFT edited

Hi VAer-4038,
>>Does the "menustrip" in your description refer to the title bar of the child window?
If not, please explain in detail.
And have you set your parent form's WindowState property to Maximized?
Due to parent form is a container for multiple-document interface (MDI) child forms, so there will be some problems when the child window is larger than the parent window.
I made a test with your information and setted parent form's WindowState property to Maximized.
Here are test result:
Child form Maximized:
53476-max.png
Child form Minimized:
53564-min.png
>> this system icon is on the menustrip, not on the parent form. This icon is not child form icon.
Which icon you are referring to, and you can change the icon of the child window to determine whether it is its icon.
When I set FormBorderStyle to none or sizeable, the child form all appears on "menustrip".
>>when I minimize child form, form icon disappears from menustrip; at this moment menustrip has buttons only.
Does your "button" refer to icon or others?
Best Regards,
Daniel Zhang


If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



max.png (5.9 KiB)
min.png (4.6 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Menustrip is the menustrip of parent form (buttons used to open each child form), it is in area 2, it belongs to parent form. Yes, parent form is maximized.

If child form does not have title bar ((FormBorderStyle = none) and maximized, it seems it is maximized inside parent form, but behind menustrip. It is maximized in both area 2 and area 3, which causes area 2 stays on the top on child form. Note: this child form is filled with panel, but it seems it has nothing to do with panel.

//Due to 1000 character limit, I will continue another comment. By the way, it is not a big issue for me, I don't need to put label on very top of form. I am new to Visual Studio, still have many other things to learn. I can move on with this issue. I don't want you to spend time on this too.

0 Votes 0 ·

//Continued from above comment

When I set ChildFormBorderStyle = sizeable (or child form has title bar), it seems that parent form's menu strip and child form title are about the same size, now the very top label cannot stretch behind menustrip (stretch into area 2). In this case, child form with title bar, with its own customized form icon, for some reasons, menustrip buttons seem move to right a little bit, and make room for child form icon, but that icon appearing in area 2 is not childform's customized icon, while it is system form icon. It seems area 2 displaying both parent form's menustrip buttons and childform's title bar(green ones on the right of area 2). In this example, if I minimize child form, and child form moves to bottom left corner, now area 2 only displays parent form's menustrip buttons.

53642-menustrip.jpg


0 Votes 0 ·
menustrip.jpg (44.4 KiB)

Hi @VAer-4038,
When you click button in the menustrip of parent form to open the child form, you can use Dock property to set the child form borders are docked to its parent form.

 private void clickToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ChildForm1 newMDIChild = new ChildForm1();
     // Set the Parent Form of the Child window.
     newMDIChild.MdiParent = this;
     newMDIChild.Dock = DockStyle.Fill;
     newMDIChild.Show();
 }

Best Regards,
Daniel Zhang


0 Votes 0 ·