Example #1
0
        // 重写双击事件
        protected override void OnCellMouseDoubleClick(DataGridViewCellMouseEventArgs e)
        {
            try
            {
                if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
                {
                    if (base.m_arrayStrHeader[e.ColumnIndex] == CS_StationID || base.m_arrayStrHeader[e.ColumnIndex] == CS_StationName)
                    {
                        //获取当前单元格的行号和列号
                        int    rowIndex          = e.RowIndex;
                        string stationid         = this.Rows[rowIndex].Cells[CS_StationID].Value.ToString();
                        string stationname       = this.Rows[rowIndex].Cells[CS_StationName].Value.ToString();
                        CStationDataMgrForm form = new CStationDataMgrForm()
                        {
                            Editable = false
                        };
                        if (form != null)
                        {
                            form.cmbStation.Text            = string.Format("({0,-4}|{1})", stationid, stationname);
                            form.cmbQueryInfo.SelectedIndex = 3;
                            form.ShowDialog();
                        }
                    }
                }
            }
#pragma warning disable CS0168 // 声明了变量“ex”,但从未使用过
            catch (Exception ex)
#pragma warning restore CS0168 // 声明了变量“ex”,但从未使用过
            {
            }
        }
 // 重写双击事件
 protected override void OnCellMouseDoubleClick(DataGridViewCellMouseEventArgs e)
 {
     try
     {
         if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
         {
             if (base.m_arrayStrHeader[e.ColumnIndex] == CS_StationId || base.m_arrayStrHeader[e.ColumnIndex] == CS_StationName)
             {
                 //获取当前单元格的行号和列号
                 int    rowIndex          = e.RowIndex;
                 string stationid         = this.Rows[rowIndex].Cells[CS_StationId].Value.ToString();
                 string stationname       = this.Rows[rowIndex].Cells[CS_StationName].Value.ToString();
                 CStationDataMgrForm form = new CStationDataMgrForm()
                 {
                     Editable = false
                 };
                 if (form != null)
                 {
                     form.cmbStation.Text = string.Format("({0,-4}|{1})", stationid, stationname);
                     form.ShowDialog();
                 }
             }
         }
     }
     catch (Exception ex)
     {
     }
 }