很简单但老是忘的东东
privatevoid lbl_min_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
privatevoid lbl_close_Click(object sender, EventArgs e)
{
Application.Exit();
}
privatevoid num_guess_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)//按下了回车键
{
this.doGuessNumber(this.btn_guess);
}
else
{
//nothing to do here!
}
}
privatevoid GuessForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.ApplicationExitCall || e.CloseReason == CloseReason.UserClosing)
{
DialogResult dr;
dr = MessageBox.Show("若现在退出,每个被邀请参加会议的人将断开连接。确实要退出吗?", "NetMeeting", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (dr == DialogResult.Yes)
{
//nothing to do here!
}
else
{
e.Cancel =true;//取消关闭,导致窗体继续保留
}
}
else
{
//nothing to do here!
}
}
privatevoid initData()
{
this.dlg_openfile.Filter ="所有文本文件(*.txt;*.cs)|*.txt;*.cs|所有文件(*。*)|*.*";
}
privatevoid menu_help_about_Click(object sender, EventArgs e)
{
AboutForm aboutform =new AboutForm();
aboutform.ShowDialog();
}
privatevoid menu_file_open_Click(object sender, EventArgs e)
{
DialogResult dr;
dr =this.dlg_openfile.ShowDialog();
if (dr == DialogResult.OK)
{
string filename =this.dlg_openfile.FileName;
this.fillText(filename); //填充文字框的方法
this.fillByte(filename); //填充字节框的方法
}
else
{
//nothing to do here!
}
}
privatevoid SingleWindow_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing )
{
e.Cancel =true;
this.Hide();
}
else
{
//nothing to do here!
}
}
/*
WinForm控件ListView始终定位在最后一行
this.lv_result.EnsureVisible(this.lv_result.Items.Count - 1);
*/
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (!closecancel)
{
if (MessageBox.Show("您真的要退出本系统吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
{
closecancel = true;
Application.Exit();
}
else
e.Cancel = true;
}
}
if (MessageBox.Show("您真的要退出本系统吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
{
closecancel = true;
Application.Exit();
}
else
e.Cancel = true;
}
}
bool isQuit = false; private void FrmMain_FormClosing(object sender, FormClosingEventArgs e) { if (!isQuit) { if (e.CloseReason == CloseReason.ApplicationExitCall || e.CloseReason == CloseReason.UserClosing) { DialogResult dr = MessageBox.Show("确定要关闭迁移工具吗? ", "退出", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (dr == DialogResult.No) { e.Cancel = true; } else { isQuit = true; Application.Exit(); } } } }