Best way to prevent selection of items in a ComboBox

G

Guest

I have several items displayed in a ComboBox.

Only a subset of these items should be selectable, the others are for
display purposes.

What is the best way to handle this. Via an event or create a subclass to
do it?
 
M

Morten Wennevik

Hi Nick,

You could do it by handling the DrawItem event (setting drawmode to either
of the ownerdrawn ones).
Set selection color only on valid items making the other items appear
nonselectable. If they still select one of those, detect it and either
change the selection or ownerdraw to make it appear as nothing selected.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top