DataGridView 将文本放在 RowHeader 的 ColumnHeader 中 [英] DataGridView put text in ColumnHeader of RowHeader
本文介绍了DataGridView 将文本放在 RowHeader 的 ColumnHeader 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以将文本添加到 RowHeader 的 ColumnHeader 中.我将自动增量放入 DataGridView 的 Rowheaders 中,我想输入否".以上.
Is it possible to add text into ColumnHeader of the RowHeader. I put autoincrement into Rowheaders of my DataGridView and I would like to put "No." above that.
类似于:
//Autoincrement RowHeaders
foreach (DataGridViewRow row in myDGV.Rows)
{
row.HeaderCell.Value = String.Format("{0}", row.Index + 1);
}
No. | myColumn 1 | myColumn 2
1 | myText | myText
2 | myText | myText
//the "No." column are actually RowHeaders
推荐答案
所以基本上你需要显示No".在左上角?
So basically you need to display "No." in top left corner?
那个区域叫做TopLeftHeaderCell
.就像其他的DataGridViewCell
一样,你可以设置它的Value
属性来实现任务.
That area is called TopLeftHeaderCell
. It is just like the other DataGridViewCell
, you can set its Value
property to achieve the task.
dataGridView.TopLeftHeaderCell.Value = "No.";
这篇关于DataGridView 将文本放在 RowHeader 的 ColumnHeader 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文