2012-12-13 52 views

回答

0
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Windows.Forms; 

namespace DataGridViewValidation.Controls 
{ 
    public class DataGridViewTabColumnFalse : DataGridView 
    { 
     protected override bool ProcessDataGridViewKey(KeyEventArgs e) 
     { 
      if (e.KeyCode == Keys.Tab) 
      { 
       if (CurrentCell.ColumnIndex == 0) 
       { 
        e.SuppressKeyPress = true; 
        return true; 
       } 
      } 
      return base.ProcessDataGridViewKey(e); 
     } 


     protected override bool ProcessDialogKey(Keys keyData) 
     { 
      if (keyData == Keys.Tab) 
      { 
       if (CurrentCell.ColumnIndex == 0) 
       { 
        return true; 
       } 
      } 

      return base.ProcessDialogKey(keyData); 
     } 
    } 
} 
相關問題