Ejemplo n.º 1
0
        private void deleteAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CommandDeleteAll command = new CommandDeleteAll(drawArea.GraphicsList);

            if (drawArea.GraphicsList.Clear())
            {
                drawArea.SetDirty();
                drawArea.Refresh();
                drawArea.AddCommandToHistory(command);
            }
        }
Ejemplo n.º 2
0
        private void deleteAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int x = drawArea.TheLayers.ActiveLayerIndex;
            CommandDeleteAll command = new CommandDeleteAll(drawArea.TheLayers);

            if (drawArea.TheLayers[x].Graphics.Clear())
            {
                drawArea.Refresh();
                drawArea.AddCommandToHistory(command);
            }
        }
Ejemplo n.º 3
0
 private void deleteAllToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //删除所有
     try
     {
         CommandDeleteAll command = new CommandDeleteAll(currentlyDrawForm.getDrawArea().GraphicsList);
         command.Execute();
         currentlyDrawForm.getDrawArea().SetDirty();
         currentlyDrawForm.getDrawArea().Refresh();
         currentlyDrawForm.getDrawArea().AddCommandToHistory(command);
     }
     catch (Exception ex)
     {
         MessageBox.Show("删除所有设备发生异常:" + ex);
     }
 }
Ejemplo n.º 4
0
        private void deleteAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CommandDeleteAll command = new CommandDeleteAll(drawArea.GraphicsList);

            if (drawArea.GraphicsList.Clear())
            {
                drawArea.SetDirty();
                drawArea.Refresh();
                drawArea.AddCommandToHistory(command);
            }
        }
Ejemplo n.º 5
0
        private void ExecuteCommand(string command)
        {
            ResizeDrawArea();

            this.drawArea.Visible = true;

            if (command != "text")
            {
                this.drawArea.ToolTextBox.Visible = false;
            }

            this.myColorPicker.SwitchMode(command == "text");

            switch (command)
            {
                case "pointer":
                    drawArea.ActiveTool = DrawArea.DrawToolType.Pointer;
                    break;
                case "rectangle":
                    drawArea.ActiveTool = DrawArea.DrawToolType.Rectangle;
                    break;
                case "ellipse":
                    drawArea.ActiveTool = DrawArea.DrawToolType.Ellipse;
                    break;
                case "line":
                    drawArea.ActiveTool = DrawArea.DrawToolType.Line;
                    break;
                case "arrow":
                    drawArea.ActiveTool = DrawArea.DrawToolType.Arrow;
                    break;
                case "pencil":
                    drawArea.ActiveTool = DrawArea.DrawToolType.Polygon;
                    break;
                case "text":
                    drawArea.ActiveTool = DrawArea.DrawToolType.Text;
                    break;
                case "undo":
                    drawArea.Undo();
                    break;
                case "redo":
                    drawArea.Redo();
                    break;
                case "save":
                    CommandSave();
                    break;
                case "complete":
                    CommandComplete();
                    break;
                case "properties":
                    if (drawArea.GraphicsList.ShowPropertiesDialog(drawArea))
                    {
                        drawArea.SetDirty();
                        drawArea.Refresh();
                    }
                    break;
                case "selectall":
                    drawArea.GraphicsList.SelectAll();
                    drawArea.Refresh();
                    break;
                case "unselectall":
                    drawArea.GraphicsList.UnselectAll();
                    drawArea.Refresh();
                    break;
                case "delete":
                    CommandDelete c = new CommandDelete(drawArea.GraphicsList);

                    if (drawArea.GraphicsList.DeleteSelection())
                    {
                        drawArea.SetDirty();
                        drawArea.Refresh();
                        drawArea.AddCommandToHistory(c);
                    }
                    break;
                case "deleteall":
                    CommandDeleteAll cc = new CommandDeleteAll(drawArea.GraphicsList);

                    if (drawArea.GraphicsList.Clear())
                    {
                        drawArea.SetDirty();
                        drawArea.Refresh();
                        drawArea.AddCommandToHistory(cc);
                    }
                    break;
                case "movetofront":
                    if (drawArea.GraphicsList.MoveSelectionToFront())
                    {
                        drawArea.SetDirty();
                        drawArea.Refresh();
                    }
                    break;
                case "movetoback":
                    if (drawArea.GraphicsList.MoveSelectionToBack())
                    {
                        drawArea.SetDirty();
                        drawArea.Refresh();
                    }
                    break;

                case "about":
                    FrmAbout frm = new FrmAbout();
                    frm.ShowDialog(this);
                    break;
                case "new":
                    docManager.NewDocument(); break;
                case "open":
                    docManager.OpenDocument(""); break;
                case "saveas":
                    docManager.SaveDocument(DocManager.SaveType.SaveAs);
                    break;
                case "exit":
                    this.Exit();
                    break;
                case "preferences":
                    Form sf = new SettingForm();
                    sf.Show();
                    break;
            }
        }