【问题标题】:How to change row color in datagridview after checkbox is selected选中复选框后如何更改datagridview中的行颜色
【发布时间】:2013-10-28 00:58:18
【问题描述】:

我想在我的行 Chckbox 处于选定模式后更改我的 datagridview 中特定行的颜色:

private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
    bool isSelect = dataGridView1[0, e.RowIndex].Value as bool? ?? false;
    if (isSelect)
    {
        // Change row color
    }
}

【问题讨论】:

标签: c# datagridview


【解决方案1】:
if (isSelect)
{
    // Change row color
    var row = this.dataGridView1.Rows[e.RowIndex]
    row.DefaultCellStyle.BackColor = Color.Red;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-26
    • 1970-01-01
    • 2020-09-21
    • 2020-10-05
    • 2022-01-24
    • 2019-09-02
    • 2011-08-16
    • 1970-01-01
    相关资源
    最近更新 更多