Exemple #1
0
        public void GetItemInfo(int pos, ItemDef itemDef)
        {
            switch (pos)
            {
                case 0:
                    itemDef.ID = "VisualMenuBar.SingleSymbolCmd";
                    itemDef.Group = false;
                    break;
                case 1:
                    itemDef.ID = "VisualMenuBar.DotDensitySymbolsCmd";
                    itemDef.Group = false;
                    break;
                case 2:
                    itemDef.ID = "VisualMenuBar.GraduatedSymbolsCmd";
                    itemDef.Group = false;
                    break;
                case 3:
                    itemDef.ID = "VisualMenuBar.ProportionalSymbolsCmd";
                    itemDef.Group = false;
                    break;
                case 4:
                    itemDef.ID = "VisualMenuBar.StatisticsSymbolsCmd";
                    itemDef.Group = false;
                    break;
                case 5:
                    itemDef.ID = "VisualMenuBar.UniqueValuesSymbolCmd";
                    itemDef.Group = false;
                    break;
                case 6:
                    itemDef.ID = "VisualMenuBar.ClassBreaksRendererSymbolCmd";
                    itemDef.Group = false;
                    break;
                case 7:
                    itemDef.ID = "VisualMenuBar.StatisticsSymbolsCmd";
                    itemDef.Group = false;
                    break;
                case 8:
                    itemDef.ID = "VisualMenuBar.SymbolizationByLayerPropPageCmd";
                    itemDef.Group = false;
                    break;
                case 9:
                    itemDef.ID = "VisualMenuBar.fm_RasterRenderClassificationCmd";
                    itemDef.Group = true;
                    break;
                default:
                    break;

            }
        }
Exemple #2
0
        public void GetItemInfo(int pos, ItemDef itemDef)
        {
            switch (pos)
            {
                case 0:
                    itemDef.ID = "DLS.DLS";
                    itemDef.Group = false;
                    break;
               
                ////case 1:
                //    //itemDef.ID = "";
                //    //itemDef.Group = true;
                //    break;
                default:
                    break;

            }
        }
        public void GetItemInfo(int pos, ItemDef itemDef)
        {
            switch (pos)
            {
                case 0:
                    itemDef.ID = "CartographicMenuBar.CreateNewDocument";
                    itemDef.Group = false;
                    break;
                case 1:
                    itemDef.ID = "CartographicMenuBar.OpenDocument";
                    itemDef.Group = false;
                    break;
                case 2:
                    itemDef.ID = "CartographicMenuBar.SaveDocument";
                    itemDef.Group = false;
                    break;
                case 3:
                    itemDef.ID = "CartographicMenuBar.SaveAsDocment";
                    itemDef.Group = false;
                    break;
                case 4:
                    itemDef.ID = "CartographicMenuBar.Northarrow";
                    itemDef.Group = false;
                    break;
                case 5:
                    itemDef.ID = "CartographicMenuBar.SaveDocument";
                    itemDef.Group = false;
                    break;
                case 6:
                    itemDef.ID = "CartographicMenuBar.SaveDocument";
                    itemDef.Group = false;
                    break;
                case 7:
                    itemDef.ID = "CartographicMenuBar.SaveDocument";
                    itemDef.Group = false;
                    break;
                default:
                    break;

            }
        }
        public void GetItemInfo(int pos, MyPluginEngine.ItemDef itemDef)
        {
            switch (pos)
            {
            case 0:
                itemDef.ID    = "EcoRedLine.frmBiodiversityCmd";
                itemDef.Group = false;
                break;

            case 1:
                itemDef.ID    = "EcoRedLine.frmFloodCmd";
                itemDef.Group = false;
                break;

            case 2:
                itemDef.ID    = "EcoRedLine.frmGeoHazardsCmd";
                itemDef.Group = false;
                break;

            case 3:
                itemDef.ID    = "EcoRedLine.frmTerrainCmd";
                itemDef.Group = false;
                break;

            case 4:
                itemDef.ID    = "EcoRedLine.frmWaterConervationCmd";
                itemDef.Group = false;
                break;

            case 5:
                itemDef.ID    = "EcoRedLine.frmWaterSoilConservationCmd";
                itemDef.Group = false;
                break;

            default:
                break;
            }
        }
