您现在的位置是:网站首页> 编程资料编程资料

实现DataGridView控件中CheckBox列的使用实例_实用技巧_

2023-05-24 281人已围观

简介 实现DataGridView控件中CheckBox列的使用实例_实用技巧_

复制代码 代码如下:

///
        /// 实现DataGridView控件中CheckBox列的使用
        ///

        ///
        ///
        private void dgvTradList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0 && e.RowIndex != -1)
            {
                if ((bool)dgvTradList.Rows[e.RowIndex].Cells[0].EditedFormattedValue == true)
                {
                    dgvTradList.Rows[e.RowIndex].Cells[0].Value = false;
                }
                else
                {
                    dgvTradList.Rows[e.RowIndex].Cells[0].Value = true;
                }
            }

-六神源码网