Hooking the combobox dropdown event

caeanis

Freshman
Joined
Sep 6, 2006
Messages
40
Is there any way to specify the event when the combobox is droped down and items are hightlighted as they move through the selection? I want to display a picture box in which the image changes and each item is highlighted. Is this possible? Most of the code I've looked at has to do with after a specific item is selected. Is there any way to use that change in the combobox to trigger the action I discribed? Much thanks!
 
Not 100% on this but you would probably need to set it's DrawMode to one of the OwnerDraw options and handle the DrawItem event to take care of the actual rendering to screen logic.
 
I was going to make that recommendation, but I was kind of hoping that someone would post an example that involved something like overriding WndProc to intercept the appropriate message. The OwnerDraw feature is intended for rendering the UI, not broadcasting events. It is unlikely that it will ever become a problem, but the concern would be that a future version of DotNet would implement owner drawing differently in a way that would render this technique malfunctional (i.e. if the drawn combo box items are chached and don't need to be redrawn). That being said, PD's suggestion is probably still the way I would go, but mostly out of laziness.
 
I wasn't overly enthused with my own suggestion either, just couldn't think of an easier way. Did toy with the idea of overriding WndProc but that still looked like an awful lot of work to implement.
 
Back
Top