Exemple #5
0
        /// <summary>
        /// 创建UI层的菜单栏 使用ribbonControl实现菜单栏的功能
        /// </summary>
        /// <param name="Menus"></param>
        private void CreateMenus(Dictionary <string, MyPluginEngine.IMenuDef> Menus)
        {
            //遍历Menu集合中的元素
            foreach (KeyValuePair <string, MyPluginEngine.IMenuDef> menu in Menus)
            {
                MyPluginEngine.IMenuDef nbMenu = menu.Value;
                //新建菜单对象
                //ToolStripMenuItem UIMenu = new ToolStripMenuItem();
                RibbonTabItem UIMenu = new RibbonTabItem();
                //设置菜单属性
                UIMenu.Text           = nbMenu.Caption;
                UIMenu.Tag            = nbMenu;
                UIMenu.AccessibleName = nbMenu.ToString();

                //添加ribbonpanel
                RibbonPanel MenuPanel = new RibbonPanel();
                MenuPanel.Text = nbMenu.Caption;
                MenuPanel.Dock = DockStyle.Fill;
                MenuPanel.Font = new System.Drawing.Font("微软雅黑", 9F);
                UIMenu.Panel   = MenuPanel;

                // 添加 ribbonbar
                RibbonBar MenuBar = new RibbonBar();
                //MenuBar.Text = nbMenu.Caption;//分组标题
                //MenuBar.Dock = DockStyle.Fill;

                //将Menu添加MainMenu的Commands中
                //MainMenu.Items.Add(UIMenu);
                //将Command和Tool插入到menu中
                //遍历每一个菜单item
                MyPluginEngine.ItemDef itemDef = new MyPluginEngine.ItemDef();
                for (int i = 0; i < nbMenu.ItemCount; i++)
                {
                    //寻找该菜单对象的信息,如该菜单上的Item数量,是否为Group
                    nbMenu.GetItemInfo(i, itemDef);

                    MyPluginEngine.ITool nbtool = m_DicPlugins[itemDef.ID] as MyPluginEngine.ITool;
                    if (nbtool != null)
                    {
                        //产生一个ITool对象
                        //ToolStripMenuItem UITool = new ToolStripMenuItem();
                        //
                        ButtonItem UITool = new ButtonItem();
                        //根据ITool的信息设置UITool的属性
                        //UITool.ToolTipText = nbtool.Tooltip;
                        UITool.ImagePosition  = DevComponents.DotNetBar.eImagePosition.Top;
                        UITool.Text           = nbtool.Caption;
                        UITool.Image          = nbtool.Bitmap;
                        UITool.AccessibleName = nbtool.ToString();
                        //UITool.Key = nbtool.ToString();
                        UITool.Enabled = nbtool.Enabled;
                        UITool.Checked = nbtool.Checked;
                        //产生UICommand是调用OnCreate方法,将主框架对象传递给插件对象
                        nbtool.OnCreate(this._App);
                        //使用委托机制处理Command的事件
                        //所有的UICommand对象Click事件均使用this.UITool_Click方法处理
                        UITool.Click += new EventHandler(UITool_Click);
                        //将生成的UICommand添加到CommandManager中

                        //MenuBar.Text = nbtool.Category;
                        if (itemDef.Group)
                        {
                            MenuBar      = new RibbonBar();
                            MenuBar.Text = nbtool.Category;//分组标题
                            //UIMenu.DropDownItems.Add(new ToolStripSeparator());
                        }
                        MenuBar.Items.Add(UITool);
                        //UIMenu.SubItems.Add(UITool);
                    }
                    MyPluginEngine.ICommand nbcmd = m_DicPlugins[itemDef.ID] as MyPluginEngine.ICommand;
                    if (nbcmd != null)
                    {
                        //产生一个UICommand对象
                        //ToolStripMenuItem UICommand = new ToolStripMenuItem();
                        //
                        ButtonItem UICommand = new ButtonItem();
                        UICommand.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;
                        //根据ICommand的信息设置UICommand的属性
                        //UICommand.ToolTipText = nbcmd.Tooltip;
                        UICommand.Text           = nbcmd.Caption;
                        UICommand.Image          = nbcmd.Bitmap;
                        UICommand.AccessibleName = nbcmd.ToString();
                        UICommand.Enabled        = nbcmd.Enabled;
                        //UICommand的Checked与command的属性一致
                        UICommand.Checked = nbcmd.Checked;
                        //产生UICommand是调用OnCreate方法,将主框架对象传递给插件对象
                        nbcmd.OnCreate(this._App);
                        //使用委托机制处理Command的事件
                        //所有的UICommand对象Click事件均使用this.Command_Click方法处理
                        UICommand.Click += new EventHandler(UICommand_Click);
                        //将生成的UICommand添加到CommandManager中
                        //如果分组,则在该UI对象前加上一个分隔符
                        if (itemDef.Group)
                        {
                            //UIMenu.DropDownItems.Add(new ToolStripSeparator());
                            MenuBar      = new RibbonBar();
                            MenuBar.Text = UICommand.Category;
                        }
                        //UIMenu.DropDownItems.Add(UICommand);
                        MenuBar.Items.Add(UICommand);
                    }
                    MenuPanel.Controls.Add(MenuBar);
                }

                this.MainMenu.Controls.Add(MenuPanel);
                this.MainMenu.Items.Add(UIMenu);
                this.MainMenu.SelectFirstVisibleRibbonTab();
            }
        }
