另外: 当点击列头时,如何使该列的所有checkbox全选/全不选?

解决方案 »

  1.   

    重写DataGrid,www.codeproject上有很多功能比较强的DataGrid的源码。不知道还有别的什么办法。
      

  2.   

    请参考:
    protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
    {
    if(keyData == Keys.Enter)//通过回车键移到下一控件

    if(this.ActiveControl.Parent is DataGrid)
    {
    SendKeys.Send("{DOWN}");
    return true;
    }
    else if(!(this.ActiveControl is Button))
    {   
    SendKeys.Send("{TAB}"); 
    SendKeys.Send("{END}+{HOME}");
    return true;
    }
    }
    return base.ProcessCmdKey(ref msg, keyData);
    }
      

  3.   

    同意 iwishflying(云儿) 
    覆盖ProcessCmdKey方法