启用和禁用表格 [英] Enabling and disablling of a form

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

问题描述


首先,感谢大家为我的前两个问题提供了帮助.

但是现在还有另一个问题.
这是;

我正在用C#开发项目,并希望对linklabel click事件禁用一种形式,并同时打开另一种形式.
一旦第二个表单的工作结束并且我单击按钮关闭该表单,我希望以前的表单再次启用.



简而言之,我想创建一个弹出窗口,该窗口会禁用整个屏幕,但该特定窗口除外;当工作结束并关闭时,该窗口屏幕会被激活.


谢谢
Sangaur

Hi
First of thanks to all of you for providing me help on my previous two question.

But now have another problem.
Here it is ;

I am making project in c# and wants to make one form disable on linklabel click event and open another form at the same time .
Once the work of second form is over and i closes that form on button click and i want previous form to become enable again.

Or

In short i want to make a popup window which disables entire screen except that particular window and when work is over and i closes that window screen gets activated.


Thanks
Sangaur

推荐答案

好吧,禁用整个桌面只是一种不好的举止.从本质上讲,打开另一种表单的行为使用户无法执行给定应用程序的先前表单中的任何操作,直到关闭当前表单为止.无需额外的处理即可完成您想做的事情.

您可以*但是*隐藏第一个表格,然后在其他表格被取消时重新显示它,如下所示:

Well, disabling the entire desktop is just plain bad manners. The act of opening up another form in essence prevents the user from doing anything in previous forms of a given application until the current form is closed. There''s no need for extra processing to do what you want to do.

You *could* however HIDE the first form, and then re-show it when the other form is dismissed, something like this:

private void button_Click(...)
{
    Form2 form2 = new Form2();
    form2.Closed += new EventArgs(form2_Closed);
    this.Visible = false;
    form2.ShowDialog();
}

private void form2_Closed(...)
{
    this.Visible = true;
}


使用Form2.ShowDialog()方法.
有关更多信息,请参见: http://msdn.microsoft.com/zh-我们/library/aa984358(v=vs.71).aspx [
use the Form2.ShowDialog() method.
For more information see: http://msdn.microsoft.com/en-us/library/aa984358(v=vs.71).aspx[^]


u可以使用这两个例程:-

1. form1.Hide();
2. form2.Show();
u can use these two routines :-

1. form1.Hide();
2. form2.Show();


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

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