public UserControl_Large() { InitializeComponent(); for (int i = 0; i < 2; i++) { arrUC_Small[i] = new UserControl_Small(); arrUC_Small[i].Location = new Point(63, 2 + 49 * i); arrUC_Small[i].event_From_UC_Small += new delegate_MyEventHadler(UC_Large_event_From_UC_Small); this.Controls.Add(arrUC_Small[i]); } }
void Arrange(UserControl_Small UC_Small, List <Control> myList, int[] arrIndexes) { int currPosition = 2; for (int i = 0; i < arrIndexes.Length; i++) { Control tempControl = myList[arrIndexes[i]]; tempControl.Location = new Point(currPosition, 2); UC_Small.Controls.Add(tempControl); currPosition += tempControl.Width + 2; } }
public UserControl_Large() { InitializeComponent(); for (int i = 0; i < 2; i++) { arrUC_Small[i] = new UserControl_Small(); arrUC_Small[i].Location = new Point(63, 2 + 49 * i); this.Controls.Add(arrUC_Small[i]); arrUC_Small[i].Click += new EventHandler((sender, e) => { rowClickEvent?.Invoke(this, (UserControl_Small)sender, this.radioButtonWhite.Checked ? "White" : "Color"); }); } }
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; } }