C# Windows 菜单项帮助用户管理打开的窗口
我想让一个窗口的菜单项维护由主窗体生成的打开窗口的列表。当表单关闭时,列表将减少。 Excel 2003 中存在此功能,单击窗口的菜单项会给出打开的工作簿列表。我可以编写一个单例表单,其中所有其他表单都会报告表单创建,但我想知道.Net 中是否已经存在此功能。我不想重新发明轮子。
I want to have a window's menu item maintain a list of open windows that have been spawned by the main form. When a form is closed the list will be reduced. This feature exists in excel 2003 where clicking the window's menu item a list of open workbooks is given. I can write a singleton form where all other forms will report a form creation but I'm wondering whether this feature already exist in .Net. I don't want to reinvent the wheel.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为 Application.OpenForms 就是您所需要的:
http://msdn.microsoft.com/en -us/library/system.windows.forms.application.openforms.aspx
I think Application.OpenForms is what you need:
http://msdn.microsoft.com/en-us/library/system.windows.forms.application.openforms.aspx
每个线程都需要一个单独的线程,并且在每个线程上调用
Application.Run(yourform)
。显然,您可以创建线程、表单等数组。
You need a separate thread for each, and on each thread you call
Application.Run(yourform)
.You can obviously create arrays of threads, forms et cettera.
它会自动为您完成。以下链接向您展示如何操作: http://msdn.microsoft.com/en -us/library/ms171654.aspx
It's done for you Automatically. Here's the link to show you how: http://msdn.microsoft.com/en-us/library/ms171654.aspx