-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDashboardForm.cs
155 lines (131 loc) · 4.73 KB
/
DashboardForm.cs
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace Gamey
{
public partial class DashboardForm : Form
{
[DllImport("user32.DLL", EntryPoint = "ReleaseCapture")]
private extern static void ReleaseCapture();
[DllImport("user32.DLL", EntryPoint = "SendMessage")]
private extern static void SendMessage(System.IntPtr hWnd, int wMsg, int wParam, int lParam);
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn")]
private static extern IntPtr CreateRoundRectRgn
(
int nLeftRect,
int nTopRect,
int nRightRect,
int nBottomRect,
int nWidthEllipse,
int nHeightEllipse
);
public DashboardForm(string username)
{
InitializeComponent();
Region = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 25, 25));
timeTimer.Start();
userNameLabel.Text = username;
stdPanel.Visible = false;
coursePanel.Visible = false;
}
private void exitButton_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void minButton_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Minimized;
}
private void ProductForm_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, 0x112, 0xf012, 0);
}
private void timeTimer_Tick(object sender, EventArgs e)
{
timeLabel.Text = DateTime.Now.ToString("HH:mm");
}
private void stdButton_Click(object sender, EventArgs e)
{
stdPanel.Visible = !stdPanel.Visible;
}
private void courseButton_Click(object sender, EventArgs e)
{
coursePanel.Visible = !coursePanel.Visible;
}
private void logOutButton_Click(object sender, EventArgs e)
{
this.Hide();
LoginForm loginForm = new LoginForm();
loginForm.Show();
}
private void courseManageButton_Click(object sender, EventArgs e)
{
welcomeLabel.Text = "";
pleaseLabel.Text = "";
if (ActiveMdiChild != null)
ActiveMdiChild.Close();
this.IsMdiContainer = true;
CourseForm courseForm = new CourseForm();
courseForm.MdiParent = this;
courseForm.FormBorderStyle = FormBorderStyle.None;
courseForm.Dock = DockStyle.Fill;
courseForm.Show();
}
private void stdManageButton_Click(object sender, EventArgs e)
{
welcomeLabel.Text = "";
pleaseLabel.Text = "";
if (ActiveMdiChild != null)
ActiveMdiChild.Close();
this.IsMdiContainer = true;
StudentForm studentForm = new StudentForm();
studentForm.MdiParent = this;
studentForm.FormBorderStyle = FormBorderStyle.None;
studentForm.Dock = DockStyle.Fill;
studentForm.Show();
}
private void stdListButton_Click(object sender, EventArgs e)
{
welcomeLabel.Text = "";
pleaseLabel.Text = "";
if (ActiveMdiChild != null)
ActiveMdiChild.Close();
this.IsMdiContainer = true;
StudentList studentList = new StudentList();
studentList.MdiParent = this;
studentList.FormBorderStyle = FormBorderStyle.None;
studentList.Dock = DockStyle.Fill;
studentList.Show();
}
private void courseListButton_Click(object sender, EventArgs e)
{
welcomeLabel.Text = "";
pleaseLabel.Text = "";
if (ActiveMdiChild != null)
ActiveMdiChild.Close();
this.IsMdiContainer = true;
CourseList courseList = new CourseList();
courseList.MdiParent = this;
courseList.FormBorderStyle = FormBorderStyle.None;
courseList.Dock = DockStyle.Fill;
courseList.Show();
}
private void panel2_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, 0x112, 0xf012, 0);
}
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, 0x112, 0xf012, 0);
}
private void panel3_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, 0x112, 0xf012, 0);
}
}
}