void DefaultController_GetActiveObjectInfo(object sender, ToolTipControllerGetActiveObjectInfoEventArgs e) { NavBarControl navBar = e.SelectedControl as NavBarControl; if (navBar != null) { NavBarHitInfo hi = navBar.CalcHitInfo(e.ControlMousePosition); if (hi.InLink) { SuperToolTip superTip = new SuperToolTip(); SuperToolTipSetupArgs args = new SuperToolTipSetupArgs(); args.Title.Text = hi.Link.Caption; superTip.Setup(args); e.Info.SuperTip = superTip; } else if (hi.InGroup) { SuperToolTip superTip = GetSuperTipByGroup(hi.Group); { if (e.Info == null) { e.Info = new ToolTipControlInfo(e.SelectedControl, ""); } e.Info.ToolTipType = ToolTipType.SuperTip; e.Info.SuperTip = superTip; } } } }
private void NavBar_MouseClick(object sender, MouseEventArgs e) { NavBarControl nav = (sender as NavBarControl); //取到NavBarControl对象引用 NavBarHitInfo hh = nav.CalcHitInfo(e.Location); //计算点击区域的对象 NavBarGroup group = hh.Group; bool InGroup = hh.InGroup; bool InGroupCaption = hh.InGroupCaption; if (InGroup && InGroupCaption)//点击导航分组按钮 { try { if (group != nav.ActiveGroup) { nav.ActiveGroup = group; } else { //if (CurrentModule != null) // CurrentModule.Activate(); } } catch (Exception ex) { throw ex; } } }
private void navBarControl1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { NavBarControl navBar = sender as NavBarControl; NavBarHitInfo hitInfo = navBar.CalcHitInfo(new Point(e.X, e.Y)); if (hitInfo.InGroupCaption && !hitInfo.InGroupButton) { hitInfo.Group.Expanded = !hitInfo.Group.Expanded; } } }
void NavBar_MouseMove(object sender, MouseEventArgs e) { NavBarControl navBar = sender as NavBarControl; NavBarHitInfo info = navBar.CalcHitInfo(e.Location); if (info.InLink) { tooltip.ShowHint(((NavBarData)info.Link.Item.Tag).Contact, e.Location); } else { tooltip.HideHint(true); } }
///// <summary> ///// 当点击导航组件的组按钮时触发事件 ///// </summary> //protected void OnActiveGroupChanged(object sender, DevExpress.XtraNavBar.NavBarGroupEventArgs e) //{ // try // { // string moduleName = e.Group.Caption.ToString(); // //显示模块主窗体 // _ModuleManager.ActiveModule(moduleName); // } // catch (Exception ex) { Msg.ShowException(ex); } //} /// <summary> /// 点击导航分组按钮时触发该事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OnNavBar_MouseClick(object sender, MouseEventArgs e) { NavBarControl nav = (sender as NavBarControl); //取到NavBarControl对象引用 NavBarHitInfo hit = nav.CalcHitInfo(e.Location); //计算点击区域的对象 if (hit.InGroup && hit.InGroupCaption) //点击导航分组按钮 { try { nav.ActiveGroup = hit.Group; //立即设置为激活的组 string moduleName = hit.Group.Caption.ToString(); //取组按钮的标题(模块的名称) _ModuleManager.ActiveModule(moduleName); //激活显示模块 } catch (Exception ex) { Msg.ShowException(ex); } } }
private void navBarControl1_Click(object sender, EventArgs e) { NavBarControl navMainMenu = (NavBarControl)sender; Point point = navMainMenu.PointToClient(Control.MousePosition); NavBarHitInfo info = navMainMenu.CalcHitInfo(point); if (info.NavBar.PressedGroup != null) { NavBarGroup navGroup = info.NavBar.PressedGroup; if (navGroup.Name.Equals("mnuLogOff")) { UiUtility.IsLogOut = true; this.Close(); //this.frmMainMenu_FormClosed(this, new FormClosedEventArgs(CloseReason.FormOwnerClosing)); //this.frmMainMenu_FormClosing(this, new FormClosingEventArgs(CloseReason.FormOwnerClosing, false)); } else { HTN.BITS.UIL.PLASESS.Properties.Settings.Default.LastActiveGroup = navGroup.Name; } } }