Problem W/ ListView Alignments

  • Thread starter Thread starter John Bowman
  • Start date Start date
J

John Bowman

Hello,

I'm working w/ a simple testing ListView control (in C#) in Details view
that has 3
columns. Why is it that Column 0's TextAlign cannot be set through the IDE
or from code such as below. It always defaults to Left.

lstCells.Columns[0].TextAlign = HorizontalAlignment.Center;

Anybody know what's going on here? The other 2 columns can be set via the
IDE or via code and they work just fine.

TIA,
 
The alignment of the first column is always left-justified, and it cannot be
changed. This is a limitation of the Windows API.

As a possible work-around, you could use a dummy first column with a width
set to 0, so that you would be able to change the alignment of the
remaining.
 
Gabriele,

Thanks for the info. That explains it. I'll ty the work around you
suggested.
 
Back
Top