0

I have a ContextMenuStrip with a custom renderer class that paints the items according to the user's color choices. However, when the custom class is active, the items in the ContextMenuStrip must be clicked in order to bring up its DropDownItems - They will not automatically appear.

How can I make them appear on hover, like the default functionality? The items in the menu are dynamically generated and aren't always the same.

xpdite
  • 1
  • 1
  • Show your code first please. – Edper May 19 '13 at 12:58
  • This is my custom renderer class: http://pastebin.com/9gdDGGMH – xpdite May 19 '13 at 13:13
  • 1
    You are mixing up apples and oranges. A custom renderer only renders, it doesn't affect mouse behavior. A drop down button just doesn't show its drop down on a hover, a click is required. – Hans Passant May 19 '13 at 13:24
  • @HansPassant Then why do the ToolStripMenuItems display their DropDownItems when you hover over them with the default renderer, and not with a custom one? This is the default behavior for all menus in Windows, just try it in your browser's menu bar, or any menu bar for that matter. If you hover over a menu item that has drop down items, they will be displayed. The problem here is that when I set it to my custom renderer class, this behavior disappears. – xpdite May 19 '13 at 15:23
  • Adapting your code to test it was freakin' painful, you owe me 15 minutes of my life. The behavior appears to be affected by the Font property assignment in OnRenderTextItem. Comment it out and it works again. This is almost surely intentional. – Hans Passant May 19 '13 at 15:57
  • @HansPassant Thank you. However, if I don't set the e.Item.Font property, the width of the items will be set to the width of the text that's in the e.Item.Font property (i.e. the default font). Any way I can override that behavior as well? Example when e.TextFont is used instead of e.Item.Font: http://puu.sh/2WLlI.png – xpdite May 19 '13 at 18:03

0 Answers0