Пример #1
0
        /// <summary>
        /// 初始化工具栏布局
        /// </summary>
        void SetupLayerToolstrip()
        {
            StatusStrip status = m_menuItems.GetStatusStrip("status");

            m_mousePosLabel.AutoSize    = true;
            m_mousePosLabel.BorderSides = ToolStripStatusLabelBorderSides.Left | ToolStripStatusLabelBorderSides.Right;
            m_mousePosLabel.Size        = new System.Drawing.Size(110, 17);
            status.Items.Add(m_mousePosLabel);

            m_snapInfoLabel.AutoSize    = true;
            m_snapInfoLabel.BorderSides = ToolStripStatusLabelBorderSides.Left | ToolStripStatusLabelBorderSides.Right;
            m_snapInfoLabel.Size        = new System.Drawing.Size(200, 17);
            status.Items.Add(m_snapInfoLabel);

            //m_drawInfoLabel.AutoSize = true;
            m_drawInfoLabel.Spring      = true;
            m_drawInfoLabel.BorderSides = ToolStripStatusLabelBorderSides.Left | ToolStripStatusLabelBorderSides.Right;
            m_drawInfoLabel.TextAlign   = ContentAlignment.MiddleLeft;
            m_drawInfoLabel.Size        = new System.Drawing.Size(200, 17);
            status.Items.Add(m_drawInfoLabel);

            ToolStrip strip = m_menuItems.GetStrip("layer");

            strip.Items.Add(new ToolStripLabel("Active Layer"));

            m_layerCombo.DropDownStyle = ComboBoxStyle.DropDownList;
            int index = 1;

            foreach (DrawingLayer layer in m_data.Layers)
            {
                if (index >= 5)
                {
                    break;
                }
                string name = string.Format("({0}) - {1}", index, layer.Name);

                MenuItem mmitem = m_menuItems.GetItem(name);
                mmitem.Text      = name;
                mmitem.Image     = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.ArcCR);
                mmitem.Click    += new EventHandler(OnLayerSelect);
                mmitem.SingleKey = Keys.D0 + index;
                mmitem.Tag       = new CommonTools.NameObject <DrawingLayer>(mmitem.Text, layer);

                m_layerCombo.Items.Add(new CommonTools.NameObject <DrawingLayer>(mmitem.Text, layer));
                m_layerCombo.SelectedIndexChanged += mmitem.Click;

                index++;
            }
            strip.Items.Add(m_layerCombo);
        }
Пример #2
0
        /// <summary>
        /// 初始化菜单项
        /// </summary>
        void SetupMenuItems()
        {
            MenuItem mmitem = m_menuItems.GetItem("Undo");

            mmitem.Text         = "Undo";
            mmitem.Image        = MenuImages16x16.Image(MenuImages16x16.eIndexes.Undo);
            mmitem.ToolTipText  = "Undo (Ctrl-Z)";
            mmitem.Click       += new EventHandler(OnUndo);
            mmitem.ShortcutKeys = Shortcut.CtrlZ;

            mmitem              = m_menuItems.GetItem("Redo");
            mmitem.Text         = "Redo";
            mmitem.ToolTipText  = "Undo (Ctrl-Y)";
            mmitem.Image        = MenuImages16x16.Image(MenuImages16x16.eIndexes.Redo);
            mmitem.Click       += new EventHandler(OnRedo);
            mmitem.ShortcutKeys = Shortcut.CtrlY;

            mmitem             = m_menuItems.GetItem("Select");
            mmitem.Text        = "Select";
            mmitem.ToolTipText = "Select (Esc)";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Select);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.ShortcutKeyDisplayString = "Esc";
            mmitem.SingleKey = Keys.Escape;
            mmitem.Tag       = "select";

            mmitem             = m_menuItems.GetItem("Pan");
            mmitem.Text        = "Pan";
            mmitem.ToolTipText = "Pan (P)";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Pan);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.ShortcutKeyDisplayString = "P";
            mmitem.SingleKey = Keys.P;
            mmitem.Tag       = "pan";

            mmitem             = m_menuItems.GetItem("Move");
            mmitem.Text        = "Move";
            mmitem.ToolTipText = "Move (M)";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Move);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.ShortcutKeyDisplayString = "M";
            mmitem.SingleKey = Keys.M;
            mmitem.Tag       = "move";

            ToolStrip strip = m_menuItems.GetStrip("edit");

            strip.Items.Add(m_menuItems.GetItem("Select").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Pan").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Move").CreateButton());
            strip.Items.Add(new ToolStripSeparator());
            strip.Items.Add(m_menuItems.GetItem("Undo").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Redo").CreateButton());

            ToolStripMenuItem menu = m_menuItems.GetMenuStrip("edit");

            menu.MergeAction = System.Windows.Forms.MergeAction.Insert;
            menu.MergeIndex  = 1;
            menu.Text        = "&Edit";
            menu.DropDownItems.Add(m_menuItems.GetItem("Undo").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("Redo").CreateMenuItem());
            menu.DropDownItems.Add(new ToolStripSeparator());
            menu.DropDownItems.Add(m_menuItems.GetItem("Select").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("Pan").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("Move").CreateMenuItem());
        }
