Exemplo n.º 1
0
            protected override void OnRenderItemCheck(System.Windows.Forms.ToolStripItemImageRenderEventArgs e)
            {
                base.OnRenderItemCheck(e);

                if (e.Item.Selected)
                {
                    var rect  = new Rectangle(3, 1, 20, 20);
                    var rect2 = new Rectangle(4, 2, 18, 18);
                    var b     = new SolidBrush(ColorToolstripBtn_Border);
                    var b2    = new SolidBrush(ColorCheckBG);

                    e.Graphics.FillRectangle(b, rect);
                    e.Graphics.FillRectangle(b2, rect2);
                    e.Graphics.DrawImage(e.Image, new Point(5, 3));
                }
                else
                {
                    var rect  = new Rectangle(3, 1, 20, 20);
                    var rect2 = new Rectangle(4, 2, 18, 18);
                    var b     = new SolidBrush(ColorSelectedBG_Drop_Border);
                    var b2    = new SolidBrush(ColorCheckBG);

                    e.Graphics.FillRectangle(b, rect);
                    e.Graphics.FillRectangle(b2, rect2);
                    e.Graphics.DrawImage(e.Image, new Point(5, 3));
                }
            }
 protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
 {
     base.OnRenderItemCheck(e);
     /*
     if (e.Item is ToolStripMenuItem )
     {
         if (((ToolStripMenuItem) e.Item).Checked)
         {
             Rectangle rect = new Rectangle(3, 3, 12, 12);
             e.Graphics.DrawRectangle(Pens.Black, rect);
             e.Graphics.DrawLine(Pens.Black, new Point(5,12), new Point( 8,12 ) );
             e.Graphics.DrawLine(Pens.Black, new Point(8, 12), new Point(11, 4));
         }
         else
         {
             Rectangle rect = new Rectangle(3, 3, 12, 12);
             e.Graphics.DrawRectangle(Pens.Black, rect);
         }
     }
     else
     {
         base.OnRenderItemCheck(e);
     }
      * */
 }
Exemplo n.º 3
0
        protected override void OnRenderItemCheck(System.Windows.Forms.ToolStripItemImageRenderEventArgs e)
        {
            base.OnRenderItemCheck(e);

            Rectangle rect = new Rectangle(3, 1, e.Item.Height - 3, e.Item.Height - 3);
            Color     c    = default(Color);

            if (e.Item.Selected)
            {
                c = this.ColorTable.CommonColorTable.CheckedSelectedBackground;
            }
            else
            {
                c = this.ColorTable.CommonColorTable.CheckedBackground;
            }

            using (SolidBrush b = new SolidBrush(c))
            {
                e.Graphics.FillRectangle(b, rect);
            }


            using (Pen p = new Pen(this.ColorTable.CommonColorTable.SelectionBorder))
            {
                e.Graphics.DrawRectangle(p, rect);
            }


            e.Graphics.DrawString("ü", new Font("Wingdings", 13, FontStyle.Regular), Brushes.Black, new Point(4, 2));
        }
 protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
 {
     Rectangle destRect = e.ImageRectangle;
     destRect.X++;
     destRect.Width -= 2;
     destRect.Y++;
     destRect.Height -= 2;
     Image normalImage = e.Image;
     if ((destRect != Rectangle.Empty) && (normalImage != null))
     {
         if (e.Item.Enabled)
         {
             e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
             e.Graphics.DrawImage(normalImage, destRect);
         }
         else
         {
             Image disabledImage = new Bitmap(destRect.Width, destRect.Height);
             Graphics g = Graphics.FromImage(disabledImage);
             g.InterpolationMode = InterpolationMode.HighQualityBicubic;
             g.DrawImage(e.Image, 0, 0, destRect.Width, destRect.Height);
             g.Dispose();
             ControlPaint.DrawImageDisabled(e.Graphics, disabledImage, destRect.X, destRect.Y, Color.Transparent);
         }
     }
 }
        protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
        {
            Rectangle rect = Rectangle.Inflate(e.ImageRectangle, 3, 2);

            e.Graphics.FillRectangle(new LinearGradientBrush(
                    new Point(0, 0),
                    new Point(0, e.Item.ContentRectangle.Height),
                    backFillColorTop,
                    backFillColorBottom), rect);

            e.Graphics.DrawLines(new Pen(outlineColor), GraphicsHelper.getRoundedLines(rect));

            rect = Rectangle.Inflate(rect, -1, -1);

            e.Graphics.DrawLines(new Pen(insetOutlineColor), GraphicsHelper.getRoundedLines(rect));

            rect = Rectangle.Inflate(rect, -2, -1);

            try
            {
                if (e.Item.Image == null)
                    e.Graphics.DrawImageUnscaled(Properties.Resources.bullet_black, rect);
            }
            catch
            {
                base.OnRenderItemCheck(e);
            }
        }
 protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
 {
     Rectangle imageRectangle = e.ImageRectangle;
     Image normalImage = e.Image;
     if (!imageRectangle.IsEmpty && (normalImage != null))
     {
         bool flag = false;
         if (!e.Item.Enabled)
         {
             normalImage = ToolStripRenderer.CreateDisabledImage(normalImage);
             flag = true;
         }
         if (e.Item.ImageScaling == ToolStripItemImageScaling.None)
         {
             e.Graphics.DrawImage(normalImage, imageRectangle.Location);
         }
         else
         {
             e.Graphics.DrawImage(normalImage, imageRectangle);
         }
         if (flag)
         {
             normalImage.Dispose();
         }
     }
 }
