private void Bt_Cancel_Click(object sender, EventArgs e) { if (position > -1) { //position--; commands.RemoveAt(commands.Count - 1); if (position == inits_comm_indx[inits_comm_indx.Count - 1]) { inits_comm_indx.RemoveAt(inits_comm_indx.Count - 1); } position--; //inits_comm_indx.RemoveAt(inits_comm_indx.Count - 1); } for (int i = 0; i < inits_comm_indx.Count; i++) { if (position >= inits_comm_indx[inits_comm_indx.Count - i - 1]) { for (int j = inits_comm_indx[inits_comm_indx.Count - i - 1]; j <= position; j++) { graphics.Clear(BackColor); commands[j].Execute(ref matrix, ref drawer, ref Dec, ref graphics); renumDecorator = Dec as RenumDecorator; if (matrix is HGMatrix.HGMatrix) { gMatrix = matrix as HGMatrix.HGMatrix; } } break; } } }
private void bt_HGM_Click(object sender, EventArgs e) { graphics.Clear(BackColor); graphics = pictureBox1.CreateGraphics(); gMatrix = new HGMatrix.HGMatrix(); ICommand command = new HGMCreateCommand(); position++; commands.Add(command); inits_comm_indx.Add(position); }