コード例 #1
0
        // Override this method to draw any owner-draw menu items
        // added by the contextmenu extension.
        // TODO : UNCOMMENT THIS OVERRIDE IF YOU HAVE OWNER DRAWN MENU IETMS
        protected override void OnDrawMenuItem(SkySoftware.EZShellExtensions.EZSDrawItemEventArgs e)
        {
            e.DrawBackground();
            Stream IconStream = null;

            if (e.MenuItem.Verb == GlueShellMenuItemName)
                IconStream = this.GetType().Assembly.GetManifestResourceStream("ShellGlue.Glue.ico");
            else
                IconStream = File.OpenRead(this.Configuration.Actions.GetActionItem(e.MenuItem).IconFilePath);
            try
            {
                using (Icon GlueImage = new Icon(IconStream))
                {
                    e.Graphics.DrawIconUnstretched(GlueImage, e.Bounds);
                }
            }
            finally
            {
                if (IconStream != null)
                    IconStream.Dispose();
            }
            e.Graphics.DrawString(e.MenuItem.Caption, SystemInformation.MenuFont, Brushes.Black, 18.0F, (float)e.Bounds.Top + 1);
            e.DrawFocusRectangle();
        }