Exemplo n.º 7
0
 protected override void OnRenderItemImage(System.Windows.Forms.ToolStripItemImageRenderEventArgs e)
 {
     System.Drawing.Rectangle rectangle = e.ImageRectangle;
     Oranikle.Studio.Controls.CtrlTabStripButton ctrlTabStripButton = e.Item as Oranikle.Studio.Controls.CtrlTabStripButton;
     if (ctrlTabStripButton != null)
     {
         if (ctrlTabStripButton.DisplayStyle == System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText)
         {
             int i1 = (Mirrored ? -1 : 1) * (ctrlTabStripButton.Checked ? ctrlTabStripButton.VerticalOffset : ctrlTabStripButton.VerticalOffsetInactive);
             rectangle = new System.Drawing.Rectangle(10, 6 + i1, 22, 22);
         }
         else
         {
             int i2 = (Mirrored ? -1 : 1) * (ctrlTabStripButton.Checked ? ctrlTabStripButton.VerticalOffset - 4 : ctrlTabStripButton.VerticalOffsetInactive - 4);
             if (e.ToolStrip.Orientation == System.Windows.Forms.Orientation.Horizontal)
             {
                 rectangle.Offset(-1, i2 + (Mirrored ? 1 : 0));
             }
             else
             {
                 rectangle.Offset(-1, 0);
             }
         }
     }
     System.Windows.Forms.ToolStripItemImageRenderEventArgs toolStripItemImageRenderEventArgs = new System.Windows.Forms.ToolStripItemImageRenderEventArgs(e.Graphics, e.Item, e.Image, rectangle);
     if (currentRenderer != null)
     {
         currentRenderer.DrawItemImage(toolStripItemImageRenderEventArgs);
         return;
     }
     base.OnRenderItemImage(toolStripItemImageRenderEventArgs);
 }
        /// <summary>
        /// 将图标居中绘制
        /// </summary>
        /// <param name="e"></param>
        protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
        {
            //base.OnRenderItemImage(e);
            int offset = 28;

            Image icon = e.Image;
            Rectangle iconRect = e.ImageRectangle;
            Graphics g = e.Graphics;

            if (e.ToolStrip is ContextMenuStrip)
            {
                ContextMenuStrip contextMenuStrip = e.ToolStrip as ContextMenuStrip;
                iconRect.X = (offset - icon.Width) / 2;
                if (icon.Width < contextMenuStrip.ImageScalingSize.Width ||
                    icon.Height < contextMenuStrip.ImageScalingSize.Height)
                {
                    g.DrawImage(icon, iconRect);
                }
                else
                {
                    Rectangle iconPoint = new Rectangle(
                        iconRect.X,
                        2,
                        contextMenuStrip.ImageScalingSize.Width + 3,
                        contextMenuStrip.ImageScalingSize.Height + 2);

                    Rectangle imgRect = new Rectangle(0, 0, icon.Width, icon.Height);
                    g.DrawImage(icon, iconPoint, imgRect, GraphicsUnit.Pixel);
                }
            }
        }
