views:

120

answers:

1

hi, I've got problem. I'm using windows.forms ListView to show some data and I need to make two lines in one row. I've found solution to make row higher by adding ImageList with specified height and then I add Environment.NewLine to my text. It works in Vista and 7 but in XP instead of new line there are shown squares. I've been trying to add "\n" "\r\n" and ASCII char 10 but ther were still squares! After few days I still don't know what's wrong and I need your help.

+1  A: 

Nice find, but you are taking advantage of an otherwise undocumented feature. It is common for native Windows controls to not interpret control characters. ListBox still doesn't do it for example. Label doesn't expand tabs. Etcetera.

Updating the XP listview is not an option, you'll need to use custom drawing to get this right. Use the ListView.DrawItem event, there's a good example in the MSDN Library topic for it.

Hans Passant