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

2019/7/7 18:28:01

本文主要是介绍实现DataGridView控件中CheckBox列的使用实例,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

复制代码 代码如下:

/// <summary>
        /// 实现DataGridView控件中CheckBox列的使用
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        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;
                }
            }


这篇关于实现DataGridView控件中CheckBox列的使用实例的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


暂无数据...
扫一扫关注最新编程教程