private void Down_Click(object sender, EventArgs e) { Button btn = (Button)sender; TableLayoutPanel pani = (TableLayoutPanel)btn.Parent.Parent; TableLayoutPanelCellPosition a = STB4.GetCellPosition(pani); if (a.Row + 1 >= STB4.RowCount) { return; } TableLayoutPanel pani2 = (TableLayoutPanel)STB4.GetControlFromPosition(a.Column, a.Row + 1); STB4.SetCellPosition(pani, new TableLayoutPanelCellPosition(a.Column, a.Row + 1)); STB4.SetCellPosition(pani2, a); UpdateActionsListByTabCells(); }
private void Btn2_Click(object sender, EventArgs e) { Button btn = (Button)sender; TableLayoutPanel pani = (TableLayoutPanel)btn.Parent; int max = STB4.Controls.Count; TableLayoutPanelCellPosition pos = STB4.GetCellPosition(pani); TableLayoutPanelCellPosition pos2; TableLayoutPanel[] poss = new TableLayoutPanel[STB4.Controls.Count]; foreach (Control line in STB4.Controls) { pos2 = STB4.GetCellPosition(line); poss[pos2.Row] = (TableLayoutPanel)line; } STB4.Controls.Remove(pani); for (int i = pos.Row; i < STB4.Controls.Count; i++) { STB4.SetCellPosition(poss[i + 1], new TableLayoutPanelCellPosition(0, i)); } UpdateActionsListByTabCells(); Debug.WriteLine(JsonConvert.SerializeObject(Data["actions"])); }