Home Forums WinForms controls Other WinForms controls Images in a Wincombobox

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18117 |

    Hi,

    I have to display a list of images in a WinCombobox. How can i do that ?

    Thx for help

    Imported from legacy forums. Posted by Pierrick (had 2866 views)

    User (Old forums)
    Member
    Post count: 23064

    If you are dataBound, this will work automatically. If you are working in an unbound fashion, you can do something like this :

    System.Drawing.Bitmap image = new Bitmap(@””);
    Xceed.Editors.WinComboBox myCombo = new Xceed.Editors.WinComboBox();

    Xceed.Grid.Column col = new Xceed.Grid.Column(“Picture”,typeof(Bitmap));
    myCombo.DropDownControl.Columns.Add(col);
    myCombo.DropDownControl.DataRows[0].Cells[1].Value = image;

    Imported from legacy forums. Posted by Matt (had 172 views)

    User (Old forums)
    Member
    Post count: 23064

    Ok it works fine! Thx !

    Now i want to put this WinComboBox in a grid like this :

    ‘******************************
    Dim cboIcon As New Xceed.Editors.WinComboBox
    Dim col As Xceed.Grid.Column = New Xceed.Grid.Column(“Icon”, GetType(Bitmap))
    cboIcon.DropDownControl.Columns.Add(col)
    Dim NewRow As Xceed.Grid.DataRow
    NewRow = cboIcon.DropDownControl.DataRows.AddNew()
    NewRow.Cells(0).Value = Icon1
    NewRow.EndEdit()
    NewRow = cboIcon.DropDownControl.DataRows.AddNew()
    NewRow.Cells(0).Value = Icon2
    NewRow.EndEdit()

    Dim cboIconEditor As New ComboBoxEditor(cboIcon)
    cboIconEditor.TemplateControl.DisplayFormat = “%Icon%”
    MyRow.Cells(“ColIcon”).CellEditorManager = cboIconEditor
    MyRow.Cells(“ColIcon”).CellViewerManager = New Xceed.Grid.Viewers.ComboBoxViewer(cboIcon)

    AddHandler cboIcon.SelectedValueChanged, AddressOf CboIcon_SelectedValueChanged

    ‘********************************************************************
    My WinComboBox appears in my cell but when i change the selectedvalue, the string “%Icon%” appears too and not the selected bitmap.

    Can you tell me how can i put the bitmap in my cell after the selectedvalueChanged event ?

    Thx again.

    Imported from legacy forums. Posted by Pierrick (had 3496 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.