Apr 27th, 2010, 02:39 PM
With the help of NickThissen, I've put together an inherited ListBox control that allows the item's height to allow multiple lines of text be shown. Here are some properties to make note of:
- DrawDivider (Boolean) - Determines whether a horizontal line is drawn between the items or not.
- DividerColor (Color) - The color of the divider line.
- DividerThickness (Single) - The thickness of the divider line.
- MultilineEnabled (Boolean) - Controls whether the ListBox allows the item's height to grow to span multiple lines or not. If set to false the ListBox behaves like a normal ListBox except that a divider line may still be drawn between the items.
- DrawMode - This is fixed at OwnerDrawVariable to allow the item's to be drawn multilined or normal.
To use the control, simply add the MultilineListbox.vb file to your project, build the solution then use like any other control.
Last edited by JuggaloBrotha; Apr 27th, 2010 at 03:16 PM.
Apr 27th, 2010, 04:34 PM
Does it work off of the wrapping of the text? Or is there a way to control it - say with an Environment.NewLine - I guess, how does one get an item to go multi-line?
Edit- oh, very cool by the way...
Apr 27th, 2010, 06:18 PM
Right now, it's Environment.NewLine that controls it, no text wrapping but then again the FW ListBox doesn't do text wrapping either. However, if I get the time I can add it in somehow or if you or someone else wants to, feel free to.
My next plan with it is to take this code and merge it with this: ListBox/ListView Move Item with Mouse so you can move the items around with the mouse even though they're no longer single lines of text.
Click Here to Expand Forum to Full Width
Survey posted by VBForums.