Exemple #6
0
        /// <summary>
        /// 创建ToolBar的UI层对象
        /// </summary>
        /// <param name="toolBars"></param>
        private void CreateToolBars(Dictionary<string, MyPluginEngine.IToolBarDef> toolBars)
        {
            foreach (KeyValuePair<string, MyPluginEngine.IToolBarDef> toolbar in toolBars)
            {
                MyPluginEngine.IToolBarDef nbtoolbar = toolbar.Value;
                //产生UICommandBar对象
                //ToolStrip UIToolbar = new ToolStrip();
                RibbonPanel UIToolPanel = new RibbonPanel();
                //设置UICommandBar的属性
                //UIToolbar.CommandManager = this.uiCommandManager;
                UIToolPanel.Name = nbtoolbar.Name;
                //UIToolPanel.Text = nbtoolbar.Caption;
                UIToolPanel.Tag = nbtoolbar;
                UIToolPanel.AccessibleName = nbtoolbar.ToString();
                UIToolPanel.Dock = DockStyle.Fill;

                RibbonBar UIToolBar = new RibbonBar();
                //UIToolBar.Text = nbtoolbar.Caption;

                //将Command和Tool插入到ToolBar中
                MyPluginEngine.ItemDef itemDef = new ItemDef();
                for (int i = 0; i < nbtoolbar.ItemCount; i++)
                {
                    nbtoolbar.GetItemInfo(i, itemDef);
                    MyPluginEngine.ICommand nbcmd = m_DicPlugins[itemDef.ID] as MyPluginEngine.ICommand;
                    if (nbcmd != null)
                    {
                        //产生一个UICommand对象
                        //ToolStripButton UICommand = new ToolStripButton();
                        ButtonItem UICommand = new ButtonItem();
                        //UICommand.sty = ;
                        //根据ICommand的信息设置UICommand的属性
                        //UICommand.ToolTipText = nbcmd.Tooltip;
                        UICommand.Text = nbcmd.Caption;
                        UICommand.Image = nbcmd.Bitmap;
                        UICommand.AccessibleName = nbcmd.ToString();
                        UICommand.Enabled = nbcmd.Enabled;
                        //UICommand的Checked与command的属性一致
                        UICommand.Checked = nbcmd.Checked;
                        //产生UICommand是调用OnCreate方法,将主框架对象传递给插件对象
                        nbcmd.OnCreate(this._App);
                        //使用委托机制处理Command的事件
                        //所有的UICommand对象Click事件均使用this.Command_Click方法处理
                        UICommand.Click += new EventHandler(UICommand_Click);
                        //将生成的UICommand添加到CommandManager中
                        //如果分组,则在该UI对象前加上一个分隔符
                        if (itemDef.Group)
                        {
                            UIToolBar = new RibbonBar();
                            //UIToolBar.Text = nbtoolbar.Caption;
                        }
                        UIToolBar.Items.Add(UICommand);
                    }

                    //获得一个ITool对象
                    MyPluginEngine.ITool nbtool = m_DicPlugins[itemDef.ID] as MyPluginEngine.ITool;
                    if (nbtool != null)
                    {
                        //产生一个ITool对象
                        //ToolStripButton UITool = new ToolStripButton();
                        ButtonItem UITool = new ButtonItem();
                        //UITool.DisplayStyle = ToolStripItemDisplayStyle.Image;
                        //根据ITool的信息设置UITool的属性
                        //UITool.ToolTipText = nbtool.Tooltip;
                        UITool.Text = nbtool.Caption;
                        UITool.Image = nbtool.Bitmap;
                        UITool.AccessibleName = nbtool.ToString();
                        //UITool.Key = nbtool.ToString();
                        UITool.Enabled = nbtool.Enabled;
                        UITool.Checked = nbtool.Checked;
                        //产生UICommand是调用OnCreate方法,将主框架对象传递给插件对象
                        nbtool.OnCreate(this._App);
                        //使用委托机制处理Command的事件
                        //所有的UICommand对象Click事件均使用this.UITool_Click方法处理
                        UITool.Click += new EventHandler(UITool_Click);
                        //将生成的UICommand添加到CommandManager中
                        if (itemDef.Group)
                        {
                            //UIToolbar.Items.Add(new ToolStripSeparator());
                            UIToolBar = new RibbonBar();
                            //UIToolBar.Text = nbtoolbar.Caption;
                            //UIToolBar.Items.Add();
                        }
                        UIToolBar.Items.Add(UITool);
                    }
                    UIToolPanel.Controls.Add(UIToolBar);
                }

                this.MainTool.Controls.Add(UIToolPanel);
            }
        }
