示例#1
0
 protected override void OnRenderItemCheck(System.Windows.Forms.ToolStripItemImageRenderEventArgs e)
 {
     if (currentRenderer != null)
     {
         currentRenderer.DrawItemCheck(e);
         return;
     }
     base.OnRenderItemCheck(e);
 }
示例#2
0
 protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
 {
     if (_currentRenderer != null)
     {
         _currentRenderer.DrawItemCheck(e);
     }
     else
     {
         base.OnRenderItemCheck(e);
     }
 }
示例#3
0
 protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
 {
     if (renderer is ToolStripProfessionalRenderer)
     {
         Color               back        = PluginBase.MainForm.GetThemeColor("ToolStripItem.BackColor");
         Color               border      = PluginBase.MainForm.GetThemeColor("ToolStripItem.BorderColor");
         Rectangle           borderRect  = new Rectangle(4, 2, ScaleHelper.Scale(18), ScaleHelper.Scale(18));
         Rectangle           backRect    = new Rectangle(5, 3, borderRect.Width - 2, borderRect.Height - 2);
         SolidBrush          borderBrush = new SolidBrush(border == Color.Empty ? DockDrawHelper.ColorSelectedBG_Border : border);
         LinearGradientBrush backBrush   = new LinearGradientBrush(backRect, back == Color.Empty ? DockDrawHelper.ColorSelectedBG_White : back, back == Color.Empty ? DockDrawHelper.ColorSelectedBG_Blue : back, LinearGradientMode.Vertical);
         e.Graphics.FillRectangle(borderBrush, borderRect);
         e.Graphics.FillRectangle(backBrush, backRect);
         e.Graphics.DrawImage(e.Image, 5 + ((backRect.Width - e.ImageRectangle.Width) / 2), 3 + ((backRect.Height - e.ImageRectangle.Height) / 2), e.ImageRectangle.Width, e.ImageRectangle.Height);
     }
     else
     {
         renderer.DrawItemCheck(e);
     }
 }
 protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
 {
     if (renderer is ToolStripProfessionalRenderer)
     {
         Color               back        = GetThemeColor("ToolStripItem.BackColor");
         Color               border      = GetThemeColor("ToolStripItem.BorderColor");
         Rectangle           borderRect  = new Rectangle(4, 2, ScaleHelper.Scale(18), ScaleHelper.Scale(18));
         Rectangle           backRect    = new Rectangle(5, 3, borderRect.Width - 2, borderRect.Height - 2);
         SolidBrush          borderBrush = new SolidBrush(border == Color.Empty ? DockDrawHelper.ColorSelectedBG_Border : border);
         LinearGradientBrush backBrush   = new LinearGradientBrush(backRect, back == Color.Empty ? DockDrawHelper.ColorSelectedBG_White : back, back == Color.Empty ? DockDrawHelper.ColorSelectedBG_Blue : back, LinearGradientMode.Vertical);
         e.Graphics.FillRectangle(borderBrush, borderRect);
         e.Graphics.FillRectangle(backBrush, backRect);
         Image image = PluginBase.MainForm.FindImageAndSetAdjust("485");
         e.Graphics.DrawImage(image, e.ImageRectangle, new Rectangle(Point.Empty, image.Size), GraphicsUnit.Pixel);
     }
     else
     {
         renderer.DrawItemCheck(e);
     }
 }
示例#5
0
 protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
 {
     renderer.DrawItemCheck(e);
 }
 protected override void OnPaint(PaintEventArgs e)
 {
     if (base.Owner != null)
     {
         ToolStripRenderer renderer = base.Renderer;
         Graphics          g        = e.Graphics;
         renderer.DrawMenuItemBackground(new ToolStripItemRenderEventArgs(g, this));
         Color menuText = SystemColors.MenuText;
         if (base.IsForeColorSet)
         {
             menuText = this.ForeColor;
         }
         else if (!this.IsTopLevel || ToolStripManager.VisualStylesEnabled)
         {
             if (this.Selected || this.Pressed)
             {
                 menuText = SystemColors.HighlightText;
             }
             else
             {
                 menuText = SystemColors.MenuText;
             }
         }
         bool flag = this.RightToLeft == RightToLeft.Yes;
         ToolStripMenuItemInternalLayout internalLayout = base.InternalLayout as ToolStripMenuItemInternalLayout;
         if ((internalLayout != null) && internalLayout.UseMenuLayout)
         {
             if ((this.CheckState != System.Windows.Forms.CheckState.Unchecked) && internalLayout.PaintCheck)
             {
                 Rectangle checkRectangle = internalLayout.CheckRectangle;
                 if (!internalLayout.ShowCheckMargin)
                 {
                     checkRectangle = internalLayout.ImageRectangle;
                 }
                 if (checkRectangle.Width != 0)
                 {
                     renderer.DrawItemCheck(new ToolStripItemImageRenderEventArgs(g, this, this.CheckedImage, checkRectangle));
                 }
             }
             if ((this.DisplayStyle & ToolStripItemDisplayStyle.Text) == ToolStripItemDisplayStyle.Text)
             {
                 renderer.DrawItemText(new ToolStripItemTextRenderEventArgs(g, this, this.Text, base.InternalLayout.TextRectangle, menuText, this.Font, flag ? ContentAlignment.MiddleRight : ContentAlignment.MiddleLeft));
                 bool showShortcutKeys = this.ShowShortcutKeys;
                 if (!base.DesignMode)
                 {
                     showShortcutKeys = showShortcutKeys && !this.HasDropDownItems;
                 }
                 if (showShortcutKeys)
                 {
                     renderer.DrawItemText(new ToolStripItemTextRenderEventArgs(g, this, this.GetShortcutText(), base.InternalLayout.TextRectangle, menuText, this.Font, flag ? ContentAlignment.MiddleLeft : ContentAlignment.MiddleRight));
                 }
             }
             if (this.HasDropDownItems)
             {
                 ArrowDirection arrowDirection = flag ? ArrowDirection.Left : ArrowDirection.Right;
                 Color          arrowColor     = (this.Selected || this.Pressed) ? SystemColors.HighlightText : SystemColors.MenuText;
                 arrowColor = this.Enabled ? arrowColor : SystemColors.ControlDark;
                 renderer.DrawArrow(new ToolStripArrowRenderEventArgs(g, this, internalLayout.ArrowRectangle, arrowColor, arrowDirection));
             }
             if ((internalLayout.PaintImage && ((this.DisplayStyle & ToolStripItemDisplayStyle.Image) == ToolStripItemDisplayStyle.Image)) && (this.Image != null))
             {
                 renderer.DrawItemImage(new ToolStripItemImageRenderEventArgs(g, this, base.InternalLayout.ImageRectangle));
             }
         }
         else
         {
             if ((this.DisplayStyle & ToolStripItemDisplayStyle.Text) == ToolStripItemDisplayStyle.Text)
             {
                 renderer.DrawItemText(new ToolStripItemTextRenderEventArgs(g, this, this.Text, base.InternalLayout.TextRectangle, menuText, this.Font, base.InternalLayout.TextFormat));
             }
             if (((this.DisplayStyle & ToolStripItemDisplayStyle.Image) == ToolStripItemDisplayStyle.Image) && (this.Image != null))
             {
                 renderer.DrawItemImage(new ToolStripItemImageRenderEventArgs(g, this, base.InternalLayout.ImageRectangle));
             }
         }
     }
 }