窗体不消失的问题

arens2003 2004-03-23 03:30:32
在一个函数中
void fun(){
Form1 fm = new Form1();
fm.ShowDialog() ;

//以下是其它处理
}

?:在fm关闭按钮点后,fm还不消失?
怎样解决?谢谢!
...全文
51 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
linaren 2004-03-23
  • 打赏
  • 举报
回复
利用两个函数
例:
void fun1()
{
Form1 fm = new Form1();
fm.ShowDialog();
}
void fun()
{
fun1();

//以下是其它处理

}
arens2003 2004-03-23
  • 打赏
  • 举报
回复
呵,Close()不行的
wangsaokui 2004-03-23
  • 打赏
  • 举报
回复
[C#]
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
// Determine if text has changed in the textbox by comparing to original text.
if (textBox1.Text != strMyOriginalText)
{
// Display a MsgBox asking the user to save changes or abort.
if(MessageBox.Show("Do you want to save changes to your text?", "My Application",
MessageBoxButtons.YesNo) == DialogResult.Yes)
{
// Cancel the Closing event from closing the form.
e.Cancel = true;
// Call method to save file...
}
}
}
wangsaokui 2004-03-23
  • 打赏
  • 举报
回复
Form.Close 方法
karykwan 2004-03-23
  • 打赏
  • 举报
回复
fm.close()

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