CommandAdd.cs
上传用户:sxsgcs
上传日期:2013-10-21
资源大小:110k
文件大小:1k
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace DrawTools
- {
- /// <summary>
- /// Add new object command
- /// </summary>
- class CommandAdd : Command
- {
- DrawObject drawObject;
- // Create this command with DrawObject instance added to the list
- public CommandAdd(DrawObject drawObject) : base()
- {
- // Keep copy of added object
- this.drawObject = drawObject.Clone();
- }
- public override void Undo(GraphicsList list)
- {
- list.DeleteLastAddedObject();
- }
- public override void Redo(GraphicsList list)
- {
- list.UnselectAll();
- list.Add(drawObject);
- }
- }
- }