Ejemplo n.º 1
0
        private void CreateToolbarAndMenu(string local = null)
        {
            //添加按钮到tlbMain工具条上
            //if (local == null)
            //{
            //    local = Thread.CurrentThread.CurrentUICulture.Name;
            //    //info = CultureInfo.InvariantCulture;
            //}

            //CultureInfo info = new CultureInfo(local);

            MapWinGIS.Interfaces.Toolbar       toolbar = m_MapWin.Toolbar;
            MapWinGIS.Interfaces.ToolbarButton btn     = toolbar.AddButton("PluginSample");
            btn.BeginsGroup = true;
            btn.Category    = "tlbAppPlugin";
            btn.Description = resources.GetString("btn_Description"); //"this is a sample plugin.";
            btn.Enabled     = true;
            btn.Tooltip     = resources.GetString("btn_Tooltip");     //"this is a sample plugin.";
            btn.Text        = resources.GetString("btn_Text");        //"AppPlugin";
            btn.Picture     = new System.Drawing.Icon(this.GetType(), "run.ico");


            //添加菜单到顶级菜单栏
            MapWinGIS.Interfaces.Menus    menu    = m_MapWin.Menus;
            MapWinGIS.Interfaces.MenuItem mnuItem = menu.AddMenu("mnuAppPlugin");
            mnuItem.BeginsGroup = true;
            mnuItem.Category    = "mnuAppPlugin";
            mnuItem.Tooltip     = "thi is a Sample Plugin menu text.";
            mnuItem.Text        = resources.GetString("mnuItem_Text"); //"插件测试(&A)";

            MapWinGIS.Interfaces.MenuItem subMnuItem1 = menu.AddMenu("mnuAppPlugin1", "mnuAppPlugin");
            subMnuItem1.BeginsGroup = true;
            subMnuItem1.Category    = "mnuAppPlugin";
            subMnuItem1.Tooltip     = "thi is a Sample Plugin menu text.";
            subMnuItem1.Text        = resources.GetString("subMnuItem1_Text"); //"插件1(&B)";

            MapWinGIS.Interfaces.MenuItem subMnuItem2 = menu.AddMenu("mnuAppPlugin2", "mnuAppPlugin");
            subMnuItem2.BeginsGroup = true;
            subMnuItem2.Category    = "mnuAppPlugin";
            subMnuItem2.Tooltip     = "thi is a Sample Plugin menu text.";
            subMnuItem2.Text        = resources.GetString("subMnuItem2_Text");// "插件2(&B)";

            //添加到"图层"菜单中
            MapWinGIS.Interfaces.Menus    layerMenu = m_MapWin.Menus; //"图层插件菜单(&T)"
            MapWinGIS.Interfaces.MenuItem mnuItem3  = layerMenu.AddMenu("mnuAppPlugin3", "mnuLayer", null, resources.GetString("mnuAppPlugin3_Text"), "mnuLayerBreak3");
            mnuItem3.BeginsGroup = true;
            mnuItem3.Category    = "mnuAppPlugin";
            mnuItem3.Tooltip     = "thi is a Sample Plugin menu text.";
        }
Ejemplo n.º 2
0
        public void Initialize(IMapWin mapWin, int parenthandle)
        {
            this.m_MapWin       = mapWin;
            this.m_ParentHandle = parenthandle;

            MapWinGIS.Interfaces.Toolbar toolbar = m_MapWin.Toolbar;
            if (toolbar.AddToolbar("tlbPluginSample1"))
            {
                MapWinGIS.Interfaces.ToolbarButton btn = toolbar.AddButton("tlbPlugintest", "tlbPluginSample1", false);
                btn.BeginsGroup = true;
                btn.Text        = "测试";
                btn.Tooltip     = "测试按钮";
                btn.Picture     = res.GetObject("sample");

                toolbar.AddButtonDropDownSeparator("sep", "tlbPluginSample1", "tlbPlugintest");
                toolbar.AddButtonDropDownSeparator("sep1", "tlbZoom", "tbbZoomExtent");
                MapWinGIS.Interfaces.ComboBoxItem cmb = toolbar.AddComboBox("comboBox1", "tlbPluginSample1", "tlbPlugintest");
                cmb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            }
        }