C# 主窗口调用子窗口后主窗口的enabled=false,关闭子窗口后怎样使主窗口enabled=true?

[复制链接]
查看11 | 回复2 | 2011-7-17 13:16:15 | 显示全部楼层 |阅读模式
我不知道你是想让主窗口的某一控件enable,还是想让整个个都enable.如果想让某一个控件的话,可以用构造函数.假设主窗口Form1 有一个button1,调用子窗口后其enable=false;子窗口部分代码:public Form1 f1;Form2(Form1 f){
this.f1=f;}//添加Fomr2closing事件private void Form2_FormClosing(object sender, FormClosingEventArgs e) {
f1.button1.Enable=true; }Form1调用Form2:Form2 f2=new Form2(...
回复

使用道具 举报

千问 | 2011-7-17 13:16:15 | 显示全部楼层
Form2 f = new Form2();
f.FormClosing += new FormClosingEventHandler(f_FormClosing);
this.Enabled = false;
f.Show();
}
void f_For...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行