public void DeleteLayout(int index) { PictureLayout pictureLayout = Layouts[index]; watched = false; if (pictureLayout is StandardLayout standardLayout) { standardLayout.Deactivate(); } if (PaintAgent.CurrentLayout == pictureLayout) { PaintAgent.CurrentLayout = null; } Layouts.RemoveAt(index); watched = true; UndoManager.AddUndoData(new CMD_RecoverLayout(pictureLayout, this, index)); }