问题描述
我有一个 MDI 容器表单,以及一些独立更新其标题栏文本的子表单.在子窗体上更改 Text 属性后,当打开菜单时,子窗体中的新标题栏文本不会在窗口列表菜单中更新.这是 .NET 通过 MdiWindowListItem 属性提供的自动生成的窗口列表.
I have a MDI container form, and some child forms that update their title bar texts themselves, independently. After the Text property is changed on the child form, the new title bar text from the child is not updated in the window list menu when the menu is opened. This is the auto-generated window list provided by .NET via the MdiWindowListItem property.
仅当另一个事件物理更改窗口列表(打开一个新子项、关闭一个子项、切换到另一个子项)时,更改才会传播.
The change only propagates when another event changes the window list physically (opening a new child, closing a child, switching to another child).
有没有办法以编程方式强制更新窗口列表?我已经有一些代码可以在更改子标题栏文本的同时启用/禁用菜单.
Is there a way to force an update of the window list programmatically? I already have some code in place to do menu enabling/disabling at the same time the child's title bar text is changed.
我尝试了以下方法但没有成功:
I tried the following with no success:
- 主 MenuStrip 上的 Update()
- Refresh() 在主 MenuStrip 上
- Invalidate() 在窗口 MenuStrip 上
- 在运行时对窗口列表项之一进行 Invalidate()
- 在运行时在窗口列表项之一上切换 Checked 状态两次
似乎没有任何其他远程可行的函数可以在菜单项、其父 ToolStrip 或包含菜单系统的父窗体上调用.
There don't seem to be any other remotely viable functions to call on the menu item, its parent ToolStrip, or the parent form that contains the menu system.
推荐答案
上述解决方案对我不起作用.但我按照链接,发现了这个,效果很好:
The above solution did not work for me. But I followed the link, and found this, which works perfectly:
private void windowMenu_DropDownOpening(object sender, EventArgs e)
{
if (this.ActiveMdiChild != null)
{
Form activeChild = this.ActiveMdiChild;
ActivateMdiChild(null);
ActivateMdiChild(activeChild);
}
}
谢谢!
这篇关于MDI 窗口列表不更新子标题栏文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)