public Form1() { InitializeComponent(); for (int i = 0; i < 2; i++) { arrUC_Large[i] = new UserControl_Large(); arrUC_Large[i].Location = new Point(2, 48 + 105 * i); arrUC_Large[i].event_From_UC_Large += new delegate_MyEventHadler(Form_event_From_UC_Large); this.Controls.Add(arrUC_Large[i]); } }
public Form1() { InitializeComponent(); for (int i = 0; i < 2; i++) { arrUC_Large[i] = new UserControl_Large(); arrUC_Large[i].Location = new Point(2, 48 + 105 * i); this.Controls.Add(arrUC_Large[i]); arrUC_Large[i].rowClickEvent += new UserControl_Large.OnRowClickEvent((large, small, color) => { rowClickEvent?.Invoke(small, large, color, this); }); } }
private Control getPreferredControl(List <Control> combined, Form1 form1, UserControl_Large large1, string color) { var result = combined .OrderBy(control => control.Size.Height * control.Size.Width) .Where(control => // color { return(color == "White" ? isWhite(control.BackColor) : !isWhite(control.BackColor)); }) .Where(control => // type { return(control.GetType() == form1.MinMax_LabelButton.GetType()); }); return(form1.getMinMax() == "Min" ? result.First() : result.Last()); }
private void onRowClick(UserControl_Small small, UserControl_Large large, string color, Form1 form) { if (state == State.NONE) { small1 = small; large1 = large; color1 = color; form1 = form; state = State.ONCE; } else { // ignore clicks on the same control if (small1 == small) { return; } small2 = small; large2 = large; color2 = color; form2 = form; doLogic(); small2 = null; large2 = null; color2 = null; form2 = null; small1 = null; large1 = null; color1 = null; form1 = null; state = State.NONE; } }