07-08-16, 05:05 AM
عندى listview يوجد بها 15 Columns اريد اضافة الصور فى ال15 Columns subitems المشكلة ان الكود يعمل تعليق فى الفورم
جربت فحص اذا تم اضافة item جديد يتم اضافة الصوره الخاصة بها لاكن عند الفحص يتم اذالة جميع الصور من subitems كلها علاشان الكود يحتوى على loop ليرسم على subitems و هو الذى يسبب التعليق فى الفورم حل يوجد حل لهذه المشكلة
كود :
Private Sub Listview1_DrawSubItem(sender As Object, e As DrawListViewSubItemEventArgs) Handles Listview1.DrawSubItem
Try
Dim imgs = New Rectangle(e.Bounds.Location.X, e.Bounds.Location.Y, e.Bounds.Height, e.Bounds.Height)
If (e.SubItem.Text = e.SubItem.Text) Then
e.Graphics.DrawImage(Image.FromFile(Application.StartupPath & "\Images\" + e.SubItem.Text + ".png"), imgs)
Else
e.DrawDefault = True
End If
Catch ex As Exception
End Try
End Sub