Hi,
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
For x As Integer = 0 To 20
ListBox1.Items. Add(String.Form at("Item {0} {1} Line 2", x,
ControlChars.Ne wLine))
Next
ListBox1.DrawMo de = DrawMode.OwnerD rawVariable
End Sub
Private Sub ListBox1_DrawIt em(ByVal sender As Object, ByVal e As
System.Windows. Forms.DrawItemE ventArgs) Handles ListBox1.DrawIt em
Dim g As Graphics = e.Graphics
Dim s As String
Dim d As Date
Dim br As Brush = SystemBrushes.W indowText
Dim brBack As Brush
Dim rDraw As Rectangle
Dim bSelected As Boolean = CBool(e.State And
DrawItemState.S elected)
rDraw = e.Bounds
rDraw.Inflate(-1, -1)
If bSelected Then
brBack = Brushes.LightBl ue
g.FillRectangle (Brushes.LightB lue, rDraw)
g.DrawRectangle (Pens.Blue, rDraw)
Else
brBack = Brushes.White
g.FillRectangle (brBack, e.Bounds)
End If
br = Nothing
brBack = Nothing
rDraw = Nothing
Try
s = ListBox1.Items. Item(e.Index).T oString
Catch
s = ""
End Try
Debug.WriteLine (String.Format( "{0} {1} {2}", e.Index, s,
e.Bounds.ToStri ng))
g.DrawString(s, ListBox1.Font, Brushes.Black,
RectangleF.op_I mplicit(e.Bound s))
End Sub
Private Sub ListBox1_Measur eItem(ByVal sender As Object, ByVal e As
System.Windows. Forms.MeasureIt emEventArgs) Handles ListBox1.Measur eItem
e.ItemHeight += e.ItemHeight
End Sub
Ken
-------------
"Max" <ma*****@yahoo. com> wrote in message
news:Ne******** ************@co mcast.com:
I need some control that basically acts as a listbox, but allows each
item to take up more then one line. I've tried adding a new item and
putting in a vbCrLf in there, but that just comes out as a box on the
same line. Is there some way of making the listbox show multiple lines
for each item, or is there another control (3rd party maybe) that will
let me do this?
--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (
http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 262.10.6 - Release Date: 5/28/2004