Пример #3
0
        /// <summary>
        /// 初始化绘图工具
        /// </summary>
        void SetupDrawTools()
        {
            MenuItem mmitem = m_menuItems.GetItem("Lines");

            mmitem.Text        = "Lines";
            mmitem.ToolTipText = "Lines (L)";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Line);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.SingleKey   = Keys.L;
            mmitem.ShortcutKeyDisplayString = "L";
            mmitem.Tag = "lines";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.LineEdit(false));

            mmitem             = m_menuItems.GetItem("Line");
            mmitem.Text        = "Line";
            mmitem.ToolTipText = "Single line (S)";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Line);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.SingleKey   = Keys.S;
            mmitem.ShortcutKeyDisplayString = "S";
            mmitem.Tag = "singleline";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.LineEdit(true));

            #region 添加的矩形工具

            mmitem             = m_menuItems.GetItem("Rectangle");
            mmitem.Text        = "Rectangle";
            mmitem.ToolTipText = "Rectangle (R)";
            //mmitem.Image = ;
            mmitem.Click    += new EventHandler(OnToolSelect);
            mmitem.SingleKey = Keys.R;
            mmitem.ShortcutKeyDisplayString = "R";
            mmitem.Tag = "rectangle";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.RectangleEdit());

            #endregion

            mmitem             = m_menuItems.GetItem("Circle2P");
            mmitem.Text        = "Circle 2P";
            mmitem.ToolTipText = "Circle 2 point";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Circle2P);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.Tag         = "circle2P";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.Circle(DrawTools.Arc.eArcType.type2point));

            mmitem             = m_menuItems.GetItem("CircleCR");
            mmitem.Text        = "Circle CR";
            mmitem.ToolTipText = "Circle Center-Radius";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.CircleCR);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.SingleKey   = Keys.C;
            mmitem.ShortcutKeyDisplayString = "C";
            mmitem.Tag = "circleCR";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.Circle(DrawTools.Arc.eArcType.typeCenterRadius));

            mmitem             = m_menuItems.GetItem("Arc2P");
            mmitem.Text        = "Arc 2P";
            mmitem.ToolTipText = "Arc 2 point";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Arc2P);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.Tag         = "arc2P";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.Arc(DrawTools.Arc.eArcType.type2point));

            mmitem             = m_menuItems.GetItem("Arc3P132");
            mmitem.Text        = "Arc 3P";
            mmitem.ToolTipText = "Arc 3 point (Start / End / Include)";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Arc3P132);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.Tag         = "arc3P132";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.Arc3Point(DrawTools.Arc3Point.eArcType.kArc3P132));

            mmitem             = m_menuItems.GetItem("Arc3P123");
            mmitem.Text        = "Arc 3P";
            mmitem.ToolTipText = "Arc 3 point (Start / Include / End)";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Arc3P123);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.Tag         = "arc3P123";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.Arc3Point(DrawTools.Arc3Point.eArcType.kArc3P123));

            mmitem             = m_menuItems.GetItem("ArcCR");
            mmitem.Text        = "Arc CR";
            mmitem.ToolTipText = "Arc Center-Radius";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.ArcCR);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.SingleKey   = Keys.A;
            mmitem.ShortcutKeyDisplayString = "A";
            mmitem.Tag = "arcCR";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.Arc(DrawTools.Arc.eArcType.typeCenterRadius));

            ToolStrip strip = m_menuItems.GetStrip("draw");
            strip.Items.Add(m_menuItems.GetItem("Lines").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Rectangle").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Circle2P").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("CircleCR").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Arc2P").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("ArcCR").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Arc3P132").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Arc3P123").CreateButton());

            ToolStripMenuItem menu = m_menuItems.GetMenuStrip("draw");
            menu.MergeAction = System.Windows.Forms.MergeAction.Insert;
            menu.MergeIndex  = 2;
            menu.Text        = "Draw &Tools";
            menu.DropDownItems.Add(m_menuItems.GetItem("Lines").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("Line").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("Rectangle").CreateMenuItem());//矩形工具
            menu.DropDownItems.Add(m_menuItems.GetItem("Circle2P").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("CircleCR").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("Arc2P").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("ArcCR").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("Arc3P132").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("Arc3P123").CreateMenuItem());
        }