Exemplo n.º 9
0
        protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
        {
            Rectangle rect = e.ImageRectangle;
            rect.X += 4;
            ToolStripItemImageRenderEventArgs ne = new ToolStripItemImageRenderEventArgs(e.Graphics, e.Item, e.Image, rect);

            base.OnRenderItemImage(ne);
        }
Exemplo n.º 10
0
 protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
 {
     Rectangle rect = new Rectangle(25,1,16,16);
     if (e.Item is ToolStripMenuItem && ((ToolStripMenuItem)e.Item).Checked)
         e.Graphics.DrawImage(e.Image, rect);
     else
         base.OnRenderItemImage(e);
 }
 protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
 {
     if (e.Item is ToolStripMenuItem)
     {
         Rectangle imageRectangle = new Rectangle(e.ImageRectangle.Left + 2, e.ImageRectangle.Top, e.ImageRectangle.Width, e.ImageRectangle.Height);
         e = new ToolStripItemImageRenderEventArgs(e.Graphics, e.Item, e.Image, imageRectangle);
     }
     base.OnRenderItemImage(e);
 }
Exemplo n.º 12
0
        protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
        {
            Rectangle backRect = new Rectangle(5, 4, 13, 13);
            LinearGradientBrush bgBrush = new LinearGradientBrush(backRect, Color.FromArgb(255, 220, 120), Color.FromArgb(240, 160, 40), LinearGradientMode.Vertical);

            e.Graphics.DrawRectangle(new Pen(new SolidBrush(Color.FromArgb(150, 50, 0)), 1), new Rectangle(4, 3, 14, 14));
            e.Graphics.FillRectangle(bgBrush, backRect);
            e.Graphics.DrawImage(e.Image, new Point(3, 3));
        }
Exemplo n.º 13
0
 protected override void OnRenderItemCheck(System.Windows.Forms.ToolStripItemImageRenderEventArgs e)
 {
     if (currentRenderer != null)
     {
         currentRenderer.DrawItemCheck(e);
         return;
     }
     base.OnRenderItemCheck(e);
 }
Exemplo n.º 14
0
 protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
 {
     base.OnRenderItemCheck(e);
     Rectangle bounds = new Rectangle(e.ImageRectangle.Left - 2, 1, e.ImageRectangle.Width + 4, e.Item.Height - 2);
     Graphics g = e.Graphics;
     using (Pen p = new Pen(ThemeColorTable.HighlightColor, 1))
     {
         g.DrawRectangle(p, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1);
     }
 }
