English 中文(简体)
我能否在NETWindows表格中形成一种多科背景。
原标题:Can I create a multiple-column context menu in .NET Windows Forms?

我想创造一种背景菜单,有几栏。 基本如此:

First item  | [common option] | All Options >
Second item | [common option] | All Options >
Third item  | [common option] | All Options >
Fourth item | [common option] | All Options >

因此,基本上有一组物品(在运行时产生),每个项目可以自行发射;或者有通用的选择;或者你可以找到一个包含所有可能选择的子门。

How can I do this? I m trying to abuse both ContextMenuStrip and ContextMenu, yet they don t seem to have any such options. Still I seem to recall having seen multi-column menus somewhere...

我更喜欢采用Windows表格解决方案,因为我没有WPF的经验。 Oh,以及这一背景,在点击通知区(aka systray)的icon时,将开放。

最佳回答

我不知道<代码>ContextMenuStrip,这是一个完全建于......的菜单。 NET代码,但你可以肯定地用ContextMenu来做,该编码比原制度菜单更精彩。

关键是制定<代码>。

前者将菜单放在新的一栏中,而后者则将该项目置于新的一栏,并将该栏与附后的垂直线分开。

从MSDN的例子来看:

public void CreateMyMenus()
{
    // Create three top-level menu items.
    MenuItem menuItem1 = new MenuItem("&File");
    MenuItem menuItem2 = new MenuItem("&New");
    MenuItem menuItem3 = new MenuItem("&Open");

    // Set the BarBreak property to display horizontally.
    menuItem2.BarBreak = true;
    menuItem3.BarBreak = true;

    // Add menuItem2 and menuItem3 to the menuItem1 s list of menu items.
    menuItem1.MenuItems.Add(menuItem2);
    menuItem1.MenuItems.Add(menuItem3);
}
问题回答

温森林中的男子只能像树木一样建造:在每一个项目下,你可以有一个子。 因此,你可以把共同选择作为下游的第一个项目。

除非你自己掌握控制权,否则不可能看一看任何不同(而当时,世界森林论坛更适合这项任务,但世界森林论坛需要大量时间学习)。





相关问题
Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

How to start WinForm app minimized to tray?

I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签