// Override this method to provide the dimensions for any owner drawn
 // contextmenu items provided by your contextmenu extension.
 // TODO : UNCOMMENT THIS OVERRIDE IF YOU HAVE OWNER DRAWN MENU IETMS
 protected override void OnMeasureMenuItem(SkySoftware.EZShellExtensions.EZSMeasureItemEventArgs e)
 {
     e.ItemHeight = 17;
     e.ItemWidth = 150;
 }
        // Override this method to perform your own tasks when any of the
        // menu items provided by your contextmenu extension is selected by the user.
        protected override bool OnExecuteMenuItem(SkySoftware.EZShellExtensions.ExecuteItemEventArgs e)
        {
            this.Configuration.Actions.GetActionItem(e.MenuItem).Execute(this.TargetFolder, this.TargetFiles);

            // Return value is ignored.
            return true;
        }
        // Override this method to add your menu items to the context menu
        protected override void OnGetMenuItems(SkySoftware.EZShellExtensions.GetMenuitemsEventArgs e)
        {
            ShellMenuItem parent = e.Menu.AddItem(GlueShellMenuItemName);
            parent.HasSubMenu = true;
            parent.OwnerDraw = true;

            this.Configuration.Actions.AddMenuItems(ref parent, this.TargetFolder, this.TargetFiles);
        }
        // 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();
        }