public void XuLyBanCo() { int UserHienTai = this.DLBC.UserHienTai; DuLieu.DuLieuUser UserInfo = (DuLieu.DuLieuUser) this.DLBC.arrUsers[UserHienTai - 1]; for (int i = 0; i < UserInfo.SoQuanCo; i++) { XuLy.QuanCo qc = (XuLy.QuanCo)UserInfo.arrQC[i]; qc.QCTH.dlbc = this.DLBC; qc.QCTH.dlqc = qc.QCDL; qc.QCTH.User = UserInfo; qc.QCTH.TrangThaiClick = true; } }
//Da Quan public void DaQuan(int vtTrenBC) { int QuanMau = dlbc.arrBC[vtTrenBC]; DuLieu.DuLieuUser User = (DuLieu.DuLieuUser)dlbc.arrUsers[QuanMau - 1]; for (int i = 0; i < User.SoQuanCo; i++) { XuLy.QuanCo qc = (XuLy.QuanCo)User.arrQC[i]; if (qc.QCDL.ViTriTrenBanCo == vtTrenBC) { qc.QCTH.picQC.Location = new Point(qc.QCDL.ViTriTrongChuong.X, qc.QCDL.ViTriTrongChuong.Y); qc.QCDL.ViTriTrenBanCo = -1; return; } } }
//tao cac quan tren bc public void TaoViTriQuan(Point vtCB, int i, DuLieu.DuLieuUser User, System.Windows.Forms.Panel panel) { Point p; int X = -24, Y = -24; if (i == 1) { Y = -Y; } if (i == 2) { X = -X; Y = -Y; } if (i == 3) { X = -X; } for (int j = 0; j < User.SoQuanCo; j++) { if (j == 0 || j == 2 || j == 4) { p = new Point(vtCB.X + (j / 2 * X), vtCB.Y); } else { p = new Point(vtCB.X + ((j - 1) / 2 * X), vtCB.Y + Y); } XuLy.QuanCo qc = (XuLy.QuanCo)User.arrQC[j]; qc.QCDL.ViTriTrongChuong = p; qc.QCDL.ViTriTrenBanCo = -1; qc.QCDL.ViTriRaQuan = i * 14; if (qc.QCDL.ViTriRaQuan == 0) { qc.QCDL.ViTriVeDich = 55; } else { qc.QCDL.ViTriVeDich = qc.QCDL.ViTriRaQuan - 1; } qc.QCDL.MauCo = i + 1; qc.QCTH.picQC.Location = new Point(qc.QCDL.ViTriTrongChuong.X, qc.QCDL.ViTriTrongChuong.Y); qc.QCTH.HienThi(i + 1); panel.Controls.Add(qc.QCTH.picQC); } }
public void picQC_Click(object sender, System.EventArgs e) { if (TrangThaiClick == true) { if (ThucHienNuocDi() == 1) { TrangThaiClick = false; for (int i = 0; i < User.SoQuanCo; i++) { XuLy.QuanCo qc = (XuLy.QuanCo)User.arrQC[i]; if (qc.QCTH.TrangThaiClick == true) { qc.QCTH.TrangThaiClick = false; } } } } }