1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
Protected Overrides Sub OnDrawItem(ByVal e As DrawItemEventArgs)
MyBase.OnDrawItem(e)
Dim br As Brush
Dim fDisposeBrush As Boolean
Console.WriteLine(m_IconPath)
If Not m_Icon Is Nothing Then
e.Graphics.DrawIcon(m_Icon, e.Bounds.Left + 2, e.Bounds.Top + 2)
End If
Dim rcBk As Rectangle = e.Bounds
rcBk.X += 32
If CBool(e.State And DrawItemState.Selected) Then
br = New LinearGradientBrush(rcBk, SystemColors.Highlight, SystemColors.Control, 0)
fDisposeBrush = True
Else
br = SystemBrushes.Control
End If
e.Graphics.FillRectangle(br, rcBk)
' Only Dispose the brush if we created it, not if it was retrieved from SystemBrushes
If fDisposeBrush Then br.Dispose()
br = Nothing
Dim sf As StringFormat = New StringFormat()
sf.HotkeyPrefix = HotkeyPrefix.Show
sf.SetTabStops(60, New Single() {0})
br = New SolidBrush(e.ForeColor)
e.Graphics.DrawString(GetRealText(), m_Font, br, e.Bounds.Left + 25, e.Bounds.Top + 2, sf)
br.Dispose()
br = Nothing
sf.Dispose()
sf = Nothing
End Sub |
Partager