0

我想在 MDI 表单顶部显示横幅图像以及一些菜单。菜单应显示在右侧底部位置的横幅图像上。为此,我遵循以下步骤:

  1. 添加 MDI 表格
  2. 面板 ( pnlHeader) - 背景颜色为黑色以匹配图像背景
  3. Picturebox显示横幅图像并将其添加到pnlHeader
  4. 在 Picturebox 中添加 menustrip ( dock = none) 以在横幅图像上显示菜单(在徽标旁边)

当我调整表单大小时,即使面板停靠到顶部,图片框图像和菜单条也不会调整大小。对此有什么建议吗?由于安全原因,我无法为您提供代码。

4

1 回答 1

0

Basically add a new panel to your current layout. you will end up with this:

layout

Thing here is doing the correct anchoring, so this settings should work:

-Picturebox: Anchor:Top, Left, Right. Just adjust size to your needs.

-pnlHeader: Anchor Top, Left, Right. Just adjust size to your needs.

-pnlMenuContainer (Orange): Anchor Top, Left, Right. It should be of same Height of contained MenuBar, because it is just for placing the menubar.

-MenuStrip(MenuBar in img): Dock Top (or Bottom).

With this layout PictureBox and MenuStrip increase their size as you make your form wider. Actually for the MenuStrip, the panel that contains it is the one that increase it size but as your menuStrip is docked it gets bigger too. Same for the inverse (Making it smaller).

I must apologize in advance for any kind of grammar or spelling error.

Best of luck,

于 2013-03-01T07:05:45.550 回答