Пример #4
0
        void SetupDrawTools()
        {
            MenuItem mmitem = m_menuItems.GetItem("Lines");

            mmitem.Text        = "Lines";
            mmitem.ToolTipText = "Lines (L)";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Line);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.SingleKey   = Keys.L;
            mmitem.ShortcutKeyDisplayString = "L";
            mmitem.Tag = "lines";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.LineEdit(false));

            mmitem             = m_menuItems.GetItem("Line");
            mmitem.Text        = "Line";
            mmitem.ToolTipText = "Single line (S)";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Line);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.SingleKey   = Keys.S;
            mmitem.ShortcutKeyDisplayString = "S";
            mmitem.Tag = "singleline";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.LineEdit(true));

            //mmitem = m_menuItems.GetItem("Circle2P");
            //mmitem.Text = "Circle 2P";
            //mmitem.ToolTipText = "Circle 2 point";
            //mmitem.Image = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Circle2P);
            //mmitem.Click += new EventHandler(OnToolSelect);
            //mmitem.Tag = "circle2P";
            //m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.Circle(DrawTools.Arc.eArcType.type2point));

            //	mmitem = m_menuItems.GetItem("CircleCR");
            //	mmitem.Text = "Circle CR";
            //	mmitem.ToolTipText = "Circle Center-Radius";
            //	mmitem.Image = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.CircleCR);
            //	mmitem.Click += new EventHandler(OnToolSelect);
            ////	mmitem.SingleKey = Keys.C;
            //	mmitem.ShortcutKeyDisplayString = "C";
            //	mmitem.Tag = "circleCR";
            //	m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.Circle(DrawTools.Arc.eArcType.typeCenterRadius));

            //	mmitem = m_menuItems.GetItem("Arc2P");
            //	mmitem.Text = "Arc 2P";
            //	mmitem.ToolTipText = "Arc 2 point";
            //	mmitem.Image = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Arc2P);
            //	mmitem.Click += new EventHandler(OnToolSelect);
            //	mmitem.Tag = "arc2P";
            //	m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.Arc(DrawTools.Arc.eArcType.type2point));

            //	mmitem = m_menuItems.GetItem("Arc3P132");
            //	mmitem.Text = "Arc 3P";
            //	mmitem.ToolTipText = "Arc 3 point (Start / End / Include)";
            //	mmitem.Image = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Arc3P132);
            //	mmitem.Click += new EventHandler(OnToolSelect);
            //	mmitem.Tag = "arc3P132";
            //	m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.Arc3Point(DrawTools.Arc3Point.eArcType.kArc3P132));

            //	mmitem = m_menuItems.GetItem("Arc3P123");
            //	mmitem.Text = "Arc 3P";
            //	mmitem.ToolTipText = "Arc 3 point (Start / Include / End)";
            //	mmitem.Image = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Arc3P123);
            //	mmitem.Click += new EventHandler(OnToolSelect);
            //	mmitem.Tag = "arc3P123";
            //	m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.Arc3Point(DrawTools.Arc3Point.eArcType.kArc3P123));

            //	mmitem = m_menuItems.GetItem("ArcCR");
            //	mmitem.Text = "Arc CR";
            //	mmitem.ToolTipText = "Arc Center-Radius";
            //	mmitem.Image = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.ArcCR);
            //	mmitem.Click += new EventHandler(OnToolSelect);
            //	mmitem.SingleKey = Keys.A;
            //	mmitem.ShortcutKeyDisplayString = "A";
            //	mmitem.Tag = "arcCR";
            //	m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.Arc(DrawTools.Arc.eArcType.typeCenterRadius));

            mmitem             = m_menuItems.GetItem("Bezier");
            mmitem.Text        = "Bezier";
            mmitem.ToolTipText = "Bezier curve";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.BezierCurve);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.Tag         = "cubicBezier";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.CubicBezier());

            mmitem             = m_menuItems.GetItem("Oval");
            mmitem.Text        = "Oval";
            mmitem.ToolTipText = "Oval";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Oval);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.Tag         = "oval";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.OvalShape());

            mmitem             = m_menuItems.GetItem("Rectangle");
            mmitem.Text        = "Rectangle";
            mmitem.ToolTipText = "Rectangle";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.Rectangle);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.Tag         = "rectangle";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.RectangleShape());

            mmitem             = m_menuItems.GetItem("MultiConnectionLines");
            mmitem.Text        = "MultiConnectionLines";
            mmitem.ToolTipText = "MultiConnectionLines";
            mmitem.Image       = DrawToolsImages16x16.Image(DrawToolsImages16x16.eIndexes.MultiConnectionCurve);
            mmitem.Click      += new EventHandler(OnToolSelect);
            mmitem.Tag         = "multiConnectionLines";
            m_data.AddDrawTool(mmitem.Tag.ToString(), new DrawTools.MultiConnectionLines());

            ToolStrip strip = m_menuItems.GetStrip("draw");

            strip.Items.Add(m_menuItems.GetItem("Line").CreateButton());
            //strip.Items.Add(m_menuItems.GetItem("Circle2P").CreateButton());
            //strip.Items.Add(m_menuItems.GetItem("CircleCR").CreateButton());
            //strip.Items.Add(m_menuItems.GetItem("Arc2P").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Bezier").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Oval").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Rectangle").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("MultiConnectionLines").CreateButton());
            //         strip.Items.Add(m_menuItems.GetItem("ArcCR").CreateButton());
            //         strip.Items.Add(m_menuItems.GetItem("Arc3P132").CreateButton());
            //strip.Items.Add(m_menuItems.GetItem("Arc3P123").CreateButton());

            ToolStripMenuItem menu = m_menuItems.GetMenuStrip("draw");

            menu.MergeAction = MergeAction.Insert;
            menu.MergeIndex  = 2;
            menu.Text        = "Draw &Tools";
            menu.DropDownItems.Add(m_menuItems.GetItem("Lines").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("Line").CreateMenuItem());
            //menu.DropDownItems.Add(m_menuItems.GetItem("Circle2P").CreateMenuItem());
            //menu.DropDownItems.Add(m_menuItems.GetItem("CircleCR").CreateMenuItem());
            //menu.DropDownItems.Add(m_menuItems.GetItem("Arc2P").CreateMenuItem());
            //menu.DropDownItems.Add(m_menuItems.GetItem("ArcCR").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("Bezier").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("Oval").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("Rectangle").CreateMenuItem());
            menu.DropDownItems.Add(m_menuItems.GetItem("MultiConnectionLines").CreateMenuItem());
            //         menu.DropDownItems.Add(m_menuItems.GetItem("Arc3P132").CreateMenuItem());
            //menu.DropDownItems.Add(m_menuItems.GetItem("Arc3P123").CreateMenuItem());
        }