I have a word wrap which is the width of the list box, how can I split the text that populates this listbox and push it onto another line if it exceeds this wrap? I need to apply this to every line of text in the list box.
Asked
Active
Viewed 158 times
0
-
1Are you using the [windows listbox](http://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.aspx)? [What have you tried](http://mattgemmell.com/2008/12/08/what-have-you-tried/)? – Ryan Gates Nov 29 '12 at 14:25
-
I can get the length of the string using this http://stackoverflow.com/questions/451903/how-can-i-convert-a-string-length-to-a-pixel-unit and compare it the width of the text box. I cant split the string on the word that crosses the listbox boundary and push it on a new line, but still have the listbox still think its on the same line, if that makes sense. so ListBox[i] could have its contents over two lines. – Lewis Nov 29 '12 at 14:29
-
It looks like you would [have to create your own custom control for this](http://social.msdn.microsoft.com/forums/en-US/winforms/thread/8052b406-1bd4-4a9c-b003-d7b08a6577c2). Would that be an acceptable solution? – Ryan Gates Nov 29 '12 at 14:56