contextmenustrip

How do I add a ContextMenuStrip to a ToolStripButton?

I have a toolstrip containing, among other things, a ToolStripComboBox and a ToolStripButton. I want to add a ContextMenuStrip to both of them, but I don't have direct access to the toolstrip or its other contents, so I can't set the context menu of the toolstrip. Setting the ContextMenuStrip for the ToolStripComboBox is easy: myToolS...

Finding the selected item of list view

Hey, I currently have a list view which has several rows of data and I have a contextmenustrip in C# .NET. What I am having problems with is when you click on the menu strip item I want to know which row has been selected. Any help gratly appreciated. ...

How to create ContextMenuStrip in C# which items are images?

I want to create context menu in C# which items are images of different heights and widths. Main problem I don't know how to solve is how to set width and height for menu items and context menu. If autosize for menu items is enabled, then heights of all menu items are the same. If I disable autosize for menu items, then I cannot proper...

ContextMenuStrip Behavior Problem

I am adding a label to a form dynamically, then dynamically adding a ContextMenuStrip control. Whether I use the label.ContextMenuStrip property to connect them, or add the event handler to the label manually to have it respond to the right-click and show the context menu, I get odd behavior: 1) The menu does not appear next to the mous...

ContextMenuStrip on User control containing Richtextbox C#

I have made a custom control which consists of a richtextbox and a picture box. Now i want to include a contextmenustrip on the richtextbox actually. But the code which i want to call on click of the different menus on the menustrip belongs to the Main project in which i'l be adding this control. So i thought of adding the contextmenustr...

Remove .net ContextMenuStrip Padding

Hi, When creating a ContextMenuStrip, there is a huge amount of padding around the contained controls. For example: Me.myMenu = New ContextMenuStrip 'unset all obvious padding settings' Me.myMenu.ShowCheckMargin = False Me.myMenu.ShowImageMargin = False Me.myMenu.Margin = New System.Windows.Forms.Padding(0) Me.m...

ContextmenuStrip Width

Hi everyone, 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. ...

Do not close ContextMenuStrip on selection of certain items

Is it possible to leave a ContextMenuStrip open after a selection/check of certain items? I plan on using a simple ContextMenuStrip to set a filter (this way i could use the same filter either in a menu or as a right-click option). The menu lists a number of items, and i would like the user to be able to make a selection of the items u...

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 the next character. I could double up all the ampersands before I set the items' Text me...

Show/Hide ContextMenuStrip outside the form

I'm creating a simple clipboard manager application. It monitors the content of a clipboard. When a change occurs (throu the win api message loop) it fires up a method to capture current content of clipboard and creates new object called clipboarditem. Next its building a ContextMeuStrip which consits of several clipboarditems created pr...

Show ContextMenuStrip at location of StatusBar item

I want to show a ContextMenuStrip at the location of a ToolStripStatusLabel in a StatusStrip. Ordinary controls have PointToScreen / PointToClient / etc, but as ToolStripStatusLabel is derived from Component it does not. Any help would be appreciated. ...

ContextMenuStrip Custom Layout

I'm trying to have a Windows Forms ContextMenuStrip control display a list of countries, about 200 total. Currently it displays them all vertically which creates for a long wait time to scroll to countries near the bottom of the list. I've tried messing with the ContextMenuStrip.LayoutStyle property but it hasn't gotten me anywhere. M...

ContextMenuStrip

Hi, I am adding a right click functionality on individual nodes of a treeView in my C# code. The options like "Add", "Delete", "Rename" should pop up when the user right clicks in those nodes on the tree. Now depending on the node that is being clicked, I am filling up the menu as using the following statememnts: contextMenuStrip1.Ite...

How do i access the originating control for a ContextMenuStrip in C#?

I have attached a ContextMenuStrip to a TabControl and set up a handler for OnMouseDown that does the following: if (e.Button != MouseButtons.Right) { return; } for (var i = 0; i < tabControl1.TabCount; ++i) { var point = new Point(e.X, e.Y); if (tabControl1.GetTabRect(i).Contains(point)) { tabPageContextMenu.S...

winforms - contextMenuStrip - close on clicking away.

Hi All, I have a DGV with a ContextMenuStrip. The ContextMenuStrip's default behaviour is to auto-close - i.e. to close immediately on the user interacting with it. I've turned this off to allow multiple user interactions (which is what I want), however beyond that what I really need is for the context menu to subsequently close on the...

how to show contextmenustrip when a button is clicked in the right position

i want to click on a button and have it show a contextmenustrip right below the button. it keeps showing up in the left hand side of the screen when i try pointtoacreen and top and left coordinates. any suggestions ...

Toolstripbutton text gets cut off in contextmenustrip

i am instantiating my own ToolStripButton and adding it to a contextmenustrip it pops up but the text gets cut off: string[] layouts = new string[]{"Test 1", "test 2", "test 3"} List<ToolStripButton> items = new List<ToolStripButton>(); foreach (string layout in layouts) { ToolStripBu...

How to show accelerators when context menu triggered from code

As I understand it, when the Windows "Hide underlined letters for keyboard navigation until I press the Alt key" checkbox is checked, when a context menu is shown via a right-click, the underlines should be hidden, but when it is shown via the Apps key or by Shift+F10, they should be shown. In C#, I have added a context menu to a third-p...

Can I set Properties directly in the Context Menu? C#

Following idea: I have a Game Level editor, which should be as simple as possible (I don't want to program something too complex). But that does not mean that the tool should be uncomfortable. So my idea was not to use different types of menus to set some properties, but a form of context menu. Now I wonder if it would be possible to in...

Datagridview, contextmenu of rowtemplate doesn't show submenu's

In a windows form using vb.net 2008 a context menu when mapped to the datagrid shows submenu's properly but when mapped to a row template of the same datagrid view does not submenu or dropdown items in that menu Any help on this please ...