永发信息网

C# 在datagridview中点击某个单元格时改变单元格边框

答案:2  悬赏:70  手机版
解决时间 2021-03-05 16:18
  • 提问者网友:我是我
  • 2021-03-04 22:39
C# 在datagridview中点击某个单元格时改变单元格边框
最佳答案
  • 五星知识达人网友:孤老序
  • 2021-03-04 22:52
private void DataGridView1_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{

if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
{
DataGridView dgv = (DataGridView)sender;

dgv[e.ColumnIndex, e.RowIndex].Style.BackColor = Color.Red;
dgv[e.ColumnIndex, e.RowIndex].Style.SelectionBackColor = Color.Red;
}
}
全部回答
  • 1楼网友:痴妹与他
  • 2021-03-04 23:37
datagridviewcellstyle style = new datagridviewcellstyle(); style.forecolor = color.red; gridview.rows[0].cells[0].style = style; 我看了一下,单元格的边框样式不能设定,上面的代码是设置单元格的文字颜色的。 不知道对你是否有帮助。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