anaconda
anaconda

Reputation: 1102

ContextMenuStrip and mouse wheel

I have a ContextMenuStrip with many items.

How to handle mouse wheel to scroll throught items?

I search the net but nothing find usefull.

Or how to get first/last displayed/visible item from contextmenu?

Upvotes: 3

Views: 2556

Answers (3)

Ryan Naccarato
Ryan Naccarato

Reputation: 1201

Although this question is very old, someone may still benefit from my input...

var menu = new ContextMenuStrip();
menu.MouseWheel += (ob, ev) => SendKeys.SendWait(ev.Delta > 0 ? "{UP}" : "{DOWN}");

Upvotes: 5

Dutchs
Dutchs

Reputation: 652

Since this is a old question you probably wont need this, but just in-case and for future reference. You can simulate key up and down presses to scroll through it, its far from perfect but it beats having to write your own ContextMenuStrip to handle the scroll wheel. Mouse wheel scrolling Toolstrip menu items

Upvotes: 5

Hans Passant
Hans Passant

Reputation: 942089

Adding so many items to a CMS that it requires to be scrolled completely defeats the purpose of a context menu. Don't design a UI that's hard to use and requires the user to scan through dozens of items. Your users will dislike you program with a passion and will find out where you live.

A CMS supports sub-menus. Categorize your menu items.

Upvotes: -2

Related Questions