yantian yue
2023-12-29 fdda48e034b2da82fb100ec04f5b51351477e2bb
提交 | 用户 | 时间
e46d3b 1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9 using WeifenLuo.WinFormsUI.Docking;
10 using YX.BLL;
11
12 namespace YX
13 {
14     public partial class FrmMain : DockContent
15     {
16         public FrmMain()
17         {      
18             InitializeComponent();        
19         }
20
21         private void Main_Load(object sender, EventArgs e)
22         {
23             this.dockPanel1.DockLeftPortion = 200;//左侧菜单宽度
24             new FrmLeft(this).Show(this.dockPanel1, DockState.DockLeft);
25             new Frmhome("").Show(this.dockPanel1,DockState.Document);
26             this.toolStripLabel1.Text = "当前账号:"+FrmLogin.loginUserName;
27         }
28
29         private void Main_FormClosing(object sender, FormClosingEventArgs e)
30         {
31             if (MessageBox.Show("是否确认退出程序?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
32             {
33                 LogHelper.WriteLog(typeof(FrmMain), "************软件关闭***********");              
34                 notifyIcon1.Visible = true;
35                 notifyIcon1.Dispose();
36                 this.Dispose();
37                 Environment.Exit(0);               
38             }
39             else
40             {
41                 e.Cancel = true;
42             }
43         }
44
45         private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
46         {
47             //判断是否已经最小化于托盘
48             if (WindowState == FormWindowState.Minimized)
49             {
50                 //还原窗体显示 
51                 WindowState = FormWindowState.Normal;
52                 //激活窗体并给予它焦点 
53                this.Activate();
54                 //任务栏区显示图标 
55                 this.ShowInTaskbar = true;
56                 //托盘区图标隐藏 
57                 notifyIcon1.Visible = true;
58             }
59         }
60
61         private void toolStripButton1_Click(object sender, EventArgs e)
62         {
63             this.Dispose();
64             FrmLogin login = new FrmLogin();
65             login.Show();
66         }
67
68         private void toolStripButton2_Click(object sender, EventArgs e)
69         {
70             this.Close();
71         }
72     }
73 }