1、 checkbox点击事件

private void myStyleDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == -1 || e.RowIndex == -1) return;
            if (this.myStyleDataGridView1.Columns[e.ColumnIndex].Name == "IsSelect")
            {
                if (this.myStyleDataGridView1[e.ColumnIndex, e.RowIndex].Value == null)
                {
                    this.myStyleDataGridView1.Rows[e.RowIndex].Cells["IsSelect"].Value = false;
                }
                if (this.myStyleDataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString().ToUpper() == "TRUE")
                {
                    this.myStyleDataGridView1[e.ColumnIndex, e.RowIndex].Value = false;
                    myStyleDataGridView1.SelectAll();
                }
                else
                {
                    this.myStyleDataGridView1[e.ColumnIndex, e.RowIndex].Value = true;
                }

            }
            getTotal();

        }
View Code

 

相关文章: