c#中被点击窗体右上角的“X”按钮关闭窗体的事件是什么?

pomelowu 2003-07-15 04:06:24
或者说相vb中这样的代码如何实现?
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode= vbFormControlMenu Then
Cancel =False
Me.Hide
End If
End Sub
...全文
1415 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
michaelowenii 2003-07-17
  • 打赏
  • 举报
回复
closed()事件
lczddd 2003-07-15
  • 打赏
  • 举报
回复
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;//or false,you can test it by yourself
}
pomelowu 2003-07-15
  • 打赏
  • 举报
回复
snof的代码如果不通过弹出对话框形式呢?
xlfancy 2003-07-15
  • 打赏
  • 举报
回复
protected override void Dispose( bool disposing )
{
//在此加入善后代码即可
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
雪狼1234567 2003-07-15
  • 打赏
  • 举报
回复
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
DialogResult r = MessageBox.Show ( "是否关闭窗口!" , "关闭窗口!" , MessageBoxButtons.YesNo , MessageBoxIcon.Question ) ;
if (!(DialogResult.Yes ==r))
{
e.Cancel = true;
}
}
pomelowu 2003-07-15
  • 打赏
  • 举报
回复
事件名吗?
那上面的代码如何转换呢?
chinchy 2003-07-15
  • 打赏
  • 举报
回复
Form.Closing

110,566

社区成员

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

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

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