简体   繁体   English

DataGridView将文本放在RowHeader的ColumnHeader中

[英]DataGridView put text in ColumnHeader of RowHeader

Is it possible to add text into ColumnHeader of the RowHeader. 是否可以将文本添加到RowHeader的ColumnHeader中。 I put autoincrement into Rowheaders of my DataGridView and I would like to put "No." 我把自动增量放入我的DataGridView的Rowheaders中,我想把“不” above that. 在那上面。

Something like: 就像是:

//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

So basically you need to display "No." 所以基本上你需要显示“否” in top left corner? 在左上角?

That area is called TopLeftHeaderCell . 该区域称为TopLeftHeaderCell It is just like the other DataGridViewCell , you can set its Value property to achieve the task. 它就像其他DataGridViewCell ,可以设置其Value属性来实现任务。

dataGridView.TopLeftHeaderCell.Value = "No.";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM