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

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

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

任何想法的人如何实现这一目标?
在 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)
| 归档时间: |
|
| 查看次数: |
1536 次 |
| 最近记录: |