I have a .NET ListView control in which I display stack traces. I used the ListView since I needed to manipulate the font/colors of certain lines.
However, it seems there is some kind of maximum regarding the width of the columns, either the number of characters displayed, or the number of pixels a column can be.
Here is a simple LINQPad example that shows the problem:
void Main()
{
using (var fm = new Form())
{
ListView lv = new ListView();
fm.Controls.Add(lv);
lv.Dock = DockStyle.Fill;
lv.View = View.Details;
lv.Columns.Add("C", -1, HorizontalAlignment.Left);
string line = new string('W', 258) + "x";
lv.Items.Add(line);
line = new string('W', 259) + "x";
lv.Items.Add(line);
lv.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.ColumnContent);
lv.Columns[0].Width.Dump();
fm.ShowDialog();
}
}
Screenshot:
As you can see, the line containing 258 W's + an X, shows the x, whereas the next line containing one additional W, does not show the x.
The output of the width calculation there shows that the current width of the column is 2864 pixels.
The question is this: Is there anything I can tweak on the ListView to work around this limitation?