Exemplo n.º 15
0
 protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
 {
     e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
     if (e.Image != null)
     {
         imageheight = e.Item.Height - offsety * 2;
         imagewidth = (int)((Convert.ToDouble(imageheight) / e.Image.Height) * e.Image.Width);
     }
     e.Graphics.DrawImage(e.Image, new Rectangle(offsetx, offsety, imagewidth, imageheight));
 }
 protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
 {
     ToolStripSplitButton item = e.Item as ToolStripSplitButton;
     if (!((e.Item is ToolStripMenuItem) || !((item != null) ? item.ButtonPressed : e.Item.Pressed)))
     {
         Rectangle imageRectangle = e.ImageRectangle;
         imageRectangle.Offset(1, 1);
         e = new ToolStripItemImageRenderEventArgs(e.Graphics, e.Item, e.Image, imageRectangle);
     }
     base.OnRenderItemImage(e);
 }
		protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) {
			if (scaledCheckbox == null || scaledCheckbox.Size != coreConfiguration.IconSize) {
				if (scaledCheckbox != null) {
					scaledCheckbox.Dispose();
				}
				scaledCheckbox = ImageHelper.ResizeImage(e.Image, true, coreConfiguration.IconSize.Width, coreConfiguration.IconSize.Height, null);
			}
			Rectangle old = e.ImageRectangle;
			ToolStripItemImageRenderEventArgs clone = new ToolStripItemImageRenderEventArgs(e.Graphics, e.Item, scaledCheckbox, new Rectangle(old.X, 0, old.Width, old.Height));
			base.OnRenderItemCheck(clone);
		}
 /// <summary>
 /// Render an item
 /// </summary>
 /// <param name="e"></param>
 protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
 {
     // automatic adjust the color of attached images...
     if (e.Item.Selected && e.Item.Pressed == false)
         e.Graphics.DrawImageUnscaled(e.Item.Image.AdjustRGBGamma(1f, 1f, 1f, 0.01f), e.ImageRectangle);
     else
     {
         if (MetroUI.Style.DarkStyle)
             e.Graphics.DrawImageUnscaled(e.Item.Image.AdjustRGBGamma(1f, 1f, 1f, 0.01f), e.ImageRectangle);
         else
             base.OnRenderItemImage(e);
     }
 }
Exemplo n.º 19
0
        protected override void OnRenderItemImage(System.Windows.Forms.ToolStripItemImageRenderEventArgs e)
        {
            if (e.Item.DisplayStyle == ToolStripItemDisplayStyle.ImageAndText)
            {
                e.Graphics.DrawImage(e.Item.Image, e.ImageRectangle);
                return;
            }
            else if (e.Item.DisplayStyle != ToolStripItemDisplayStyle.Image)
            {
                base.OnRenderItemImage(e);
                return;
            }

            if (VisualStyleRenderer.IsSupported)
            {
                VisualStyleRenderer navigation = null;
                int stylePart = e.ToolStrip.Items.IndexOf(e.Item) + 1;

                try
                {
                    if (!e.Item.Enabled)
                    {
                        navigation = new VisualStyleRenderer("Navigation", stylePart, NativeMethods.NAV_BF_DISABLED);
                    }
                    else if (e.Item.Pressed)
                    {
                        navigation = new VisualStyleRenderer("Navigation", stylePart, NativeMethods.NAV_BF_PRESSED);
                    }
                    else if (e.Item.Selected)
                    {
                        navigation = new VisualStyleRenderer("Navigation", stylePart, NativeMethods.NAV_BF_HOT);
                    }
                    else
                    {
                        navigation = new VisualStyleRenderer("Navigation", stylePart, NativeMethods.NAV_BF_NORMAL);
                    }
                }
                catch (ArgumentException)
                {
                    // The element is not defined in the current theme
                }

                if (navigation != null)
                {
                    navigation.DrawBackground(e.Graphics, new Rectangle(0, -2, e.Item.Width, e.Item.Width));
                    return;
                }
            }

            base.OnRenderItemImage(e);
        }
