DataGridView的把文字的rowHeader中的columnHeader [英] DataGridView put text in ColumnHeader of RowHeader

查看:1715
本文介绍了DataGridView的把文字的rowHeader中的columnHeader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能添加文本到的rowHeader的的columnHeader。我把自动增量到我的DataGridView的Rowheaders,我想提出否。 。上面



是这样的:

  //自动增量RowHeaders 
的foreach(在myDGV.Rows的DataGridViewRow行)
{
row.HeaderCell.Value =的String.Format({0},row.Index + 1);
}

号| myColumn 1 | myColumn 2

1 |会将myText |会将myText
2 |会将myText |会将myText

//了否。列实际上是RowHeaders


解决方案

所以基本上你需要显示没有。在左上角?



这区域被称为 TopLeftHeaderCell 。它就像其他的DataGridViewCell ,你可以设置它的属性来实现任务。

  dataGridView.TopLeftHeaderCell.Value =号; 


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.

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. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