问题标签 [toolstripmenu]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
1445 浏览

python - 如何使用win32gui或类似工具,通过其按钮名称单击另一个窗口toolStrip1项按钮?

在 Python2.7 with 中,我可以通过 win32guiwin32轻松获取其他窗口的句柄。,但是我不知道如何通过它的项目名称来获得它的按钮项目控制,例如单击toolStrip1中的项目按钮“加载”。toolStrip1EnumChildWindows

我可以尝试使用win32gui.SendMessage(handle, click, "Load"......)或类似的方式来实现这一点吗?

我可以使用 rect x,y 的 toolStrip1 via win32gui.GetWindowRect,大致可以通过x+40x+80相应地点击按钮,但是特别是在新版本中项目位置发生变化时,它并不是很好。

这是示例中的代码,并修改了一些其他问题:

import win32con import commctrl, ctypes from ctypes import * import sys import time

类文本框:

rx=文本框()

rx.run()

0 投票
1 回答
214 浏览

c# - 无法将单击事件分配给使用扩展 eventargs 参数的事件处理程序

我正在尝试分配一个事件处理程序,该处理程序使用将 System.EventArgs 扩展到 ToolStripMenuItem 的事件参数。当我输入处理程序的名称时,它想创建一个使用 System.EventArgs 的事件处理程序。这是最近文件的列表。

这是代码

对此的任何帮助将不胜感激。

0 投票
4 回答
7418 浏览

c# - 更改 Winforms 菜单下拉列表的边框颜色

是否可以更改工具条菜单下拉列表的边框颜色。

在下面的示例中,我希望下拉菜单具有 1 种颜色(蓝色),而当前没有显示白色边框,但保持主菜单(“我的菜单”)项为白色。

有任何想法吗?

在此处输入图像描述

0 投票
2 回答
3261 浏览

c# - 您可以在自定义渲染器中更改 ToolStripMenuItem 的字体吗

我有一个带有自定义渲染器的菜单:

将鼠标移到菜单项上时,是否可以更改字体或使菜单项变为斜体?

我有更改背景的活动,但不知道字体/字体颜色?

0 投票
1 回答
1174 浏览

.net - VB .NET 验证许多 ToolstripMenuItems 的检查状态

当我单击另一个菜单项时,我想取消选中 MenuStrip 中主 ToolStripMenuItem(称为 MyMainMenu)的所有菜单项。主菜单包含一些菜单项和一个分隔符。我尝试了以下代码:

我从每个菜单项(分隔符除外)中调用该代码。当我单击菜单项时,程序崩溃说他无法从 ToolStripSeparator 转换为 ToolStripMenuItem。出于类似目的,可以在 Microsoft .NET 文档站点上找到相同的代码,但它没有指定在相同的菜单项包含不同类型的项(分隔符、文本框...)的情况下可以做什么。

你知道我该如何解决这个问题吗?

谢谢,

再见

0 投票
1 回答
879 浏览

vb.net - Avoid toolstripmenu closed on item selected

I have a system tray application on vb.net. This app has a menu with several options. There is an option to select the language app. This language option has three submenus: english, french and spanish.

Below is the snipet code of the three submenus:

In rutime, each time I select a language from the language option menu, app main menu is closed automatically after selection so I need to do a right-click on system tray app to access again to the app main menu. I would like to be able to select language without the language submenu/main app menu gets closed on every selection.

How can I do this?

SOLUTION - UPDATED: Below mngLanguage corresponds to a ToolStripMenuItem object which contains the options submnuEnglish, submnuSpanish and submnuFrench of type ToolStripMenuItem.

MainMenu is the app main menu of type ContextMenuStrip.

Below event is necessary to refresh UI on language item clicked. If it is not implemented then when an item is checked (language) the previous one is not unchecked after mouse is moved.

With above implentation it works like a charm!

Before implementing above solution I was trying to solve it using:

but doing so was cause UI behaves abnormally, weird behavior, for example, menus with submenus were not being dropdown automatically on mouse over. From my point of view it is not recommended to use it.

0 投票
1 回答
217 浏览

vb.net - HOWTO:在 VB.NET 中使用 ToolStripMenuItem.DropDownItemClicked

我有一个 toolStripMenuItem,它是一个包含其他下拉项的菜单。当通过选择下拉项目之一引发 DropDownItemClicked 事件时,如果满足某些条件,我想使用该事件,如下所示:

问题是 DropDownItemClicked 没有提供执行的可能性:

那么我怎么能消费这个事件呢?

0 投票
1 回答
1153 浏览

c# - 如何在c#中获取工具条按钮的选定索引

我在表单上有一个工具条控件,我使用以下代码以编程方式将按钮添加到工具条控件

现在,当我单击它时,我试图获取工具条按钮的索引,注意我可以使用获取单击的工具条按钮的文本

0 投票
1 回答
125 浏览

c# - C# 动态添加的 ToolStripMenuItems 在最小化时消失(C# Winforms)

给定用户访问权限,我的 Windows 窗体应用程序在运行时创建用户菜单。

它工作正常,但是当应用程序最小化时,所有菜单都会消失。空间已使用,但名称和图标不见了(显然没有显示子菜单,因为顶级菜单项不见了)

它使用类进行编码,ToolStripMenuItem并且之前设置了此代码:

有人见过这种行为吗?

问候

丹尼尔。

0 投票
2 回答
10842 浏览

c# - MenuItem 的颜色变化

我正在编写一个备份工具。在我的工具之上,我有一个包含两个工具条菜单项的菜单条。我根据我的期望稍微改变了颜色。不集中菜单看起来很棒:

未点击的菜单项

当我现在单击菜单项“文件”以打开上下文菜单时,颜色变为白色,我无法再阅读文本:

单击的菜单项

谁能告诉我在哪里可以改变这种行为?我使用 Visual Studio 2013 Ultimate,Windows 窗体应用程序,代码在 C# 中。

这是代码:

// // initializing menuStrip1 // this.menuStrip1.BackColor = System.Drawing.Color.MediumBlue; this.menuStrip1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.menuStrip1.Font = new System.Drawing.Font("Segoe UI Semilight", 15.75F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.helpToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.MinimumSize = new System.Drawing.Size(0, 40); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(1056, 40); this.menuStrip1.TabIndex = 77; this.menuStrip1.Text = "menuStrip1"; // // initializing fileToolStripMenuItem and adding to menuStrip1 // this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.saveToolStripMenuItem, this.saveAsToolStripMenuItem, this.loadToolStripMenuItem}); this.fileToolStripMenuItem.Font = new System.Drawing.Font("Calibri Light", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.fileToolStripMenuItem.ForeColor = System.Drawing.SystemColors.ControlLightLight; this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(54, 36); this.fileToolStripMenuItem.Text = "File"; this.fileToolStripMenuItem.Click += new System.EventHandler (this.fileToolStripMenuItem_Click); // // initializing saveToolStripMenuItem and adding to fileToolStripMenuItem // this.saveToolStripMenuItem.BackColor = System.Drawing.Color.MediumBlue; this.saveToolStripMenuItem.ForeColor = System.Drawing.SystemColors.ControlLightLight; this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; this.saveToolStripMenuItem.Size = new System.Drawing.Size(166, 30); this.saveToolStripMenuItem.Text = "Save"; this.saveToolStripMenuItem.Click += new System.EventHandler (this.saveToolStripMenuItem_Click);
//