17-01-17, 03:38 PM
وجدت وضوع يتكلم هن هذا http://vb4arb.com/vb/thread-16450.html لاكن يوجد مشكلة واحدة فقط انه لايمكن اضافة اكثر من صوره عند اضافة صوره اخرى يتم تغير جميع الصور هل من حل
كود :
Private Sub ListView1_DrawSubItem(sender As Object, e As DrawListViewSubItemEventArgs) Handles ListView1.DrawSubItem
For Each itm As ListViewItem In ListView1.Items
If e.SubItem.Text = itm.SubItems(1).Text Then
Dim imageRect = New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Height, e.Bounds.Height)
e.Graphics.DrawString(e.SubItem.Text, e.SubItem.Font, New SolidBrush(e.SubItem.ForeColor), (e.SubItem.Bounds.Location.X + 15), e.SubItem.Bounds.Location.Y + 3)
e.Graphics.DrawImage(Image.FromFile(Application.StartupPath + "\Data\" + TextBox2.Text + ".png"), imageRect)
Else
e.DrawDefault = True
End If
Next
End Sub
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ListView1.OwnerDraw = True
End Sub
Private Sub ListView1_DrawColumnHeader(sender As Object, e As DrawListViewColumnHeaderEventArgs) Handles ListView1.DrawColumnHeader
e.DrawDefault = True
End Sub