I want to remove icon from windows MDI child form

只谈情不闲聊 提交于 2019-12-02 13:01:00

Yes, this is a "feature" of the Windows MDI implementation. Design guides require the child form to have an icon so it is easy for the user to see what child was maximized and where to click to activate the system menu. The Windows Forms designer should have disabled the "ShowIcon" property and force it True but it can't because it doesn't know yet that the form will become an MDI child.

You'll have to work around it. One possibility is using a 1x1 icon that's transparent so it won't be visible when the child form is maximized. It is however not an ideal fix, the form's caption text will be shifted to the right. The path of least resistance is to simply create an icon for the form.

As described here you can make such item invisible:

private void MenuStrip_ItemAdded(object sender, ToolStripItemEventArgs e)
{
    if (e.Item.Text == "")
    {
        e.Item.Visible = false;
    }
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!