Custom Context Menu Strip

  • Thread starter msnews.microsoft.com
  • Start date
M

msnews.microsoft.com

I created a custom context menu strip with the hopes that I could override
the Show method. So I wrote a Show for each of the 5 that ContextMenuStrip
stupports ... put a breakpoint in them, and added the control to the form.

But alas, none of my breakpoints are being hit!

How is the dang thing being shown?
 
T

Tom Dacon

I'm not clear on what you mean by a context menu strip - perhaps that's
something new in the 2.0 platform, and I haven't seen that yet - but the
usual method for doing custom painting on menu items, either main menu or
context menu items, is to set the menu item's OwnerDraw property to True,
and then provide event handlers for the MeasureItem and DrawItem methods. In
the MeasureItem event handler you tell the runtime how much space you're
going to need for the menu item, and in the DrawItem event handler you paint
your visual representation of the menu item on the Graphics object that's
supplied to the event handler. You need to do this for each menu item you're
going to display.

HTH,
Tom Dacon
Dacon Software Consulting
 

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