frm_Main.cs
3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
using HHWCS.Common;
using HHWCS.Model;
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 HHWCS.View
{
public partial class Frm_Main : Form
{
#region 属性
public User user { get; set; }
#endregion
#region 子窗体定义
/// <summary>
/// 任务信息
/// </summary>
public Frm_TaskInfo Frm_TaskInfo { get; set; }
#endregion
public Frm_Main()
{
InitializeComponent();
lab_Status1.Text = "操作员:" + APP.User.UserName;
lab_Status2.Text ="登录时间:" + DateTime.Now;
lab_Status3.Text = "远程连接正常。";
}
#region 窗体事件
/// <summary>
/// 用于改变背景色
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frm_Main_Load(object sender, EventArgs e)
{
foreach (Control ctl in this.Controls)
{
try
{
MdiClient ctlMDI;
// Attempt to cast the control to type MdiClient.
ctlMDI = (MdiClient)ctl;
ctlMDI.Margin = new Padding(0);
// Set the BackColor of the MdiClient control.
ctlMDI.BackColor = this.BackColor;
}
catch (InvalidCastException exc)
{
// Catch and ignore the error if casting failed.
}
}
}
#endregion
#region 窗口
private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.Cascade);
}
private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.TileVertical);
}
private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.TileHorizontal);
}
private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)
{
LayoutMdi(MdiLayout.ArrangeIcons);
}
private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (Form childForm in MdiChildren)
{
childForm.Close();
}
}
#endregion
#region 响应事件
private void menu_402_Click(object sender, EventArgs e)
{
if (Frm_TaskInfo == null || Frm_TaskInfo.IsDisposed)
{
Frm_TaskInfo = new Frm_TaskInfo();
Frm_TaskInfo.MdiParent = this;
}
Frm_TaskInfo.Show();
if (Frm_TaskInfo.WindowState == FormWindowState.Minimized)
Frm_TaskInfo.WindowState = FormWindowState.Normal;
Frm_TaskInfo.Activate();
}
#endregion
/// <summary>
/// 程序退出
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void frm_Main_FormClosing(object sender, FormClosingEventArgs e)
{
Application.Exit();
}
}
}