合并工具条 MDI 子级 - 父级
我在互联网上找到了一些信息,但没有任何帮助。 如何在父 MDI 表单中合并工具条?
编辑:
这段代码对我有用:
private void MainForm_MdiChildActivate(object sender, EventArgs e)
{
IChildWindow child = ActiveMdiChild as IChildWindow;
if (child != null)
{
ToolStripManager.Merge(child.ToolStrip, toolStrip1);
child.ToolStrip.Hide();
child.FormClosing += delegate(object sender2, FormClosingEventArgs fe)
{
child.ToolStrip.Show();
ToolStripManager.RevertMerge(toolStrip1, child.ToolStrip);
};
}
}
I found some informations on the internet but nothing helped me out.
How can I merge a toolstrip in the parent mdi form?
Edit:
It worked for me with this code:
private void MainForm_MdiChildActivate(object sender, EventArgs e)
{
IChildWindow child = ActiveMdiChild as IChildWindow;
if (child != null)
{
ToolStripManager.Merge(child.ToolStrip, toolStrip1);
child.ToolStrip.Hide();
child.FormClosing += delegate(object sender2, FormClosingEventArgs fe)
{
child.ToolStrip.Show();
ToolStripManager.RevertMerge(toolStrip1, child.ToolStrip);
};
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用
ToolStripManager
。它有一个名为Merge(ToolStrip, ToolStrip)
的方法,可以执行您想要的操作。请参见此处
例如:
You need to use a
ToolStripManager
. It has a method calledMerge(ToolStrip, ToolStrip)
which does what you want to.See here
For example:
在子窗体中,还可以执行以下操作:
From within the child form one can also perform the following: