/// <summary> /// 窗体关闭事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lblClose_Click(object sender, EventArgs e) { if (_close_Ch.Checked) { k_hook.Stop(); this.Close(); Application.Exit(); } else { this.WindowState = FormWindowState.Minimized; this.notifyIcon.Visible = true; this.ShowInTaskbar = true; //不显示在系统任务栏 //this.Hide(); if (mMinCount == 0) //第一次最小化窗体 显示提示 { notifyIcon.BalloonTipText = "最小化到托盘,右键关闭"; notifyIcon.BalloonTipTitle = "提醒"; notifyIcon.ShowBalloonTip(2000); //动画,如果第一次不执行则不能还原 FormEffect.animate(this.Handle, 200, MemoryAddress.AW_SLIDE + MemoryAddress.AW_HOR_POSITIVE + MemoryAddress.AW_HIDE); mMinCount++; } } }
/// <summary> /// 准备数据 /// </summary> private void InitData() { ExecuteCommon execute = new ExecuteCommon(); if (!(bool)execute.doMethod(Key_XmlCore.InitSystemXml.ToString(), null)) { MessageBox.Show("初始化数据失败!"); return; } SetToolTip(); FormEffect.animate(this.Handle, 1000, MemoryAddress.AW_BLEND); }
/// <summary> /// 窗体最小化事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lblSmall_Click(object sender, EventArgs e) { this.WindowState = FormWindowState.Minimized; this.notifyIcon.Visible = true; this.ShowInTaskbar = false; //不显示在系统任务栏 if (mMinCount == 0) //第一次最小化窗体 显示提示 { notifyIcon.BalloonTipText = "最小化到托盘,右键关闭"; notifyIcon.BalloonTipTitle = "提醒"; notifyIcon.ShowBalloonTip(2000); mMinCount++; FormEffect.animate(this.Handle, 100, MemoryAddress.AW_SLIDE + MemoryAddress.AW_HOR_POSITIVE + MemoryAddress.AW_HIDE); } }
//protected override void WndProc(ref Message m) //{ // if (m.Msg == WM_SYSCOMMAND) // { // if (m.WParam.ToInt64() == SC_MAXIMIZE) // { // //MessageBox.Show("MAXIMIZE "); // return; // } // if (m.WParam.ToInt64() == SC_MINIMIZE) // { // //MessageBox.Show("MINIMIZE "); // return; // } // if (m.WParam.ToInt64() == SC_CLOSE) // { // //MessageBox.Show("CLOSE "); // return; // } // } // base.WndProc(ref m); //} #region 窗体拖动 private void easyOpen_MouseDown(object sender, MouseEventArgs e) { FormEffect.drag(Handle); }
private void _title_Panel_MouseDown(object sender, MouseEventArgs e) { FormEffect.drag(Handle); }