【发布时间】:2013-05-31 21:10:02
【问题描述】:
我可以将图标设置为 1x1 或透明图标,但我不喜欢这种解决方案,因为用户仍然可以点击它。
如果是 mdiParents mainMenuStrip,我可以这样做:
private void mainMenuStrip_ItemEventHandler(Object sender, ToolStripItemEventArgs e)
{
if (e.Item.Text == "")
{
e.Item.Visible = false;//This will hide any toolstrip items that do not have text... ex. the SystemMenu.
}
}
但是 UltraToolbarsManager.Toolbars 没有这个事件。
将 mdiChild 的 ShowIcon 设置为 false 仅在 mdiChild 表单未最大化时有效。
我还尝试重载 mdiChild SizeChanged 事件并循环浏览工具以查看是否可以找到要隐藏的事件,但这也不起作用:
private void MdiChild_SizeChanged(object sender, EventArgs e)
{
Form theForm = sender as Form;
switch (theForm.WindowState)
{
case FormWindowState.Maximized:
theForm.Icon = Icon.FromHandle(Properties.Resources.blank.GetHicon());
foreach (UltraToolbar ut in UltraToolbarsManager1.Toolbars)
{
if (ut.IsMainMenuBar)
{
foreach (ToolBase tb in ut.Tools)
{
//This collection does not contain the one I want to hide.
// maybe?
if (tb is MdiMergePlaceholderTool)
{
tb.SharedProps.Visible = false;
}
}
}
}
break;
}
}
UltraToolbarsManager 和 UltraToolbar 似乎没有任何我可以处理的事件来尝试删除正在合并到工具栏中的内容...
这是我也有的确切问题..但没有回答: http://www.infragistics.com/community/forums/t/33396.aspx
我认为这是另一个帖子建议的更新链接,但修改 100 个表单以像这样继承对我来说不是一个选项: http://help.infragistics.com/Help/NetAdvantage/WinForms/2013.1/CLR4.0/html/Win_Creation_Filter.html
几种可能性: - 在 OnItemAdded 事件中隐藏项目。 - 从 UltraToolbar 中删除图标.. 可能在 OnMerge 事件中。 - 如果图标无法隐藏/删除,则取消上下文菜单的事件。 - 获得对图标项目的引用的某种方式会很好。
提前感谢您的任何回复。
【问题讨论】:
标签: c# icons infragistics mdichild