private void frmMain_Load(object sender, EventArgs e) { if (ports.Length > 0) { cbbPort.SelectedIndex = 0; } myLayout = new myClass(layout); for (int i = 0; i < 1000; i++) { isstopping[i] = true; active[i] = false; isidle[i] = true; } timer1.Start(); }
private void AddPhong(int phong) { getGiaWithRoom(phong); //if (room[phong] != null) //{ //MessageBox.Show("Adding"); Phong[phong] = new FlowLayoutPanel(); Phong[phong].WrapContents = true; Phong[phong].FlowDirection = FlowDirection.LeftToRight; Phong[phong].Width = layout.Width; Phong[phong].Height = 60; Label lbl = new Label(); lbl.Text = "Phòng " + phong; lbl.Width = 80; lbl.ForeColor = Color.Red; lbl.Font = new Font("Microsoft Sans Serif", 10.0F); Phong[phong].Controls.Add(lbl); Phong[phong].SetFlowBreak(lbl, true); Label from = new Label(); from.Text = Resources.ResourceManager.GetString("from"); from.Width = 30; from.Font = new Font("Microsoft Sans Serif", 10.0F); from.Margin = new Padding(3, 6, 0, 5); Phong[phong].Controls.Add(from); lblFrom[phong] = new Label(); lblFrom[phong].Text = "00:00:00"; lblFrom[phong].ForeColor = Color.Blue; lblFrom[phong].Font = new Font("Microsoft Sans Serif", 15.0F); myFrom[phong] = new myClass(lblFrom[phong]); Phong[phong].Controls.Add(lblFrom[phong]); Label to = new Label(); to.Text = Resources.ResourceManager.GetString("to"); to.Width = 40; to.Font = new Font("Microsoft Sans Serif", 10.0F); to.Margin = new Padding(3, 6, 0, 5); Phong[phong].Controls.Add(to); lblTo[phong] = new Label(); lblTo[phong].Text = "00:00:00"; lblTo[phong].ForeColor = Color.Red; lblTo[phong].Font = new Font("Microsoft Sans Serif", 15.0F); myTo[phong] = new myClass(lblTo[phong]); Phong[phong].Controls.Add(lblTo[phong]); Label end = new Label(); end.Text = Resources.ResourceManager.GetString("total"); end.Width = 103; end.Font = new Font("Microsoft Sans Serif", 10.0F); end.Margin = new Padding(3, 6, 0, 5); Phong[phong].Controls.Add(end); lblEnd[phong] = new Label(); lblEnd[phong].Text = "00:00:00"; lblEnd[phong].ForeColor = Color.Red; lblEnd[phong].Font = new Font("Microsoft Sans Serif", 15.0F); myEnd[phong] = new myClass(lblEnd[phong]); Phong[phong].Controls.Add(lblEnd[phong]); isidle[phong] = false; //layout.Controls.Add(Phong[phong]); myLayout.UpdateMyLayout(Phong[phong]); //} }