关于tabControl 选项卡事件

时间:2022-09-16 06:23:22

1、DoubleClick
 #region /***双击选项卡*/
  /// <summary>
  /// 双击选项卡,分别加载E,P信息界面数据
  /// </summary>
  /// <param name="sender"></param>
  /// <param name="e"></param>
  private void tabExamPaper_DoubleClick(object sender, System.EventArgs e)
  {
   TabControl   tc=(TabControl)sender;
 
   switch(tc.SelectedIndex)
   {
    case 0:
     //加载E相关数据
     LoadEData();
     ClearECombox();
     break;
    case 1:
     //加载P相关数据
     LoadPData();
     ClearPCombox();
     break;
   }
  }

2、SelectedIndexChanged
#region /***点选项卡***/
  private void tabExamPaper_SelectedIndexChanged(object sender, System.EventArgs e)
  {
   //   if (this.tabEPaper.SelectedTab==this.tbpE)
   //   {
   //    MessageBox.Show("Exam");
   //   }
     
   switch(this.tabExamPaper.SelectedIndex)
   {
    case 0:
     //     MessageBox.Show("tabPage1 is Selected");
     //     FillComboxData();
     //    //填充DataGrid
     //    addDataGridData();
      break;
    case 1:
     //加载P相关数据
     //     LoadPData();
     break;
   }
  }