问题标签 [contextmenustrip]

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 投票
1 回答
923 浏览

c# - 在 ActiveX 控件的正确位置显示 ContextMenuStrip

我有一个我在 C# 中使用的 ActiveX 控件(VB 6.0),它的右键单击“e”参数有 int ex 和 int ey 现在我想显示这个 contorl 的 contextmenustrip。它显示但不是在我右键单击鼠标的确切位置,它比我右键单击的位置高一些。

我写了这样的东西来解决位置问题,但没有解决。

想法?我应该写什么来发送正确的位置给它?

0 投票
1 回答
607 浏览

contextmenustrip - 显示 ContextMenuStrip 后清除项目

我想在显示 ContextMenuStrip 之后清除这些项目。但是,当我进行以下调用时,ContextMenuStrip 一开始就没有正确显示。有任何想法吗?

谢谢,

0 投票
4 回答
9971 浏览

c# - 右键单击时的ContextMenuStrip,如果在Listview中选择了项目?

我有一个附加到列表视图的 ContextMenuStrip,它工作得很好,但我有兴趣知道的是,只有在列表视图中选择了一个或多个项目时,我才能让它显示出来。

谢谢!

0 投票
1 回答
5353 浏览

c# - 如何在左键单击 NotifyIcon 时显示 ContextMenuStrip?

我有一个分配给 NotifyIcon 的 ContextMenuStrip,这适用于右键单击。

如何连接鼠标单击事件以告诉 NotifyIcon 显示其 ContextMenuStrip?

0 投票
1 回答
784 浏览

winforms - 如果右键单击,则 ContextMenuStrip 会从树视图中的项目失去焦点

我有一个与树视图关联的 contextmenuStrip。

现在,例如,我在树结构中有四个节点,并且选择了节点 4。

行为: ContextMenuStrip - 当您右键单击节点 2 时,该节点被选中,一旦上下文菜单条打开,焦点就会返回节点 4。

使用旧组件“上下文菜单”,此功能可以正常工作,即节点 2 具有焦点,直到上下文菜单打开。

只要上下文菜单打开,我就希望选择节点 2。当上下文菜单关闭时,选择/焦点将返回节点 4。

求请指教。

感谢和最好的问候

0 投票
2 回答
1088 浏览

c# - ContextMenuStrip 在左上角呈现 Windows

当我渲染 contextmenustrip 时,它会在我的 PC 屏幕的左上角渲染。我有一个列表视图,其中包含 5-6 个项目,在每个项目上单击鼠标右键,都会显示上下文菜单条。我还需要更改上下文菜单条的颜色,包括背景和文本。

提前致谢!

0 投票
2 回答
1517 浏览

c# - 如何在 WinForms 中创建类似窗口的面板

请看这个:

http://img405.imageshack.us/img405/2008/rolloversummaryschedule.jpg

如何创建一个包含患者数据的窗口?您看到的 2 条记录位于列表视图中。然后我会使用 ContextMenuStrip 文本“查看详细信息”。单击查看详细信息时,我需要显示上下文。对于 Web 开发,这可以通过 Javascript、div 和面板来完成。那应该是WinForms吗?

请帮忙。

谢谢!

0 投票
1 回答
652 浏览

c# - 将上下文菜单条动态附加到复选框列表中

我正在尝试将构建的上下文菜单条附加到我插入到我的 CheckBoxList 的对象中我想要做的是将 contextMenuStrip 附加到在我的 checkboxList 中创建的新复选框中,所以当我按下右键单击鼠标将出现菜单,例如:

现在在我的列表中,我有一个包含我的对象的新复选框,如何将 contextMenuStrip 附加到它?

在此先感谢您的帮助。

0 投票
1 回答
827 浏览

.net - 尝试显示通知图标的菜单条时,不断收到“跨线程操作无效”

这不是常规的“Corss-Thread opeartion”BS,所以请不要发布明显的解决方案。

这是让我疯狂好几天的事情。

我有一个NotifyIcon, 有一个绑定的ContextMenuStrip. 一切正常,但有时(我不记得重现这个的确切步骤)我得到了跨线程异常。我对ContextMenuStrip/NotifyIcon的所有访问都用 Invoke cr*p 填充,但仍然 - 当用户右键单击通知图标时 - 引发异常。

这是异常的完整数据:

Message:跨线程操作无效:控件''从创建它的线程以外的线程访问。

Call stack

在 System.Windows.Forms.Control.get_Handle()

在 System.Windows.Forms.Control.SetBoundsCore(Int32 x,Int32 y,Int32 宽度,Int32 高度,BoundsSpecified 指定)

在 System.Windows.Forms.ToolStrip.SetBoundsCore(Int32 x,Int32 y,Int32 宽度,Int32 高度,BoundsSpecified 指定)

在 System.Windows.Forms.ToolStripDropDown.SetBoundsCore(Int32 x,Int32 y,Int32 宽度,Int32 高度,BoundsSpecified 指定)

在 System.Windows.Forms.Control.SetBounds(Int32 x,Int32 y,Int32 宽度,Int32 高度,BoundsSpecified 指定)

在 System.Windows.Forms.Control.set_Location(点值)

在 System.Windows.Forms.ToolStripDropDown.Show(Int32 x,Int32 y)

在 System.Windows.Forms.ContextMenuStrip.ShowInTaskbar(Int32 x,Int32 y)

在 System.Windows.Forms.NotifyIcon.ShowContextMenu()

在 System.Windows.Forms.NotifyIcon.WndProc(消息和消息)

在 System.Windows.Forms.NotifyIcon.NotifyIconNativeWindow.WndProc(消息和 m)

在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)

在 System.Windows.Forms.UnsafeNativeMethods.PeekMessage(MSG 和 msg,HandleRef hwnd,Int32 msgMin,Int32 msgMax,Int32 删除)

在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID,Int32 原因,Int32 pvLoopData)

在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 原因,ApplicationContext 上下文)

在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 原因,ApplicationContext 上下文)

在 System.Windows.Forms.Application.Run(窗体 mainForm)

在 D:\SDMS14SP2\StarLIMS.Grabber\StarLIMS.Grabber.Manager\Program.cs:line 34 中的 StarLIMS.Grabber.Manager.Program.Main(String[] args)

在 System.AppDomain._nExecuteAssembly(程序集程序集,字符串 [] 参数)

在 System.AppDomain.ExecuteAssembly(字符串 assemblyFile,证据 assemblySecurity,String [] args)

在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

在 System.Threading.ThreadHelper.ThreadStart_Context(对象状态)

在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 在 System.Threading.ThreadHelper.ThreadStart()

0 投票
1 回答
1442 浏览

c# - ContextMenuStrip 文本对齐 C#


,有人知道我们如何将 ContextMenuStrip(在 WinForms 中)中的文本对齐到中心吗?谢谢!