重写winform关闭按钮
来源:互联网 发布:java excel 换行 编辑:程序博客网 时间:2024/05/17 13:09
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult result;
result = MessageBox.Show("确定退出吗?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (result == DialogResult.OK)
{
Application.ExitThread();
}
else
{
e.Cancel = true;
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
//将Form1_FormClosing绑定到窗体的FormClosing事件上。
//原事件定义:publicevent FormClosingEventHandler FormClosing
this.FormClosing += new FormClosingEventHandler(Form1_FormClosing);}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult result;
result = MessageBox.Show("确定退出吗?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (result == DialogResult.OK)
{
Application.ExitThread();
}
else
{
e.Cancel = true;
}
}
}
}
0 0
- 重写winform关闭按钮
- WinForm中的关闭按钮
- WinForm禁用关闭按钮
- WinForm中,屏蔽关闭按钮
- WinForm窗体禁用关闭按钮
- WinForm窗体禁用关闭按钮
- Winform不显示关闭按钮
- C# Winform实现捕获窗体最小化、最大化、关闭按钮事件的方法,可通过重写WndProc来实现
- c#重写TabControl控件实现关闭按钮
- Winform -----TabControl 标签 画关闭按钮
- 禁用winform窗体上的关闭按钮
- WinForm 窗体屏蔽关闭按钮事件
- WinForm 中禁用窗体的关闭按钮
- c# winform 取消右上角关闭按钮方法
- C# WinForm开发 取消窗体关闭按钮
- winform拦截关闭按钮触发的事件
- C# Winform 禁用窗体关闭按钮
- C# winform 窗口关闭按钮不显示
- iOS中百度地图API的总结
- DevSuite与CustomerWise并驾齐驱,助力慈力慧研发及销售管理升级
- 查看MySQL是否支持InnoDB引擎以及不支持的解决办法
- 如何在VS2010中编写ExtJs
- Android仿人人客户端(v5.7.1)——点击左侧菜单栏中的Item切换视图
- 重写winform关闭按钮
- Spring Security3.1权限管理
- (转)金蝶 eas bos KDTable常用处理代码
- 对象与类(三):类的组合
- 黑马程序员_笔记十_异常的捕获及处理
- RegularExpressionValidator使用心得
- 策略模式
- eclipse提示The import javax.servlet cannot be resolved
- 个人心得记录 --学习廖雪峰的git教程