Click to See Complete Forum and Search --> : ComboBox ContextMenu DrawItem problem


DROTTA
May 3rd, 2004, 02:49 AM
Using C++ .NET 2003 I have created a form with many different controls. Using the ContextMenu property I attach a Context Menu with Menu Items that are OwnerDrawn using the DrawdItem and MeasureItem Events. All is well when I attach this ContextMenu to most of the controls. However, when I attached the same ContextMenu to a Combobox and right click on that ComboBox I get a small empty box with no items drawn. Any item that I set the OwnerDraw to false will show up. It seems that the DrawItem Event Handler is never reached for the menu items when the ContextMenu is attached to a ComboBox. This same ContextMenu does work for other controls. I did discover that adding a DrawItem EventHandler to the ComboBox itself will activate when the ContextBox is displayed with the sender being the ComboBox and the index out of range. Is this a bug or am I missing something. A sample is attached in case my explanation is lacking. Thanks for any help!