Is there any solution can make the text in the column and cell of ListView control to be more than 1 line?
-
27 апреля 2012 г. 18:18
I want to make the text in column of ListView control to be 2 lines. So I use the codes below to test. The result is bad.
The "vbcrlf" in str2 doesnot work at all.
Dim str1 As String = "Job Number12345"
Dim str2 As String = "Job Number" + vbCrLf + "12345"ListView1.Columns.Add(str1, 100, HorizontalAlignment.Center)
ListView1.Columns.Add(str2, 100, HorizontalAlignment.Center)
Dim item As New ListViewItem(str1)
item.SubItems.Add(str2)
ListView1.Items.Add(item)
Is there any solution can make the text in the column and cell of ListView control to be more than 1 line? Thanks in advance.
- Изменено hyeewang 27 апреля 2012 г. 18:19
Все ответы
-
27 апреля 2012 г. 20:02
There is. You can 'draw' the item yourself.
You can set your listview OwnerDraw property to True. Read the related MSDN article. It describes the process very well.
The only drawback - it requires more coding. You will have to 'manually' draw the entire listview item using GDI+ methods.- Изменено cicatrixx 27 апреля 2012 г. 20:03
-
27 апреля 2012 г. 20:17
I added a row of ControlPaint.Buttons above the listview.
-
1 мая 2012 г. 17:14
Thank you.
I will try.
-
1 мая 2012 г. 17:16
Thank you, John.
How do you add the row of ControlPaint? I also want to add something like that.
-
1 мая 2012 г. 17:30
Thank you, John.
How do you add the row of ControlPaint? I also want to add something like that.
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/ed0a7b08-d71e-4b57-b4ff-4ff7b88a75c6- Помечено в качестве ответа Shanks ZenMicrosoft Contingent Staff, Moderator 8 мая 2012 г. 2:34

