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
1
vote
0 answers

How can I get this ContextMenu control for WinForm?

I want to implement ContextMenu like this in Visual Studio's dialog form (source: devpia.com)
Juhyun Lee
  • 11
  • 2
1
vote
1 answer

Designer and inherited ContextMenuStrip

I have a problem, what designer doesn't add inherited ContextMenuStrip to the components. Here is how to reproduce the problem: Create new project (windows forms application). Add to the form ContextMenuStrip via designer, it will generate…
Sinatr
  • 20,892
  • 15
  • 90
  • 319
1
vote
2 answers

How to know which link from one and the same linklabel was right clicked in the context menu?

I have a LinkLabel to which a context menu strip is attached. This context menu has 2 options: 'Copy hyperlink' or 'Open hyperlink'. There is no problem when there is only one link in the link label. But I can't figure out how you can (if you can)…
Toon Casteele
  • 2,479
  • 15
  • 25
1
vote
1 answer

DataGridView select Row

I want to select a row in my DataGridView with a right click. But with my current code I first have to click on the row with a regular left mouse click. Is there any way to select the current row with a right click and than open a…
user2195966
  • 13
  • 1
  • 1
  • 3
1
vote
2 answers

make the contextmenustrip item enabled in listview only if the selected row in listview has elements C#

Say i ve a listview with items apple banana beans ive attached contextmenustrip to the listview, say the contextmenustrip item is add i want add to be enabled only when i click on the items in the listview not anywhere on the empty list.
1
vote
1 answer

Show and focus to menu

I have a button on a form, I want to use Alt+M, to show a ContextMenuStrip(cmsJournal), unfortunately when I use that shortcut, the button got focused, but no KeyPress event has been fired. I want to use the following method when I press Alt+M …
user1104916
  • 103
  • 1
  • 11
1
vote
1 answer

C# datagridview right click select edit option and data should be displayed in textbox

Here is my code for DataGrid in C#. On a right click on a cell, the ContextMenu for edit option should be displayed. But, I am not able to execute the right click action. And also after clicking on edit menu, I should able to show data in textbox.…
1
vote
2 answers

How does ContextMenuStrip Shortcut Keys of ToolStripMenuItem works

I have a TreeView with ContextMenuStrip (opening by right-click) ToolStripMenuItems with shortcuts like "Ctrl+C, Ctrl+V, etc." The problem is that Action of ToolStripMenuItem.Click fires by shortcut only if ContextMenuStrip is opened. I think that…
ForeverSmiling
  • 111
  • 3
  • 10
1
vote
2 answers

ContextMenuStrip not closing once clicked

I am creating a Context Menu Strip once a Rich Text Box is right clicked. There are 2 options, one to change the font and one to change the background color. However, once I click one of the menu options, the Context Menu Strip doesn't close and…
Nick Sinas
  • 2,594
  • 11
  • 42
  • 51
1
vote
2 answers

ToolStripMenuItem_Click(object sender, EventArgs e) - casting back to a DataGridView

I have a WINFORM app with a DataGridView control , hooked into a ContextMenuStrip control. The ContextMenuStrip fires events to essentially perform copy / paste between the DataGridView and the Clipboard. private void…
Bill Roberts
  • 1,127
  • 18
  • 30
1
vote
3 answers

How to add ToolStripMenuItems dynamically

sqlstr = "select ModuleName,ModuleId,pagename from modules WHERE ParentID='" + parentID + "' AND VIsibility=1 ORDER BY ModuleId"; cmd.CommandText = sqlstr; cmd.Connection = cn; ; dr = cmd.ExecuteReader(); while (dr.Read()) { menu.Tag =…
siva
  • 67
  • 5
1
vote
3 answers

Deselect ToolStripItem on ContextMenuStrip

Simple question: I can .Select a ToolStripItem (like, if i want a preselected option when opening a context menu strip) but i cannot seem to find a way to set .Selected to false or somehow deselect it! Is it possible?
Istrebitel
  • 2,963
  • 6
  • 34
  • 49
1
vote
2 answers

Is there a way to force always show mnemonics in menus?

I am making use of ContextMenuStrip in my program and apparently, it wont show its shortcut keys (mnemonics, those that should be shown as underlines under letters preceded by &) unless i press Alt, but when i press Alt, the shown ContextMenuStrip…
Istrebitel
  • 2,963
  • 6
  • 34
  • 49
0
votes
2 answers

Programming Context Menu

I have a ContextMenuStrip That I create in code: ContextMenuStrip menu; public Loader() { menu = new ContextMenuStrip(); menu.Items.Add("Set Complete"); menu.Items.Add("Set Review"); menu.Items.Add("Set Missing"); } I need to add…
maffo
  • 1,393
  • 4
  • 18
  • 35
0
votes
1 answer

How to prevent menu (ContextMenuStrip) to steal focus from my TextBox control?

I am trying to replicate an intellisense like feature where you have a textbox and a menu that's shown below it. I know intellisense doesn't use ContextMenuStrip, but my version has to have categories which are sub-menu items. So as soon as the user…
Joan Venge
  • 315,713
  • 212
  • 479
  • 689