Hi,
I have a C# app with a combo box. I was add items to it in the usual way using a loop to loop through some objects and add each name property value to the combobox:
comboBox1.Items.Add(object.name);
But then I decided I would like to display an image by the text, so I changed the drawMode and the dropDownStyle and set up an event handler on drawItem to draw first the image and then the text.
The image draws correctly, and then comes the problem. I am using something like
e.Graphics.DrawString("What goes here?", e.Font, new SolidBrush(e.ForeColor), e.Bounds.Left,e.Bounds.Top);
I cant get the object.name value into the DrawString parameter. Does the DrawItemEventArgs object e have the value, and if so how do I access it?
If it doesnt what are my real options? I have seem some examples that maintain a list to keep the values and then reference that using e.Index. Is this really the best way?
Thanks in advance