public frmMain() { InitializeComponent(); this.KeyPreview = true; this.KeyDown += new KeyEventHandler(frmMain_KeyDown); nv = new ucNhanVien(); custom = new ucCustomer(); reg = new ucRegister(); login = new ucLogin(); vehicle = new ucVehicle(); tt = new ucThanhToan(); bill = new ucBill(); denbu = new ucPhieuDenBu(); this.login.parentForm = this; this.reg.parentForm = this; this.bill.parentForm = this; this.denbu.parentForm = this; this.tt.parentForm = this; this.panelForm.Controls.Clear(); this.panel1.Controls.Add(this.labelYear); this.labelYear.Location = new System.Drawing.Point(12, 423); this.panel1.Controls.Add(this.labelTime); this.labelTime.Location = new System.Drawing.Point(13, 465); this.panel1.Controls.Clear(); this.panel1.Controls.Add(this.btnHoaDon); this.btnHoaDon.Dock = DockStyle.Top; this.panel1.Controls.Add(this.btnLogin); this.btnLogin.Dock = DockStyle.Top; this.panel1.Controls.Add(this.btnVehicle); this.btnVehicle.Dock = DockStyle.Top; this.panel1.Controls.Add(this.btnThanhToan); this.btnThanhToan.Dock = DockStyle.Top; this.panel1.Controls.Add(this.btnNhanVien); this.btnNhanVien.Dock = DockStyle.Top; this.panel1.Controls.Add(this.btnCustomer); this.btnCustomer.Dock = DockStyle.Top; this.btnLogin.Dock = DockStyle.Top; this.panel1.Controls.Add(this.btnLogin); this.panelForm.Controls.Add(new ucBackGround()); }
private void btnLogin_Click(object sender, EventArgs e) { if (tk.Login(txtUserName.Text, txtPassWord.Text)) { frmMain.chuadangnhap = false; n_Status.ForeColor = Color.Green; n_Status.Text = "Đăng nhập thành công, giờ đây bạn có thể sử dụng!!"; AutoClosingMessageBox.Show(" Đăng Nhập thành công!! \nXin chào: " + txtUserName.Text, "Thông báo", 2000); { ucVehicle vh = new ucVehicle(); controlUserControl.showControl(vh, parentForm.panelForm); } } else { n_Status.ForeColor = Color.Red; n_Status.Text = "Tên tài khoản hoặc mật khẩu không đúng. Vui lòng nhập lại"; } }