Bonjour,

J'ai un composant Telerik nommé RadComboBox (c'est un composant amélioré du combobox de base) et je voudrais que pour chaque valeur dans la radcombobox, qu'il y ait une petite image représentant une couleur en RGB contenue dans une base de donnée. Mais je ne sais pas comment faire, je n'arrive même pas à changer la couleur de fond du back color. Auriez-vous quelques suggestions sur la manière d'y arriver? Je préférerai en priorité une petite image, mais si ce n'est pas possible changer le fond de la valeur me suffirait. Voici le bout de code ou j'ai essayé de faire ces modifications. Merci.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Public Shared Sub FillActivityTypes(ByRef ComboBox As Telerik.WinControls.UI.RadComboBox, ByVal Type As ActivityType)
    Dim imgList As New System.Windows.Forms.ImageList()
    Select Case Type
        Case ActivityType.ByCustomer
            If My.Application.CurrentCustomerID <> "" Then
                Dim Customer As BusinessLayer.Customer = BusinessLayer.Customer.GetInstance(My.Application.CurrentCustomerID)
                Dim dt As DataTable = BusinessLayer.GlobalPresentation.ActivityPresentation.GetAllActivityTypes(BusinessLayer.eActivityTypeTarget.ByCustomer, Customer.id_channel)
                ComboBox.DataSource = dt
                Customer = Nothing
 
                For Each item As DataRow In dt.Rows
                    'Dim img As Image = New Bitmap(24, 12, PixelFormat.Format32bppArgb)
                    'Dim red As Graphics = Graphics.FromImage(img)
                    Dim activType As BusinessLayer.ActivityType = New BusinessLayer.ActivityType(item(0))
                    Dim strargb As String = activType.Color
                    'ComboBox.BackColor = ToolsLayer.StringTools.colorFromActivityType(strargb) ''Couleur au format RGB
 
                    '''Tentative d'insertion d'image
                    'Dim Brush As New SolidBrush(Color.FromArgb(r, g, b))
                    'red.FillRectangle(Brush, New Rectangle(0, 0, 24, 12))
                    'imgList.Images.Add(img)
 
                Next
            Else
                ComboBox.DataSource = Nothing
            End If
        Case ActivityType.ByContact
            Dim dtcontact As DataTable = BusinessLayer.GlobalPresentation.ActivityPresentation.GetAllActivityTypes(BusinessLayer.eActivityTypeTarget.ByContact)
            ComboBox.DataSource = dtcontact
        Case ActivityType.Personal
            Dim dtpersonal As DataTable = BusinessLayer.GlobalPresentation.ActivityPresentation.GetAllActivityTypes(BusinessLayer.eActivityTypeTarget.Personal)
            ComboBox.DataSource = dtpersonal
    End Select
    ComboBox.DisplayMember = BusinessLayer.Tags.ActivityType.Label
    ''Même ceci ne change pas le fond du contrôle radcombobox
    ComboBox.BackColor =Color.Red
    ComboBox.ValueMember = BusinessLayer.Tags.ActivityType.id_ActivityType
End Sub