如何将MDI子实例添加为菜单项 [英] How to add mdi child instance as a menuitem

查看:60
本文介绍了如何将MDI子实例添加为菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
在我的应用程序中,我提供了多任务处理环境..以便用户可以一次打开许多不同的表单(意味着假设用户已经打开了销售票据表单,现在可以打开购买票据表单或贷方票据表单).如果用户打开了两个或更多的表单,则很难在表单之间导航.所以为此,我创建了一个Windows菜单,我试图将窗体实例(打开的)添加为子菜单o Windows菜单(就像Word女士中的Windows菜单一样).之后,我试图删除子菜单项,如果表单已关闭.
该怎么办?
请帮助

Hello,
In my application i have provided multitasking environment..so user can open number of different forms at a time(means Suppose user have open a sale bill form and now he can open purchase bill form or credit note form).If user opened two or more form then it is difficult to navigate between forms. So for this i have created a Windows Menu and i am trying to add instance of form(which is open) as sub menu o Windows menu(Just like Windows Menu in Ms Word) .After that i am trying to remove the sub menu item, if the form is closed.
What to do for this?
Pls Help

推荐答案

Yatin,

如果从主应用程序窗口中打开了所有不同的表单,则应该非常简单.打开表单后,您:

1.将其添加到菜单中并存储哪个表单属于哪个菜单项
2.附加一个form.Closed事件处理程序到该窗体
3.当表单关闭时,将触发来自2.的事件.查找哪个菜单项属于触发事件的表单,然后将其从菜单中删除.

信息存储可以很简单:
Hi Yatin,

if all the different forms are opened from the main application window it should be pretty much straight forward. When a form is opened you:

1. add it to the menu and store which form belongs to which menu entry
2. attach a form.Closed event handler to the form
3. When a form is closed event from 2. will fire. Look up which menu entry belongs to the form that fired the event and remove it from your menu.

Storage of information could be as simple as:
Dictionary<form,MenuEntry> dictFormEntry = new ...
...
dictFormEntry.Add(myBillingForm, menuEntry);
...



希望这会给您一些想法!


干杯

曼弗雷德(Manfred)



Hope this will give you some ideas!


Cheers

Manfred


这篇关于如何将MDI子实例添加为菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