/// <summary> /// 选中当前大屏控件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ScreenSelected(object sender, EventArgs e) { if (sender is screenCtr) { selectedScreen = sender as screenCtr; if (ScreenSelectChanged != null) { ScreenSelectChanged(sender, e); } } }
private void InitialScreenCtrs() { //先清空 flowLayoutPanel1.Controls.Clear(); //逐个增加大屏控件 if (ScreenDictDT != null && ScreenDictDT.Rows.Count > 0) { screenCtrList = new List <screenCtr>(); foreach (DataRow dr in ScreenDictDT.Rows) { screenCtr ctr = new screenCtr(dr); ctr.Padding = new System.Windows.Forms.Padding(2); ctr.Margin = new System.Windows.Forms.Padding(40, 10, 20, 10); ctr.ScreenSelecting += ScreenSelecting; ctr.ScreenSelected += ScreenSelected; flowLayoutPanel1.Controls.Add(ctr); ctr.IsSelected = false; screenCtrList.Add(ctr); } //screenCtrList[0].IsSelected = true; } }
private void ScreenSelecting(object sender, EventArgs e) { screenCtr selectingScreen = sender as screenCtr; selectingScreen.canSelect = selectedScreen == null; }