启用和禁用菜单栏 [英] enable and disable menustrip

查看:110
本文介绍了启用和禁用菜单栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,
我有2个窗口形式(即main_form和frm_login).
在main_form中,我有一个menustrip1,并希望在frm_login按钮ok上启用和禁用此功能.

我宣布菜单条为公共菜单,但它不起作用.

请问我该怎么做.


谢谢

Sir,
i have 2 window form(namely main_form and frm_login).
In main_form i have a menustrip1 and want to enable and disable this on frm_login button ok.

i declare the menustrip public but it doesn''t work.

how can i do this plz suggest.


Thanks

推荐答案

不要绕过组件引用.
我猜登录表单显示为模态,因此请使用登录表单的DialogResult属性.
System.Windows.Forms.DialogResult [
Do not pass around Component references.
I am guessing Login Form is shown modal so use DialogResult property of login form.
System.Windows.Forms.DialogResult[^]


这被简化为一个关于形式合作的流行(但很无聊的:-)问题.最健壮的方法是在表单类中实现适当的接口.

请查看我过去的解决方案中的解释;另请参阅其他解决方案和讨论:
如何在列表框之间复制所有项目两种形式 [ ^ ].

—SA
This is reduced to a popular (but boring :-)) question about form cooperation. The most robust approach is implementing appropriate interface in form class.

Please see my explanation in my past solution; also see other solutions and the discussion:
How to copy all the items between listboxes in two forms[^].

—SA


这篇关于启用和禁用菜单栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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