C# NavBarControl根据鼠标点击位置获取 NavBarGroup 对象
作者:C/S框架网|www.cscode.ne  发布日期:2021-03-17 18:58:43
  C# NavBarControl根据鼠标点击位置获取 NavBarGroup 对象


C# Code:

private void navBarControl1_Click(object sender, EventArgs e)
{
  
//根据鼠标点击位置获取 NavBarGroup 对象
  
if (e is System.Windows.Forms.MouseEventArgs)
  {
    System.Windows.Forms.MouseEventArgs ar
= e as System.Windows.Forms.MouseEventArgs;
    
    NavBarHitInfo info
= navBarControl1.CalcHitInfo(ar.Location);
    
    
if (info is NavBarNavigationPaneHitInfo)
    {
      NavBarNavigationPaneHitInfo click
= info as NavBarNavigationPaneHitInfo;
      
      
//NavBarGroup 对象
      
if (click.Group != null && click.InGroup && click.InLink == false)
      {
        
if (navBarControl1.ActiveGroup != click.Group)
        navBarControl1.ActiveGroup
= click.Group;
        
else
        
//调用ActiveGroupChanged事件
        
navBarControl1_ActiveGroupChanged(navBarControl1, new NavBarGroupEventArgs(click.Group));
      }
    }
  }
}


//来源:C/S框架网 | www.csframework.com | QQ:23404761



上一篇 下一篇