gpt4 book ai didi

c# - 关于dataGridView的Row和Column Headers的问题

转载 作者:行者123 更新时间:2023-11-30 17:16:12 25 4
gpt4 key购买 nike

关于行标题:

1) 我可以在上面写文字吗?

2) 我可以改变它们的颜色,使它们与所有其他单元格的颜色不同吗?

3) 我可以让点击它们时出现的箭头消失吗?

关于列标题:

4) 我可以改变它们的颜色吗?

提前致谢。

最佳答案

回答 3)

处理 CellPainting 事件:

dataGridView.CellPainting += 
new DataGridViewCellPaintingEventHandler (dataGridView_CellPainting);

然后对于处理程序,只响应“-1”(表示行标题)的 ColumnIndex:

void dataGridView_CellPainting (object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex == -1)
{
e.PaintBackground (e.CellBounds, true);
e.Handled = true;
}
}

关于c# - 关于dataGridView的Row和Column Headers的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7400261/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com