// Main public class MyColorTable : ProfessionalColorTable { public override Color MenuItemBorder { get { return Color.FromArgb(0); } } public override Color MenuItemSelected { get { return Color.FromArgb(0, 82, 164); } } public override Color ToolStripDropDownBackground { get { return Color.FromArgb(22, 22, 22); } } public override Color ImageMarginGradientBegin { get { return Color.FromArgb(22, 22, 22); } } public override Color ImageMarginGradientMiddle { get { return Color.FromArgb(22, 22, 22); } } public override Color ImageMarginGradientEnd { get { return Color.FromArgb(22, 22, 22); } } } public class MyRenderer : ToolStripProfessionalRenderer { public MyRenderer() : base(new MyColorTable()) { } protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e) { e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; var r = new Rectangle(e.ArrowRectangle.Location, e.ArrowRectangle.Size); r.Inflate(-2, -6); Pen pen = new Pen(Color.FromArgb(255, 230, 230, 230)); e.Graphics.DrawLines(pen, new Point[]{ new Point(r.Left, r.Top), new Point(r.Right, r.Top + r.Height /2), new Point(r.Left, r.Top+ r.Height)}); } protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) { e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; var r = new Rectangle(e.ImageRectangle.Location, e.ImageRectangle.Size); r.Inflate(-4, -6); Pen pen = new Pen(Color.FromArgb(255, 230, 230, 230)); e.Graphics.DrawLines(pen, new Point[]{ new Point(r.Left, r.Bottom - r.Height /2), new Point(r.Left + r.Width /3, r.Bottom), new Point(r.Right, r.Top)}); } } // Make sure to subscribe to this event private void Form_Load(object sender, EventArgs e) { this._shortcutsMenuItem.ForeColor = Color.FromArgb(230, 230, 230); this.contextMenuStrip1.ForeColor = Color.FromArgb(230, 230, 230); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.RenderMode = ToolStripRenderMode.ManagerRenderMode; this.contextMenuStrip1.ShowCheckMargin = false; this.contextMenuStrip1.ShowImageMargin = true; this.contextMenuStrip1.Size = new Size(242, 204); this.contextMenuStrip1.Renderer = new MyRenderer(); if (ShortcutsFolder != null) { foreach (var _shortcut in ShortcutsFolder) { _shortcutItem = new ToolStripMenuItem(); _shortcutItem.ForeColor = Color.White; _shortcutItem.Name = Path.GetFileNameWithoutExtension(_shortcut); _shortcutItem.Text = Path.GetFileNameWithoutExtension(_shortcut); try { if (File.Exists(_shortcut)) { IWshRuntimeLibrary.WshShell shell = new IWshRuntimeLibrary.WshShell(); IWshRuntimeLibrary.IWshShortcut link = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(_shortcut); _shortcutItem.Image = Icon.ExtractAssociatedIcon(link.TargetPath).ToBitmap(); } } catch (Exception) { // ignore } _shortcutItem.Click += Open_shortcut_Click; _shortcutsMenuItem.DropDownItems.Add(_shortcutItem); } this.contextMenuStrip1.Items.Add(_shortcutsMenuItem); this.contextMenuStrip1.Items.Add(toolStripSeparator1); } this.contextMenuStrip1.Items.AddRange(new ToolStripItem[] { this.ExitMenuItem}); contextMenuStrip1.Opacity = 0.8; _shortcutsMenuItem.DropDown.Opacity = 0.8; } // Designer.cs using AppName.Properties; namespace AppName { partial class AppNameForm { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AppNameForm)); notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this._shortcutsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); // // notifyIcon1 // notifyIcon1.ContextMenuStrip = this.contextMenuStrip1; notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon"))); // // ExitMenuItem // this.ExitMenuItem.Name = "ExitMenuItem"; this.ExitMenuItem.Size = new System.Drawing.Size(241, 22); this.ExitMenuItem.Text = "Exit"; this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator"; this.toolStripSeparator1.Size = new System.Drawing.Size(238, 6); // // _shortcutsMenuItem // this._shortcutsMenuItem.Name = "_shortcutsMenuItem"; this._shortcutsMenuItem.Size = new System.Drawing.Size(241, 22); this._shortcutsMenuItem.Text = "Shortcuts"; } #endregion private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; private System.Windows.Forms.ToolStripMenuItem ExitMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem _shortcutsMenuItem; static internal System.Windows.Forms.NotifyIcon notifyIcon1; } }