G
Guest
I am developing a Windows Forms application using VS.NET and C#. It is using
the MDI style interface. I have subclassed both the ComboBox and MenuItem
classes to provide the needed funtionality, creating the derived classes
MyComboBox and MyMenuItem. See earlier posting "How to change the font of
the main menu in application window?" started 9/28/2004 in this discussion
group.
MyMenuItem implements the DrawItem and MeasureItem events to provide the
desired appearance (using selected font and style). This type (MyMenuItem) is
being used successfully for the application's main menu and context menus
associated with MDI child forms and numeric entry controls.
MyComboBox is intended to display a context menu when the user presses
Shift-F10 or right-mouse-clicks on the control. When the standard MenuItem
class is used, the context menu displays as expected, which uses the system
display properties for the menu item font. When the derived MyMenuItem class
is used, the context menu appears as a small white box with no apparent
content.
I have added Debug.WriteLine statements to the MyMenuItem DrawItem and
MeasureItem event handlers. These debug statements print out as expected
when the context menus are displayed for the child forms and the numeric entry
controls (a derived TextBox class). However, these debug statements are never
executed when the context menu for the MyComboBox is displayed.
Why would the derived control MyComboBox display a context menu just fine
when the type MenuItem is used and not when the type MyMenuItem is used?
(Keep in mind, MyMenuItem works just fine in context menus for other
controls!)
Thanks,
Dave
the MDI style interface. I have subclassed both the ComboBox and MenuItem
classes to provide the needed funtionality, creating the derived classes
MyComboBox and MyMenuItem. See earlier posting "How to change the font of
the main menu in application window?" started 9/28/2004 in this discussion
group.
MyMenuItem implements the DrawItem and MeasureItem events to provide the
desired appearance (using selected font and style). This type (MyMenuItem) is
being used successfully for the application's main menu and context menus
associated with MDI child forms and numeric entry controls.
MyComboBox is intended to display a context menu when the user presses
Shift-F10 or right-mouse-clicks on the control. When the standard MenuItem
class is used, the context menu displays as expected, which uses the system
display properties for the menu item font. When the derived MyMenuItem class
is used, the context menu appears as a small white box with no apparent
content.
I have added Debug.WriteLine statements to the MyMenuItem DrawItem and
MeasureItem event handlers. These debug statements print out as expected
when the context menus are displayed for the child forms and the numeric entry
controls (a derived TextBox class). However, these debug statements are never
executed when the context menu for the MyComboBox is displayed.
Why would the derived control MyComboBox display a context menu just fine
when the type MenuItem is used and not when the type MyMenuItem is used?
(Keep in mind, MyMenuItem works just fine in context menus for other
controls!)
Thanks,
Dave