在RowHeader单元格中设置文本 [英] Set a text in a RowHeader cell
问题描述
嗨。
我需要将文本设置为Datagridview的行标题,就像我们可以使用列标题一样。
例如:
=================================== =====
| COLUMN A |栏目B |栏目B |
ROW 1 | | | |
ROW 2 | | | |
等..
============================== ==========
我需要将行1,行2等设置为每个行标题。
我试过:
DataGridView1.Rows(i).HeaderCell.Value =" some text"
....但是没有用。没有显示文字
我需要使用行标题的原因是因为我想享受
标题行为(它会自动改变外观
鼠标鼠标是
,标记选中的行等。
设置文本有一些方法吗?
Cesar
" MSNews" <信息的(a)carsoftnet.com.br>在消息中写道
news:uN ************** @ TK2MSFTNGP12.phx.gbl ...
嗨。
我需要将文本设置为Datagridview的行标题,就像我们可以用列标题一样使用
。
例如:
=================================== =====
| COLUMN A |栏目B |栏目B |
ROW 1 | | | |
ROW 2 | | | |
等..
============================== ==========
我需要将行1,行2等设置为每个行标题。
我试过:
DataGridView1.Rows(i).HeaderCell.Value =" some text"
....但是没有用。没有显示文字
我需要使用行标题的原因是因为我想享受
标题行为(它会自动改变外观
鼠标鼠标,标记所选行等。)
有一些方法可以设置文本吗?
Cesar
''创建一个新的datagridView控件。
datagridView1.Bounds =新矩形(新点(20,40),新尺寸( 400,160))
datagridView1.Columns.Add(" FED"," FOD")
datagridView1.Rows.Add ()
datagridView1.Rows(0).Cells(0).Value =" FOO"
datagridView1.Rows(0) .HeaderCell.Value =" SOP"
Me.Controls.Add(datagridView1)
< blockquote>嗯,我明白了。
我们必须使用数据未绑定网格才能更改标题单元格。
谢谢。
Cesar
" Homer J Simpson <无**** @ nowhere.com>在消息中写道
news:bcpMf.5394
Cp4.4488@edtnps90 ...
MSNews ; <信息的(a)carsoftnet.com.br>在消息中写道
新闻:uN ************** @ TK2MSFTNGP12.phx.gbl ...
你好。
我需要将文本设置为Datagridview的行标题,就像我们可以用列标题一样。
例如:
========= ===============================
| COLUMN A |栏目B |栏目B |
行1 | | |行2 | | | |
等..
====================================== ==
我需要将行1,行2等设置为每个行标题。
我试过:
DataGridView1.Rows(i).HeaderCell.Value = 一些文字
......但没有用。没有显示文字
我需要使用行标题的原因是因为我想享受标题行为(它会自动改变鼠标鼠标的外观,标记所选行等等。
有一些方法可以设置文本吗?
Cesar
''创建一个新的datagridView控件。
datagridView1.Bounds =新矩形(新点(20,40),新尺寸(400,
160))
datagridView1.Columns.Add(" FED", FOD)
datagridView1.Rows.Add()
datagridView1.Rows(0).Cells(0).Value =" FOO"
datagridView1.Rows(0).HeaderCell.Value =" SOP"
Me.Controls.Add(datagridView1)
Hi.
I need to set texts to the row headers of a Datagridview, like we can do with column headers.
For example:
========================================
| COLUMN A | COLUMN B | COLUMN B |
ROW 1 | | | |
ROW 2 | | | |
etc..
========================================
I need to set the Row 1, Row 2, etc, to each row header.
I tryed:
DataGridView1.Rows(i).HeaderCell.Value = "some text"
.... but did not works. No text is displayed
The reason I need to use row header is because I want to enjoy
the header behavior (it automatically changes appearance
on mouse mouse, marks the selected row, etc).
There is some manner to set the text?
Cesar
"MSNews" <info(a)carsoftnet.com.br> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Hi.
I need to set texts to the row headers of a Datagridview, like we can do
with column headers.
For example:
========================================
| COLUMN A | COLUMN B | COLUMN B |
ROW 1 | | | |
ROW 2 | | | |
etc..
========================================
I need to set the Row 1, Row 2, etc, to each row header.
I tryed:
DataGridView1.Rows(i).HeaderCell.Value = "some text"
.... but did not works. No text is displayed
The reason I need to use row header is because I want to enjoy
the header behavior (it automatically changes appearance
on mouse mouse, marks the selected row, etc).
There is some manner to set the text?
Cesar
'' Create a new datagridView control.
datagridView1.Bounds = New Rectangle(New Point(20, 40), New Size(400, 160))
datagridView1.Columns.Add("FED", "FOD")
datagridView1.Rows.Add()
datagridView1.Rows(0).Cells(0).Value = "FOO"
datagridView1.Rows(0).HeaderCell.Value = "SOP"
Me.Controls.Add(datagridView1)
Hmm I got the point.
We must to use a data-unbound grid to can change the header cell.
Thanks.
Cesar
"Homer J Simpson" <no****@nowhere.com> wrote in message
news:bcpMf.5394
Cp4.4488@edtnps90...
"MSNews" <info(a)carsoftnet.com.br> wrote in message
news:uN**************@TK2MSFTNGP12.phx.gbl...
Hi.
I need to set texts to the row headers of a Datagridview, like we can do
with column headers.
For example:
========================================
| COLUMN A | COLUMN B | COLUMN B |
ROW 1 | | | |
ROW 2 | | | |
etc..
========================================
I need to set the Row 1, Row 2, etc, to each row header.
I tryed:
DataGridView1.Rows(i).HeaderCell.Value = "some text"
... but did not works. No text is displayed
The reason I need to use row header is because I want to enjoy
the header behavior (it automatically changes appearance
on mouse mouse, marks the selected row, etc).
There is some manner to set the text?
Cesar
'' Create a new datagridView control.
datagridView1.Bounds = New Rectangle(New Point(20, 40), New Size(400,
160))
datagridView1.Columns.Add("FED", "FOD")
datagridView1.Rows.Add()
datagridView1.Rows(0).Cells(0).Value = "FOO"
datagridView1.Rows(0).HeaderCell.Value = "SOP"
Me.Controls.Add(datagridView1)
这篇关于在RowHeader单元格中设置文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!