Example #1
0
        void SetupToolbars()
        {
            MenuItem mmitem = m_menuItems.GetItem("New");

            mmitem.Text        = "&New";
            mmitem.Image       = MenuImages16x16.Image(MenuImages16x16.eIndexes.NewDocument);
            mmitem.Click      += new EventHandler(OnFileNew);
            mmitem.ToolTipText = "New document";

            mmitem             = m_menuItems.GetItem("Open");
            mmitem.Text        = "&Open";
            mmitem.Image       = MenuImages16x16.Image(MenuImages16x16.eIndexes.OpenDocument);
            mmitem.Click      += new EventHandler(OnFileOpen);
            mmitem.ToolTipText = "Open document";

            mmitem             = m_menuItems.GetItem("Save");
            mmitem.Text        = "&Save";
            mmitem.Image       = MenuImages16x16.Image(MenuImages16x16.eIndexes.SaveDocument);
            mmitem.Click      += new EventHandler(OnFileSave);
            mmitem.ToolTipText = "Save document";

            mmitem        = m_menuItems.GetItem("SaveAs");
            mmitem.Text   = "Save &As";
            mmitem.Click += new EventHandler(OnFileSaveAs);

            mmitem        = m_menuItems.GetItem("Exit");
            mmitem.Text   = "E&xit";
            mmitem.Click += new EventHandler(OnFileExit);

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

            strip.Items.Add(m_menuItems.GetItem("New").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Open").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Save").CreateButton());

            ToolStripMenuItem menuitem = m_menuItems.GetMenuStrip("file");

            menuitem.Text = "&File";
            menuitem.DropDownItems.Add(m_menuItems.GetItem("New").CreateMenuItem());
            menuitem.DropDownItems.Add(m_menuItems.GetItem("Open").CreateMenuItem());
            menuitem.DropDownItems.Add(m_menuItems.GetItem("Save").CreateMenuItem());
            menuitem.DropDownItems.Add(m_menuItems.GetItem("SaveAs").CreateMenuItem());
            menuitem.DropDownItems.Add(new ToolStripSeparator());
            menuitem.DropDownItems.Add(m_menuItems.GetItem("Exit").CreateMenuItem());
            m_mainMenu.Items.Insert(0, menuitem);

            ToolStripPanel panel = m_menuItems.GetStripPanel(DockStyle.Top);

            panel.Join(m_menuItems.GetStrip("layer"));
            panel.Join(m_menuItems.GetStrip("draw"));
            panel.Join(m_menuItems.GetStrip("edit"));
            panel.Join(m_menuItems.GetStrip("file"));
            panel.Join(m_mainMenu);

            panel = m_menuItems.GetStripPanel(DockStyle.Left);
            panel.Join(m_menuItems.GetStrip("modify"));

            panel = m_menuItems.GetStripPanel(DockStyle.Bottom);
            panel.Join(m_menuItems.GetStatusStrip("status"));
        }
Example #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());
        }
Example #3
0
        /// <summary>
        /// 安装工具栏(上/左/下)
        /// </summary>
        void SetupToolbars()
        {
            #region "文件"下拉菜单项通过MenuItemManager初始化
            MenuItem mmitem = m_menuItems.GetItem("New");
            //mmitem.Text = "&New";
            mmitem.Text        = "&新建";
            mmitem.Image       = MenuImages16x16.Image(MenuImages16x16.eIndexes.NewDocument);
            mmitem.Click      += new EventHandler(OnFileNew);
            mmitem.ToolTipText = "New document";

            mmitem = m_menuItems.GetItem("Open");
            //mmitem.Text = "&Open";
            mmitem.Text        = "&打开";
            mmitem.Image       = MenuImages16x16.Image(MenuImages16x16.eIndexes.OpenDocument);
            mmitem.Click      += new EventHandler(OnFileOpen);
            mmitem.ToolTipText = "Open document";

            mmitem = m_menuItems.GetItem("Save");
            //mmitem.Text = "&Save";
            mmitem.Text        = "&保存";
            mmitem.Image       = MenuImages16x16.Image(MenuImages16x16.eIndexes.SaveDocument);
            mmitem.Click      += new EventHandler(OnFileSave);
            mmitem.ToolTipText = "Save document";

            mmitem = m_menuItems.GetItem("SaveAs");
            //mmitem.Text = "Save &As";
            mmitem.Text   = "另存为";
            mmitem.Click += new EventHandler(OnFileSaveAs);

            mmitem = m_menuItems.GetItem("Exit");
            //mmitem.Text = "E&xit";
            mmitem.Text   = "退出";
            mmitem.Click += new EventHandler(OnFileExit);
            #endregion

            #region "文件"图片列工具栏构造
            ToolStrip strip = m_menuItems.GetStrip("file");
            strip.Items.Add(m_menuItems.GetItem("New").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Open").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Save").CreateButton());
            #endregion

            #region "文件"下拉菜单栏添加控件
            ToolStripMenuItem menuitem = m_menuItems.GetMenuStrip("file");
            menuitem.Text = "&File";
            menuitem.Text = "文件";
            menuitem.DropDownItems.Add(m_menuItems.GetItem("New").CreateMenuItem());
            menuitem.DropDownItems.Add(m_menuItems.GetItem("Open").CreateMenuItem());
            menuitem.DropDownItems.Add(m_menuItems.GetItem("Save").CreateMenuItem());
            menuitem.DropDownItems.Add(m_menuItems.GetItem("SaveAs").CreateMenuItem());
            menuitem.DropDownItems.Add(new ToolStripSeparator());
            menuitem.DropDownItems.Add(m_menuItems.GetItem("Exit").CreateMenuItem());
            m_mainMenu.Items.Insert(0, menuitem);
            #endregion

            #region  左下菜单栏/状态栏设置控件
            ToolStripPanel panel = m_menuItems.GetStripPanel(DockStyle.Top);

            panel.Join(m_menuItems.GetStrip("layer"));
            panel.Join(m_menuItems.GetStrip("draw"));
            panel.Join(m_menuItems.GetStrip("edit"));
            panel.Join(m_menuItems.GetStrip("file"));
            panel.Join(m_mainMenu);             //主菜单加入面板

            panel = m_menuItems.GetStripPanel(DockStyle.Left);
            panel.Join(m_menuItems.GetStrip("modify"));             //左侧修改栏

            panel = m_menuItems.GetStripPanel(DockStyle.Bottom);
            panel.Join(m_menuItems.GetStatusStrip("status"));             //底部状态栏
            #endregion
        }