//private void CreateUIDockableWindow(Dictionary<string, NBGIS.PluginEngine.IDockableWindowDef> DockableWindows) //{ // foreach (KeyValuePair<string, NBGIS.PluginEngine.IDockableWindowDef> dockWindowsItem in DockableWindows) // { // NBGIS.PluginEngine.IDockableWindowDef nbDockWindowItem = dockWindowsItem.Value; // nbDockWindowItem.OnCreate(this.m_Application); // Janus.Windows.UI.Dock.UIPanel panel = new Janus.Windows.UI.Dock.UIPanel(); // panel.FloatingLocation = new System.Drawing.Point(120, 180); // panel.FloatingSize = new System.Drawing.Size(188, 188); // panel.Name = nbDockWindowItem.Name; // panel.Text = nbDockWindowItem.Caption; // panel.DockState = Janus.Windows.UI.Dock.PanelDockState.Floating; // ((System.ComponentModel.ISupportInitialize)(panel)).BeginInit(); // panel.SuspendLayout(); // panel.Id = Guid.NewGuid(); // this.uiPanelManager.Panels.Add(panel); // Janus.Windows.UI.Dock.UIPanelInnerContainer panelContainer = new Janus.Windows.UI.Dock.UIPanelInnerContainer(); // panel.InnerContainer = panelContainer; // try // { // //这个地方易发生异常,插件必须保证ChildHWND完全正确 // panelContainer.Controls.Add(nbDockWindowItem.ChildHWND); // panelContainer.Location = new System.Drawing.Point(1, 27); // panelContainer.Name = nbDockWindowItem.Name + "Container"; // panelContainer.Size = new System.Drawing.Size(188, 188); // panelContainer.TabIndex = 0; // } // catch (Exception ex) // { // if (Applog.log.IsErrorEnabled) // { // Applog.log.Error("浮动窗体插件的子控件没有正确加载:" + ex.Message); // } // } // } //} #endregion #region ITool与ICommand的Click事件方法 private void uiCmd_Click(object sender, Janus.Windows.UI.CommandBars.CommandEventArgs e) { //当Command被按下时,CurrentTool设置为Null this.m_Application.CurrentTool = null; this.m_Application.MapControl.CurrentTool = null; this.m_Application.PageLayoutControl.CurrentTool = null; //一切在Command被 按下前未完成的Tool操作都可能使Tool的Checked为True //此项必须设置为False foreach (Janus.Windows.UI.CommandBars.UICommand uiCmd in this.uiCommandManager.Commands) { uiCmd.Checked = Janus.Windows.UI.InheritableBoolean.False; } Janus.Windows.UI.CommandBars.UICommand cmd = (Janus.Windows.UI.CommandBars.UICommand)sender; cmd.Checked = Janus.Windows.UI.InheritableBoolean.True; this.axMapControl.MousePointer = ESRI.ArcGIS.Controls.esriControlsMousePointer.esriPointerDefault; NBGIS.PluginEngine.ICommand nbCmd = this.m_CommandCol[e.Command.Key]; //状态栏显示插件信息 this.StatusBar.Panels[0].Text = nbCmd.Message; nbCmd.OnClick(); cmd.Checked = Janus.Windows.UI.InheritableBoolean.False; }
void UICommand_Click(object sender, EventArgs e) { ToolStripButton pTempBtn = sender as ToolStripButton; ToolStripMenuItem pTempMenuItem = sender as ToolStripMenuItem; ToolStripItem pItem = pTempBtn; if (null == pTempBtn) { pItem = pTempMenuItem; } if (null == pItem) { return; } string strKey = pItem.AccessibleName; //当前Command被按下时,CurrentTool设置为null //MapControl和PageLayoutControl的也设置为null _App.CurrentTool = null; _App.MapControl.CurrentTool = null; _App.PageLayoutControl.CurrentTool = null; //一切在Command被按下前未完成的Tool操作都可能使Tool的Checked为true //此项必须设置为False //遍历所有的Command,设置每一个Command的选择状态为False ToolStripButton UICmd = null; foreach (var item in pItem.GetCurrentParent().Items) { UICmd = item as ToolStripButton; if (null == UICmd) { continue; } UICmd.Checked = false; } NBGIS.PluginEngine.ICommand cmd = _CommandCol[strKey]; ////在状态栏显示插件信息 this.toolStripStatusLabel1.Text = cmd.Message; if (null != pTempBtn) { pTempBtn.Checked = true; } //((ToolStripButton)sender).Checked = true; //设置Map控件的鼠标 axMapControl.MousePointer = esriControlsMousePointer.esriPointerDefault; cmd.OnClick(); //((ToolStripButton)sender).Checked = false; if (null != pTempBtn) { pTempBtn.Checked = false; } }