toolstripmenu

Customize ToolStripMenuItems in c#

北城余情 提交于 2019-12-11 08:15:34
问题 I need to customize the ToolStripMenuItems in my application. Each ToolStripMenuItem that open a submenu has a black arrow near the text. I want to change some colors (MenuItemSelected, MenuItemBorder, MenuItemSelectedGradientBegin, ...) and the color of this arrow too. I've created a class MyColor to solve the first problem public class MyColorTable : ProfessionalColorTable { public override Color MenuItemSelected { get { return Color.Silver; } } public override Color MenuItemBorder { get {

Cannot catch Ctrl+Alt+F1 in WinForms MDI. Is it special?

流过昼夜 提交于 2019-12-10 21:48:59
问题 My WinForms MDI application has several keyboard shortcuts set at ToolStripMeniItem items. Among the following ones: Ctrl + Alt + F1 Ctrl + Alt + F2 Ctrl + Alt + F3 the first one is never triggering its menu item. Others work as expected. Is it somewhere blocked/used? Is there some list of such blocked keyboard shortcuts? Is there a way how to use it? (Preferably just via designer without adding special code?) 回答1: If I press Ctrl+Alt+F1 on my machine then it activates the "Intel HD Graphics

ToolStripMenuItem added to several places?

时间秒杀一切 提交于 2019-12-10 21:33:56
问题 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", etc... "Staff" may contain "By Employment Type" -> { "Full Time", "Part Time" } or "By Gender" -> { "Male", "Female" } etc. "Borrowables" may contain "By Type" -> { "Books", "Magazines", "DVDs" } or "By Genre" -> { "Fiction" -> { "Sci-Fi", "Romance", "Crime" },

How can I prevent a disabled ToolStripMenuItem from showing a border on mouse over?

眉间皱痕 提交于 2019-12-10 13:39:39
问题 Yes, exactly same as the title, in my project some of toolstripmenuitems were disabled. But when i bring the cursor over the menu item, a blue border is appearing like this: But i don't want this. I want it like this: Could you help me, how do i prevent this blue border? 回答1: You should create a custom ToolStripRenderer , take a look at this - How to: Set the ToolStrip Renderer for an Application You have to create a custom renderer like this: class CutomToolStripMenuRenderer :

Color change for MenuItem

偶尔善良 提交于 2019-12-10 10:34:04
问题 I am programming a Backup Tool. On top of my tool I have a menustrip containing two toolstripmenuitems. I changed the colors a little bit to my expectations. Not focused the menu looks great: When I now click on the menu item "File" to open the context menu, the color changes to white and I am not able to read the text anymore: Can anyone please tell me where I can change that behavior? I use Visual Studio 2013 Ultimate, Windows Forms Application, Code is in C#. Here is the code: // //

Adding Items to ToolStrip at RunTime

不想你离开。 提交于 2019-12-07 04:46:39
问题 Hello I have a ToolStripMenu with a "Favorites" menu that I want to add sub items to during my WinForms app at run time. I have a datagridview that I right click on to show a context menu that has an "Add to Favorites" option. When that event is fired, I'd like to add an item using maybe some text from the selected row from the datagriview (this I know how to do already) to this Favorites menu. The tricky part to is I need to create code for my newlyCreatedToolStripMenuItem_Click event. I

Adding Items to ToolStrip at RunTime

吃可爱长大的小学妹 提交于 2019-12-05 08:20:30
Hello I have a ToolStripMenu with a "Favorites" menu that I want to add sub items to during my WinForms app at run time. I have a datagridview that I right click on to show a context menu that has an "Add to Favorites" option. When that event is fired, I'd like to add an item using maybe some text from the selected row from the datagriview (this I know how to do already) to this Favorites menu. The tricky part to is I need to create code for my newlyCreatedToolStripMenuItem_Click event. I will determine how to save my favorites list later. So we're going for: Right click datagridview row for

DropDownMenuItem check should uncheck other DropDownMenuItems

一曲冷凌霜 提交于 2019-12-04 19:58:01
I'm creating a ToolStripMenuItem's DropDownItems at runtime. Me.mnuExtrasSecondaryLCID.DropDownItems.Clear() Dim iCount As Integer = -1 For Each nLang As clsLanguage In g_LCIDs If nLang.IsLeader Then iCount += 1 Dim n As New ToolStripMenuItem n.Name = "mnuSecondaryLCID" & iCount.ToString() n.Text = nLang.Title n.Tag = nLang.LCID n.Available = True n.CheckOnClick = True Me.mnuExtrasSecondaryLCID.DropDownItems.Add(n) AddHandler n.Click, AddressOf Me.SecondaryLCIDClick End If Next This works fine. When I then check one of the DropDownItems at runtime, any other DropDownItems in the same "list"

Mouse wheel scrolling Toolstrip menu items

瘦欲@ 提交于 2019-12-04 01:46:46
问题 I have some menus that contain many menuitems. Mouse wheel doesn't scroll them. I have to use the keyboard arrows or click the arrows at top and bottom. Is it possible to use the mouse wheel to scroll toolstrip menu items? Thanks 回答1: A working solution: Register for MouseWheel event of your form and DropDownClosed event of your root MenuStripItem (here, rootItem) in the Load event of the form this.MouseWheel += Form3_MouseWheel; rootItem.DropDownOpened += rootItem_DropDownOpened; rootItem

C# shortcut key underscore not displayed in built application

隐身守侯 提交于 2019-11-29 08:02:29
I have a small problem with .Net 4.0 ToolStripMenuItem caption. I want it to underscore the Shortcut (access) key letter in the item text. I used the ampersand sign in the item text field: '&New map', and it looks fine in the editor: But, when I build the application, the underscores disappear: Does anyone know why does it happen and how to make the underscored display in the built form? BartoszKP As mentioned in other answers, this the default behaviour. Accelerators are being shown only after the ALT key is pressed. However it seems possible to force Windows to display accelerator keys