У меня проблема с использованием события DrawItem для MetroFramework ComboBox. Ранее я использовал system.windows.form.ComboBox vb 2015 по умолчанию, и событие DrawItem работает, и событие DrawItem не срабатывает после того, как я использую MetroFramework.
Private Sub ComboBox_Counter_DrawItem(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.DrawItemEventArgs) _
Handles ComboBox_Counter.DrawItem
On Error Resume Next
MsgBox("Here")
e.DrawBackground()
Dim drv As DataRowView = CType(ComboBox_Counter.Items(e.Index), DataRowView)
Dim id As Integer = drv("counterNo").ToString()
Dim name As String = drv("description").ToString()
Dim r1 As Rectangle = e.Bounds
r1.Width = r1.Width / 6
Using sb As SolidBrush = New SolidBrush(e.ForeColor)
e.Graphics.DrawString(id, e.Font, sb, r1)
End Using
Using p As Pen = New Pen(Color.Black)
e.Graphics.DrawLine(p, r1.Right, 0, r1.Right, r1.Bottom)
End Using
Dim r2 As Rectangle = e.Bounds
r2.X = e.Bounds.Width / 6
r2.Width = r2.Width '/ 2
Using sb As SolidBrush = New SolidBrush(e.ForeColor)
e.Graphics.DrawString(name, e.Font, sb, r2)
End Using
End Sub