ComponentOne Input for WinForms
Using the C1Input Controls / C1Input Controls / C1ComboBox Control Overview / Adding Images to Items in the ComboBox
In This Topic
    Adding Images to Items in the ComboBox
    In This Topic

    You can easily use the images from the ImageList to add images to each item in the dropdown list of a C1ComboBox control.

    To add images to C1ComboBoxItems at Design time, complete the following:

    1. Add the C1ComboBox control to your form.
    2. Add items to C1ComboBox.Items collection using the String Collection Editor.
    3. Add the ImageList control to your form.
    4. Add images to the imageList1.
    5. Set keys (Name) of the images equal to the items in C1ComboBox.Items.

     

    To add images to C1ComboBoxItems at Run time, add the following code:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    c1ComboBox1.ItemsImageList = imageList
    imageList.Images.Add("First item", Image.FromFile("First.png"))
    c1ComboBox1.Items.Add("First item")

    To write code in C#

    C#
    Copy Code
    c1ComboBox1.ItemsImageList = imageList;
    imageList.Images.Add("First item", Image.FromFile("First.png"));
    c1ComboBox1.Items.Add("First item");

     

    See Also