Exemplo n.º 20
0
 protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e) {
     QMenuItem item = e.Item as QMenuItem;
     if(((item != null) && item.IsCut) && ((e.ImageRectangle != Rectangle.Empty) && (e.Image != null))) {
         ColorMatrix newColorMatrix = new ColorMatrix();
         using(ImageAttributes attributes = new ImageAttributes()) {
             newColorMatrix.Matrix33 = 0.5f;
             attributes.SetColorMatrix(newColorMatrix);
             Size size = e.Image.Size;
             e.Graphics.DrawImage(e.Image, e.ImageRectangle, 0, 0, size.Width, size.Height, GraphicsUnit.Pixel, attributes);
             return;
         }
     }
     base.OnRenderItemImage(e);
 }
 protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
 {
     using (GraphicsPath path = RoundRect(Rectangle.FromLTRB(e.ImageRectangle.Left, e.ImageRectangle.Top - 1, e.ImageRectangle.Right + 2, e.ImageRectangle.Bottom), 2f, 2f, 2f, 2f))
     {
         Color color = e.Item.Selected ? base.ColorTable.CheckSelectedBackground : base.ColorTable.CheckBackground;
         using (Brush brush = new SolidBrush(color))
         {
             e.Graphics.FillPath(brush, path);
         }
         using (Pen pen = new Pen(base.ColorTable.ButtonCheckedHighlightBorder))
         {
             e.Graphics.DrawPath(pen, path);
         }
     }
 }
Exemplo n.º 22
0
 protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e) {
     ToolStripDropDownMenu toolStrip = e.ToolStrip as ToolStripDropDownMenu;
     if(toolStrip != null) {
         if(!toolStrip.ShowImageMargin) {
             e.Graphics.DrawImage(bmpCheck, new Rectangle(3, 0, 0x16, Math.Min(0x16, e.Item.Size.Height)));
         }
         else {
             Rectangle rect = new Rectangle(7, 2, 0x12, 0x12);
             using(SolidBrush brush = new SolidBrush(Color.FromArgb(0x80, SystemColors.Highlight))) {
                 e.Graphics.FillRectangle(brush, rect);
                 e.Graphics.DrawRectangle(SystemPens.Highlight, rect);
             }
         }
     }
 }
 protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
 {
     base.OnRenderItemCheck(e);
     if (e.Item is ToolStripMenuItem)
     {
         Rectangle r = e.ImageRectangle;
         r.Inflate(2, 2);
         if ((e.Item as ToolStripMenuItem).Checked)
         {
             PaintItem(e.Graphics, r, ColorTable.ButtonSelectedMiddleBegin, ColorTable.ButtonSelectedMiddleBegin);
         }
         else
             ControlPaint.DrawImageDisabled(e.Graphics, e.Image, e.ImageRectangle.X, e.ImageRectangle.Y, Color.Transparent);
     }
 }
Exemplo n.º 24
0
        protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
        {
            int h = e.Item.Height;
            int size = h / 2 - 2; // Box size
            Rectangle rect = new Rectangle(10, (h - size) / 2, size - 2, size);

            var mode = e.Graphics.SmoothingMode;

            using (Pen pen = new Pen(Color.White, 1.6f))
            {
                e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                e.Graphics.DrawLine(pen, rect.Left, rect.Bottom - size / 2, rect.Left + size / 2.5f, rect.Bottom - 2);
                e.Graphics.DrawLine(pen, rect.Left + size / 2.6f, rect.Bottom - 2, rect.Right, rect.Top);
            }

            e.Graphics.SmoothingMode = mode;
        }
Exemplo n.º 25
0
   protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
   {
      //Same as base, but removed checkstate background rendering.

      Rectangle imageRectangle = e.ImageRectangle;
      Image image = e.Image;

      if (imageRectangle != Rectangle.Empty && image != null)
      {
         if (!e.Item.Enabled)
         {
            base.OnRenderItemImage(e);
            return;
         }
         if (e.Item.ImageScaling == ToolStripItemImageScaling.None)
         {
            e.Graphics.DrawImage(image, imageRectangle, new Rectangle(Point.Empty, imageRectangle.Size), GraphicsUnit.Pixel);
            return;
         }
         e.Graphics.DrawImage(image, imageRectangle);
      }
   }
