点击左侧导航分组按钮显示模块主窗体
绑定NavBarControl的MouseClick事件,代码如下:
/// <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); }
}
}
}
扫一扫加微信