private void swapControls(int index1, int index2) { DataShowControl swap = dataControlsCopy.ElementAt(index1); dataControlsCopy[index1] = dataControlsCopy[index2]; dataControlsCopy[index2] = swap; }
private void DataShowControl_Enter(object sender, EventArgs e) { this.enterDataControl = (sender as DataShowControl); leftButton.Enabled = rightButton.Enabled = true; if (dataControlsCopy.IndexOf(enterDataControl) == 0) { leftButton.Enabled = false; } if (dataControlsCopy.IndexOf(enterDataControl) == dataControls.Count - 1) { rightButton.Enabled = false; } }
private void dataDeleteButton_Click(object sender, EventArgs e) { Button bt = (sender as Button); string id = bt.Name.Split('_').Last(); DataShowControl dataControl = dataControlsCopy.Find((control) => { return(control.Name.Split('_').Last() == id); }); DialogResult result = MessageBox.Show("Are you sure to delete " + dataControl.label.Text, "Warn", MessageBoxButtons.YesNo); if (result == DialogResult.No) { return; } dataControl.Hide(); dataControlsCopy.Remove(dataControl); this.ActiveControl = null; leftButton.Enabled = false; rightButton.Enabled = false; }