コード例 #1
0
        protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
        {
            //System.Diagnostics.Debug.WriteLine(e.ToolStrip.ToString());
            if (e.ToolStrip is ToolStripDropDownMenu)
            {
                Color color;
                if (e.Item.Selected)
                {
                    if (e.Item.Enabled)
                    {
                        color = PaintHelper.AdjustColor(UITheme.Default.Colors.Sharp, 40, 50, 85, 90);
                    }
                    else
                    {
                        color = Color.WhiteSmoke;
                    }
                }
                else
                {
                    return;
                }
                Rectangle rect = new Rectangle(0, 0, e.Item.Bounds.Width, e.Item.Bounds.Height);
                rect.Inflate(-2, 0);

                PaintHelper.DrawHoverBackground(e.Graphics, rect, color);
                return;
            }

            base.OnRenderMenuItemBackground(e);
        }