-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfMain.cs
113 lines (96 loc) · 2.87 KB
/
fMain.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Thuc_Tap_CSDL
{
public partial class fMain : Form
{
string status = "";
public fMain()
{
InitializeComponent();
}
public fMain(string name)
{
InitializeComponent();
if (name == "staff")
{
btnFee.Visible = false;
btnSalary.Visible = false;
btnTeacher.Visible = false;
}
status = name;
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnMiniMize_Click(object sender, EventArgs e)
{
WindowState = FormWindowState.Minimized;
}
private void fMain_FormClosing(object sender, FormClosingEventArgs e)
{
if(MessageBox.Show("Đăng xuất?", "Thông báo", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
e.Cancel = true;
}
}
private Form activeForm;
public void openMenuForm(Form childForm, object btnsender)
{
if(activeForm != null)
{
activeForm.Close();
}
activeForm = childForm;
childForm.TopLevel = false;
childForm.FormBorderStyle = FormBorderStyle.None;
childForm.Dock = DockStyle.Fill;
this.pnlDisplay.Controls.Add(childForm);
this.pnlDisplay.Tag = childForm;
childForm.BringToFront();
childForm.Show();
lblTitle.Text = childForm.Text;
}
private void fMain_Load(object sender, EventArgs e)
{
btnStudent.Focus();
openMenuForm(new fStudent(), sender);
}
private void btnStudent_Click(object sender, EventArgs e)
{
openMenuForm(new fStudent(), sender);
}
private void btnTeacher_Click(object sender, EventArgs e)
{
openMenuForm(new fTeacher(), sender);
}
public void btnClass_Click(object sender, EventArgs e)
{
openMenuForm(new fClass(status), sender);
}
private void btnFee_Click(object sender, EventArgs e)
{
openMenuForm(new fFee(), sender);
}
private void btnSalary_Click(object sender, EventArgs e)
{
openMenuForm(new fSalary(), sender);
}
private void btnStatistic_Click(object sender, EventArgs e)
{
openMenuForm(new fStatistic(), sender);
}
private void btnLogout_Click(object sender, EventArgs e)
{
this.Close();
}
}
}