MDI 应用程序主菜单帮助
我们正在开发 MDI 应用程序。我们需要做的是我有 4 个子表单和 1 个父表单。在父窗体工具箱菜单上我有 3 个按钮。添加、保存、取消。
我想做的是子表单已加载的内容。单击这些按钮时,它们应该处理子窗体上的操作。
可以说,如果我的名为 CustomerManager 的子表单已打开,那么通过按添加按钮,它基本上应该处理我的 CustomerManager 子表单。显然,我将纠正每个表单操作按钮的逻辑。
我希望我能够定义我在寻找什么。
问候 沙克斯
We are developing an MDI Application. What we need to do is that I Have 4 child forms and 1 Parent form. on the parent form ToolBox menu I have 3 buttons. Add,Save,Cancel.
What I want to do is What ever the child form has loaded. When these buttons clicked they should process the action on the child form.
LEts say, If my child form named CustomerManager is open, then by pressing the add button it should basically process my CustomerManager child form. Obviously I will right the logic against every form action Button.
I hope I am able define what I am looking for.
Regards
Shax
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最好通过声明一个接口来完成此操作:
并让您的 MDI 子窗体实现它:
在您的父窗体中,为工具栏按钮实现 Click 事件,如下所示:
如果子窗体处于活动状态但不活动,则禁用该按钮也是一个好主意不执行该命令。您可以通过为 Application.Idle 事件编写事件处理程序来完成此操作:
This is best done by declaring an interface:
And let your MDI child form implement it:
In your parent, implement the Click event for the toolbar button like this:
It is also a good idea to disable the button if a child is active that doesn't implement the command. Which you can do by writing an event handler for the Application.Idle event: