/// <summary> /// 动态生成房源控件 /// </summary> private void CreateRoomLable() { //string state = string.Empty; for (int i = 1; i <= 50; i++) { var my = new RoomLable(this, 100, 120, i.ToString("10000")); //int s = GetState(ref state, i); //my.SetRoomInfo(brushstr[s], state, "20.00"); flowLayoutPanel1.Controls.Add(my); //Application.DoEvents(); } }
public void GetRoomListByState(string state) { //state = "状态:" + state; if (RoomLables == null || !RoomLables.Any()) { ShowRoom(); } flowLayoutPanel1.Controls.Clear(); RoomLable[] roomArry = new RoomLable[] { }; if (string.IsNullOrEmpty(state)) { roomArry = RoomLables.ToArray(); } else { roomArry = RoomLables.Where(a => a.State == state).ToArray(); } flowLayoutPanel1.Controls.AddRange(roomArry); }