Exemplo n.º 26
0
        /// <summary>Renders an item checkbox.</summary>
        /// <param name="e">A <see cref="T:ToolStripItemImageRenderEventArgs"/> that contains the event data.</param>
        protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
        {
            if (e.Image != null)
            {
                if (e.Item.Enabled)
                {
                    Rectangle bounds = e.ImageRectangle;
                    bounds.Inflate(1, 1);

                    e.Graphics.SmoothingMode = SmoothingMode.HighQuality;

                    FillAndStrokeButtonBackground(
                        e.Graphics,
                        bounds,
                        ColorTable.ButtonCheckedHighlight,
                        ColorTable.ButtonCheckedHighlightBorder,
                        e.Item.Pressed);
                }

                OnRenderItemImage(e);
            }
        }
Exemplo n.º 27
0
        protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
        {
            var g = e.Graphics;

            var rect = new Rectangle(e.ImageRectangle.Left - 2, e.ImageRectangle.Top - 2,
                                         e.ImageRectangle.Width + 4, e.ImageRectangle.Height + 4);

            using (var b = new SolidBrush(Colors.LightBorder))
            {
                g.FillRectangle(b, rect);
            }

            using (var p = new Pen(Colors.BlueHighlight))
            {
                var modRect = new Rectangle(rect.Left, rect.Top, rect.Width - 1, rect.Height - 1);
                g.DrawRectangle(p, modRect);
            }

            if (e.Item.ImageIndex == -1 && String.IsNullOrEmpty(e.Item.ImageKey) && e.Item.Image == null)
            {
                g.DrawImageUnscaled(MenuIcons.tick, new Point(e.ImageRectangle.Left, e.ImageRectangle.Top));
            }
        }
Exemplo n.º 28
0
 protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e) {
     ToolStripMenuItem item = e.Item as ToolStripMenuItem;
     if((item != null) && item.Checked) {
         Rectangle imageRectangle = e.ImageRectangle;
         imageRectangle.Inflate(1, 1);
         using(SolidBrush brush = new SolidBrush(Color.FromArgb(0x80, SystemColors.Highlight))) {
             e.Graphics.FillRectangle(brush, imageRectangle);
             e.Graphics.DrawRectangle(SystemPens.Highlight, imageRectangle);
         }
     }
     QMenuItem item2 = e.Item as QMenuItem;
     if(((item2 != null) && item2.IsCut) && ((e.ImageRectangle != Rectangle.Empty) && (e.Image != null))) {
         ColorMatrix newColorMatrix = new ColorMatrix();
         using(ImageAttributes attributes = new ImageAttributes()) {
             newColorMatrix.Matrix33 = 0.5f;
             attributes.SetColorMatrix(newColorMatrix);
             Size size = e.Image.Size;
             e.Graphics.DrawImage(e.Image, e.ImageRectangle, 0, 0, size.Width, size.Height, GraphicsUnit.Pixel, attributes);
             return;
         }
     }
     base.OnRenderItemImage(e);
 }
Exemplo n.º 29
0
 /// <include file='doc\WinBarRenderer.uex' path='docs/doc[@for="ToolStripRenderer.DrawItemCheck"]/*' />
 /// <devdoc>
 /// Draw image
 /// </devdoc>
 public void DrawItemCheck(ToolStripItemImageRenderEventArgs e) {
       OnRenderItemCheck(e);
       
       ToolStripItemImageRenderEventHandler eh = Events[EventRenderItemCheck] as ToolStripItemImageRenderEventHandler;
       if (eh != null) {
           eh(this, e);
       }
 }
