如何在系统托盘上下文菜单中使用Windows look'n'feel?

GON*_*ale 5 .net c# winforms

我有一个工作NotifyIconContextMenuStrip,我不想用默认的菜单的外观和使用感觉被运出与此控制这是不同的Windows(Vista的在我的情况)箱子contextMenu.RenderMode = ToolStripRenderMode.ManagerRenderModecontextMenu.RenderMode = ToolStripRenderMode.Professional:

替代文字

我不希望这个使用contextMenu.RenderMode = ToolStripRenderMode.System:

替代文字

我只是想使用标准的,正常的Windows"外观和感觉",如无数,可能是非网络应用程序*grumble*:

替代文字 替代文字

任何想法的人如何实现这一目标?

tyl*_*erl 4

在 Vista 上,当使用所有默认值时,它可以正确呈现(即,与 DropBox 在我的计算机上呈现的方式相同)。

这是一个适合我的示例程序。尝试一下,如果它无法正确呈现,请尝试取消注释两行注释。

using System;
using System.Windows.Forms;
using System.Drawing;

public class AC : ApplicationContext
{
    NotifyIcon ni;
    public void menu_Quit(Object sender, EventArgs args)
    {
        ni.Dispose();
        ExitThread();
    }
    public AC()
    {
        ni = new NotifyIcon();
        ni.Icon = SystemIcons.Information;
        ContextMenu menu = new ContextMenu();
        menu.MenuItems.Add("Quit", new EventHandler(menu_Quit));
        ni.ContextMenu = menu;
        ni.Visible = true;
    }
    public static void Main(string[] args)
    {
        //Application.EnableVisualStyles();
        //Application.SetCompatibleTextRenderingDefault(false);
        AC ac = new AC();
        Application.Run(ac);        
    }
}
Run Code Online (Sandbox Code Playgroud)