all groups > vb.net controls > october 2006 >
You're in the

vb.net controls

group:

Have alignment different in different columns


Have alignment different in different columns Laurence
10/27/2006 7:27:08 PM
vb.net controls:
In VB.net (VS.2005) using the Microsoft datagrid,
is there any way to have the alignment of the column headers different for each column?

With SelectionMode = FullRowSelect.

I can get the alignment of the data cells different for each column, by setting the
RowsDefaultCellStyle alignment property to "Not Set" and then for each column
in the columns collection, set the DefaultCellStyle Alignment Property to what I want
it to be for that specific column. But that setting only applies to the column's
data, not the column header.

There is an alignment property in the ColumnHeadersDefaultCellStyle, but that setting,
applies to all columns, there is not a way to set it for each individual column.

Does anyone know of a way around this?

Thanks in advance,

Re: Have alignment different in different columns Laurence
10/30/2006 11:12:12 AM
Yes, it is the DataGridView

If I set the DataGridView1.Columns(1).Headercell.style.alignment= DataGridViewContentAlignment.MiddleRight

the does get moved to the right, but not all the way, there are some spaces between the
header the right edge of the column.

Laurence


[quoted text, click to view]
Re: Have alignment different in different columns Yuichiro Ochifuji
10/30/2006 9:57:48 PM
Hi,

Is it about DataGirdView?
You may use Me.DataGridView1.Columns(i).HeaderCell.Style.Alignment.


--
Yuichiro Ochifuji
JAPAN
Re: Have alignment different in different columns Yuichiro Ochifuji
11/1/2006 11:56:18 PM
Hi

[quoted text, click to view]

Please draw in CellPainting event.
Perhaps, it is possible.


--
Yuichiro Ochifuji
JAPAN
I am not good at English.(^^;
AddThis Social Bookmark Button