Questions tagged [contextmenustrip]

ContextMenuStrip should appear when a user right-clicks, reacting to the surroundings. It represents a shortcut menu in C#.

ContextMenuStrip replaces ContextMenu. You can associate a ContextMenuStrip with any control, and a right mouse click automatically displays the shortcut menu. You can show a ContextMenuStrip programmatically by using the Show method. ContextMenuStrip supports cancelable Opening and Closing events to handle dynamic population and multiple-click scenarios. ContextMenuStrip supports images, menu-item check state, text, access keys, shortcuts, and cascading menus.

For more details: http://msdn.microsoft.com/en-us/library/system.windows.forms.contextmenustrip(v=vs.110).aspx

293 questions
4
votes
2 answers

Aligning the text in the center vertically of a contextmenustrip item with manually set height

I'm trying to align the text in the centre vertically in acontextmenustrip item with manually set height of 60. However no matter what I try the text is always at the top. Images in the same item will align themselves correctly with out me doing…
AidanO
  • 868
  • 1
  • 11
  • 33
4
votes
1 answer

How can one get a ContextMenuStrip to show on left click of a NotifyIcon?

I have a ContextMenuStrip assigned to a NotifyIcon and this works with the right click fine. How may I wire up the mouse-click event to tell the NotifyIcon to show its ContextMenuStrip? private void taskbarIcon_MouseClick(object sender,…
hydrogen
  • 2,878
  • 21
  • 20
4
votes
1 answer

How to show underscore (shortcut) without holding Alt?

I've created a form with ContextMenuStrip. I set its shortcut using Text field in following way: "&File". However, when I open this context menu by right mouse button click, underscore is shown only when I simultaneously hold Alt button. Is there a…
Sergey Dudkin
  • 169
  • 1
  • 10
4
votes
2 answers

Find height of ContextMenuStrip before showing it

I have a ContextMenuStrip (ctMenuMassEdit) that I want to display when left-clicking a button (btnMassEdit). I want the ContextMenuStrip to be displayed above the button, i.e. position (0,-ContextMenuStrip.Height) relative to the button: private…
Julian
  • 20,008
  • 17
  • 77
  • 108
4
votes
1 answer

Determining which tabpage has opened

I'm trying to get the tabpage that was clicked by right button of mouse,in another words the tabpage that opened the contextmenustrip. There's a toolstripmenuitem called Close which I used to close the tab that was clicked on. I used this code…
Karam Najjar
  • 527
  • 5
  • 21
4
votes
1 answer

How would one attach a ContextMenuStrip to a NotifyIcon

I'm trying to make a NotifyIcon display a context menu, even if it's clicked with the left mouse button. I can get it to display in the correct location with this in the icon's MouseDown event: sysTrayIcon.ContextMenuStrip = TrayContextMenu If…
Ants1060
  • 174
  • 8
4
votes
2 answers

How to identify dataGridView cell that was right clicked on for ContextMenuStrip?

User right clicks on a cell within a DGV, then makes a selection in the ContextMenuStrip. Based on their CMS selection, I want to do something (copy, hide, filter). My problem is identifying the cell that was right clicked on. I was trying to…
PHBeagle
  • 122
  • 1
  • 2
  • 11
4
votes
2 answers

How do I stop items in a ContextMenuStrip from treating ampersands specially?

I have a ContextMenuStrip which displays items which can be named by the user; the user is allowed to give the items names containing ampersands. When the ContextMenuStrip is shown, the items' treat the ampersands as escape sequences, and underline…
Simon
  • 25,468
  • 44
  • 152
  • 266
3
votes
2 answers

ContextmenuStrip Width

I need to change the contextmenustrip width dynamically, by default the contextmenustrip width depends on the text length of the ToolstripmenuItems. And BTW I really don't wanna redraw the control again!!! Thanks in advance.
Peymankh
  • 1,976
  • 25
  • 30
3
votes
1 answer

ToolStripMenuItem added to several places?

I have a large list of entities which the user needs to be able to select from. I have a ContextMenuStrip on my window, and has a few MenuItems for each category of entity. In a library example, think "Staff", "Borrowables", "Patrons",…
Ozzah
  • 10,631
  • 16
  • 77
  • 116
3
votes
4 answers

How do I set an image for ContextMenuStrip items?

How do I set an image for ContextMenuStrip items? I'm using C#.
salar_cpp_cs
  • 43
  • 2
  • 6
3
votes
1 answer

about ToolStripMenuItem

I'm having one ContextMenuStrip in that strip at runtime I'm adding one ToolStripMenuItem. And I added this ContextMenuStrip in the XtraGridView's MouseDown() event handler. And at the same time I've added the event handler for the newly inserted…
Priyanka
  • 2,802
  • 14
  • 55
  • 88
3
votes
1 answer

Activate ContextMenuStrip when the Form doesn't have focus

I am able to display ContextMenuScript (CMS) successfully outside windows form. I can Select/Click items using mouse pointer. However, it doesn't likes keyboard control (arrow up/down, escape) when form is not focused. If the form is focused and…
J D
  • 63
  • 1
  • 8
3
votes
1 answer

Get the SourceControl of a DropDownMenu

I have two click events of menu items in a ContextMenuStrip. I can get the SourceControl of the clicked context menu item by doing this code: Control c = ((sender as ToolStripItem).Owner as ContextMenuStrip).SourceControl; But when I use this…
3
votes
1 answer

Any way to get the width of a Context Menu before it is displayed?

I want to know the what the width of the context menu will be, just before being displayed, possibly in the myContextMenu.popup event handler or better yet, before myContextMenu.show(). The reason I want to know the width, is so that I can affect…
1
2
3
19 20