欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

實(shí)現(xiàn)DataGridView控件中CheckBox列的使用實(shí)例

 更新時(shí)間:2014年01月20日 14:52:51   作者:  
最近做WindowsForms程序,使用DataGridView控件時(shí),加了一列做選擇用,發(fā)現(xiàn)CheckBox不能選中。搜索后,要實(shí)現(xiàn)DataGridView的CellContentClick事件,將代碼貼一下
復(fù)制代碼 代碼如下:

/// <summary>
        /// 實(shí)現(xiàn)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;
                }
            }

相關(guān)文章

最新評(píng)論