Exemple #7
0
        /// <summary>
        /// 创建UI层的菜单栏 使用ribbonControl实现菜单栏的功能
        /// </summary>
        /// <param name="Menus"></param>
        private void CreateMenus(Dictionary<string, MyPluginEngine.IMenuDef> Menus)
        {
            //遍历Menu集合中的元素
            foreach (KeyValuePair<string, MyPluginEngine.IMenuDef> menu in Menus)
            {
                MyPluginEngine.IMenuDef nbMenu = menu.Value;
                //新建菜单对象
                //ToolStripMenuItem UIMenu = new ToolStripMenuItem();
                RibbonTabItem UIMenu = new RibbonTabItem();
                //设置菜单属性
                UIMenu.Text = nbMenu.Caption;
                UIMenu.Tag = nbMenu;
                UIMenu.AccessibleName = nbMenu.ToString();

                //添加ribbonpanel
                RibbonPanel MenuPanel = new RibbonPanel();
                MenuPanel.Text = nbMenu.Caption;
                MenuPanel.Dock = DockStyle.Fill;
                UIMenu.Panel = MenuPanel;

                // 添加 ribbonbar
                RibbonBar MenuBar = new RibbonBar();
                //MenuBar.Text = nbMenu.Caption;//分组标题
                //MenuBar.Dock = DockStyle.Fill;

                //将Menu添加MainMenu的Commands中
                //MainMenu.Items.Add(UIMenu);
                //将Command和Tool插入到menu中
                //遍历每一个菜单item
                MyPluginEngine.ItemDef itemDef = new MyPluginEngine.ItemDef();
                for (int i = 0; i < nbMenu.ItemCount; i++)
                {
                    //寻找该菜单对象的信息,如该菜单上的Item数量,是否为Group
                    nbMenu.GetItemInfo(i, itemDef);

                    MyPluginEngine.ITool nbtool = m_DicPlugins[itemDef.ID] as MyPluginEngine.ITool;
                    if (nbtool != null)
                    {
                        //产生一个ITool对象
                        //ToolStripMenuItem UITool = new ToolStripMenuItem();
                        //
                        ButtonItem UITool = new ButtonItem();
                        //根据ITool的信息设置UITool的属性
                        //UITool.ToolTipText = nbtool.Tooltip;
                        UITool.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;
                        UITool.Text = nbtool.Caption;
                        UITool.Image = nbtool.Bitmap;
                        UITool.AccessibleName = nbtool.ToString();
                        //UITool.Key = nbtool.ToString();
                        UITool.Enabled = nbtool.Enabled;
                        UITool.Checked = nbtool.Checked;
                        //产生UICommand是调用OnCreate方法,将主框架对象传递给插件对象
                        nbtool.OnCreate(this._App);
                        //使用委托机制处理Command的事件
                        //所有的UICommand对象Click事件均使用this.UITool_Click方法处理
                        UITool.Click += new EventHandler(UITool_Click);
                        //将生成的UICommand添加到CommandManager中

                        MenuBar.Text = nbtool.Category;
                        if (itemDef.Group)
                        {
                            MenuBar = new RibbonBar();
                            MenuBar.Text = nbtool.Category;//分组标题
                            //UIMenu.DropDownItems.Add(new ToolStripSeparator());
                        }
                        MenuBar.Items.Add(UITool);
                        //UIMenu.SubItems.Add(UITool);
                    }
                    MyPluginEngine.ICommand nbcmd = m_DicPlugins[itemDef.ID] as MyPluginEngine.ICommand;
                    if (nbcmd != null)
                    {
                        //产生一个UICommand对象
                        //ToolStripMenuItem UICommand = new ToolStripMenuItem();
                        //
                        ButtonItem UICommand = new ButtonItem();
                        UICommand.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;
                        //根据ICommand的信息设置UICommand的属性
                        //UICommand.ToolTipText = nbcmd.Tooltip;
                        UICommand.Text = nbcmd.Caption;
                        UICommand.Image = nbcmd.Bitmap;
                        UICommand.AccessibleName = nbcmd.ToString();
                        UICommand.Enabled = nbcmd.Enabled;
                        //UICommand的Checked与command的属性一致
                        UICommand.Checked = nbcmd.Checked;
                        //产生UICommand是调用OnCreate方法,将主框架对象传递给插件对象
                        nbcmd.OnCreate(this._App);
                        //使用委托机制处理Command的事件
                        //所有的UICommand对象Click事件均使用this.Command_Click方法处理
                        UICommand.Click += new EventHandler(UICommand_Click);
                        //将生成的UICommand添加到CommandManager中
                        //如果分组,则在该UI对象前加上一个分隔符
                        if (itemDef.Group)
                        {
                            //UIMenu.DropDownItems.Add(new ToolStripSeparator());
                            MenuBar = new RibbonBar();
                            MenuBar.Text = UICommand.Category;
                        }
                        //UIMenu.DropDownItems.Add(UICommand);
                        MenuBar.Items.Add(UICommand);
                    }
                    MenuPanel.Controls.Add(MenuBar);
                }

                this.MainMenu.Controls.Add(MenuPanel);
                this.MainMenu.Items.Add(UIMenu);
            }
        }