private void UninstallToolbarAndMenu() { MapWinGIS.Interfaces.Toolbar toolbar = m_MapWin.Toolbar; toolbar.RemoveButton("PluginSample"); MapWinGIS.Interfaces.Menus menu = m_MapWin.Menus; menu.Remove("mnuAppPlugin"); menu.Remove("mnuAppPlugin1"); menu.Remove("mnuAppPlugin2"); menu.Remove("mnuAppPlugin3"); }
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."; }