Exemplo n.º 30
0
        /// <include file='doc\ToolStripRenderer.uex' path='docs/doc[@for="ToolStripRenderer.OnRenderItemImage"]/*' />
        /// <devdoc>
        /// Draw the item'si mage.  ToolStrip users should override this function to change the 
        /// drawing of all images.
        /// </devdoc>
        protected virtual void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)  {
            if (RendererOverride != null) {
                RendererOverride.OnRenderItemImage(e);
                return;
            }

            Rectangle imageRect = e.ImageRectangle;
            Image image = e.Image;
                   
            if (imageRect != Rectangle.Empty && image != null) {
                bool disposeImage = false;
                if (e.ShiftOnPress && e.Item.Pressed) {
                   imageRect.X +=1;
                }
                if (!e.Item.Enabled) {
                    image = CreateDisabledImage(image);
                    disposeImage = true;
                }
                if (e.Item.ImageScaling == ToolStripItemImageScaling.None) {
                   e.Graphics.DrawImage(image, imageRect, new Rectangle(Point.Empty,imageRect.Size), GraphicsUnit.Pixel);

                }
                else {
                    e.Graphics.DrawImage(image, imageRect);
                }

                if (disposeImage) {
                    image.Dispose();
                }
            }
        }
 protected virtual void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
 {
     if (this.RendererOverride != null)
     {
         this.RendererOverride.OnRenderItemImage(e);
     }
     else
     {
         Rectangle imageRectangle = e.ImageRectangle;
         Image normalImage = e.Image;
         if ((imageRectangle != Rectangle.Empty) && (normalImage != null))
         {
             bool flag = false;
             if (e.ShiftOnPress && e.Item.Pressed)
             {
                 imageRectangle.X++;
             }
             if (!e.Item.Enabled)
             {
                 normalImage = CreateDisabledImage(normalImage);
                 flag = true;
             }
             if (e.Item.ImageScaling == ToolStripItemImageScaling.None)
             {
                 e.Graphics.DrawImage(normalImage, imageRectangle, new Rectangle(Point.Empty, imageRectangle.Size), GraphicsUnit.Pixel);
             }
             else
             {
                 e.Graphics.DrawImage(normalImage, imageRectangle);
             }
             if (flag)
             {
                 normalImage.Dispose();
             }
         }
     }
 }
 protected virtual void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
 {
     if (this.RendererOverride != null)
     {
         this.RendererOverride.OnRenderItemCheck(e);
     }
     else
     {
         Rectangle imageRectangle = e.ImageRectangle;
         Image normalImage = e.Image;
         if ((imageRectangle != Rectangle.Empty) && (normalImage != null))
         {
             if (!e.Item.Enabled)
             {
                 normalImage = CreateDisabledImage(normalImage);
             }
             e.Graphics.DrawImage(normalImage, imageRectangle, new Rectangle(Point.Empty, imageRectangle.Size), GraphicsUnit.Pixel);
         }
     }
 }
 public void DrawItemImage(ToolStripItemImageRenderEventArgs e)
 {
     this.OnRenderItemImage(e);
     ToolStripItemImageRenderEventHandler handler = this.Events[EventRenderItemImage] as ToolStripItemImageRenderEventHandler;
     if (handler != null)
     {
         handler(this, e);
     }
 }
		public void DrawItemImage (ToolStripItemImageRenderEventArgs e)
		{ this.OnRenderItemImage (e); }
Exemplo n.º 35
0
 protected virtual void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
 {
     throw null;
 }
Exemplo n.º 36
0
 public void DrawItemCheck(ToolStripItemImageRenderEventArgs e)
 {
     throw null;
 }
Exemplo n.º 37
0
 protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
 {
     base.OnRenderItemImage(e);
 }
Exemplo n.º 38
0
        /// <include file='doc\WinBarRenderer.uex' path='docs/doc[@for="ToolStripRenderer.OnRenderItemCheck"]/*' />
        protected virtual void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)  {
            if (RendererOverride != null) {
                RendererOverride.OnRenderItemCheck(e);
                return;
            }

           Rectangle imageRect = e.ImageRectangle;
           Image image = e.Image;
                  
           if (imageRect != Rectangle.Empty && image != null) {
               if (!e.Item.Enabled) {
                   image = CreateDisabledImage(image);
               }
               
               e.Graphics.DrawImage(image, imageRect, new Rectangle(Point.Empty,imageRect.Size), GraphicsUnit.Pixel);
           }
       }
Exemplo n.º 39
0
 protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
 {
     renderer.DrawItemImage(e);
 }