I came across some code the other day that I found useful and figured I would pass it along.  This code is a VB .NET custom control that adds an image to each item of a combobox control.  I mad a few changes to the code to convert it into a standalone class.  Hope someone out there finds this useful.

'Main Implementation

Imports System.Windows.Forms
Imports System.Drawing

Namespace ExtCon

    Public Class PictureCombobox
        Inherits ComboBox

        Private imgList As ImageList

        Public Sub AddItem(ByVal img As Image, ByVal name As String)
            imgList.Images.Add(img)
            Me.Items.Add(name)
            Me.ItemHeight = imgList.ImageSize.Height
            Me.Width = Me.imgList.ImageSize.Width + 18
        End Sub

        Private Sub PictureCombobox_DrawItem(sender As Object, e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
            If e.Index <> -1 Then
                e.Graphics.DrawImage(imgList.Images(e.Index), e.Bounds.Left, e.Bounds.Top)
            End If
        End Sub


        Private Sub PictureCombobox_MeasureItem(sender As Object, e As System.Windows.Forms.MeasureItemEventArgs) Handles Me.MeasureItem
            e.ItemHeight = imgList.ImageSize.Height
            e.ItemWidth = imgList.ImageSize.Width
        End Sub
    End Class

End Namespace




'Designer code

Partial Class PictureCombobox
    Inherits System.ComponentModel.Component

    <System.Diagnostics.DebuggerNonUserCode()> _
    Public Sub New(ByVal container As System.ComponentModel.IContainer)
        MyClass.New()

        'Required for Windows.Forms Class Composition Designer support
        If (container IsNot Nothing) Then
            container.Add(Me)
        End If

    End Sub

    <System.Diagnostics.DebuggerNonUserCode()> _
    Public Sub New()
        MyBase.New()

        'This call is required by the Component Designer.
        InitializeComponent()

    End Sub

    'Component overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Component Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Component Designer
    'It can be modified using the Component Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        components = New System.ComponentModel.Container()
    End Sub

End Class




Feel free to donate if you find this useful.

BTC: 19fnZ8D3UAcr1hDkVc4USbxHrFtVNuDUP5
LTC: LiC4tbyTvjzHDN9K1zcJ4RdP53QbtDRgGp
DOGE: D6jxxMURuLXsupesw9YmSzSwMQwQxGM9aG