Why won't MyComboBox display MyMenuItem?

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
 
M

Mick Doherty

It seems that ComboBox has the same bug as NotifyIcon.
This same bug shows with a standard ComboBox and standard Owner Draw
MenuItem, so it's nothing you've done (or ommitted to do).

The NotifyIcon bug can be overcome by using the Hans Blomme NotifyIconXP
control available from:
http://windowsforms.net/Default.aspx?tabindex=3&tabid=49

but I am not aware of a workaround for ComboBox.
 
J

Jeffrey Tan[MSFT]

Hi Dave,

Based on my understanding, you wanted to associate a owner-draw contextmenu
for combobox, but it does not draw but just display a black menu.

Yes, I wrote a sample and reproduce out this issue. Then I found that this
is a known issue in our product database, and it is already fixed in next
version of VS.net.

Hope my confirmation makes sense to you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Jeffrey,

What new version of VS.NET will fix this and when does it become available?

Thanks,
Dave
 
J

Jeffrey Tan[MSFT]

Hi Dave,

Thanks very much for your feedback!

This issue will be fixed in next version of VS.net, that is Visual
Studio.net 2005, code name Whidbey. Now, the standard version of Whidbey
has not released, but the beta1 version can be free to download now. I have
tried this issue on beta1 version, and it seems that it has been fixed in
Whidbey beta1 version.

For the release time of Whidbey, it is still not determined yet, but Visual
Studio 2005 Standard Edition is announced at 9/13/2004. I think we may pay
more attention to Whidbey's home: http://lab.msdn.microsoft.com/vs2005/, it
will report the lastest progress for Whidbey.

Hope this makes sense to you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
M

Mick Doherty

There's a similar issue in Beta1, which has apparently been fixed and will
not show up in the next release. The OwnerDraw ContextMenu on a ComboBox has
indeed been fixed, but the ContextMenuStrip has superceded the ContextMenu,
and is in fact the only choice available via the IDE's property editor. The
ContextMenuStrip does not show on the Edit portion of the ComboBox.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


"Jeffrey Tan[MSFT]" said:
Hi Dave,

Thanks very much for your feedback!

This issue will be fixed in next version of VS.net, that is Visual
Studio.net 2005, code name Whidbey. Now, the standard version of Whidbey
has not released, but the beta1 version can be free to download now. I
have
tried this issue on beta1 version, and it seems that it has been fixed in
Whidbey beta1 version.

For the release time of Whidbey, it is still not determined yet, but
Visual
Studio 2005 Standard Edition is announced at 9/13/2004. I think we may pay
more attention to Whidbey's home: http://lab.msdn.microsoft.com/vs2005/,
it
will report the lastest progress for Whidbey.

Hope this makes sense to you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

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