System.Windows.Forms.ControlPaint.DrawImageDisabled(System.Drawing.Graphics, System.Drawing.Image, int, int, System.Drawing.Color)

Here are the examples of the csharp api class System.Windows.Forms.ControlPaint.DrawImageDisabled(System.Drawing.Graphics, System.Drawing.Image, int, int, System.Drawing.Color) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

50 Examples 7

1. Example

Project: Sardauscan
Source File: CustomCaptionButton.cs
View license
public void DisabledState(Graphics g, Rectangle bounds, Color bgColor)
            {
								using (Bitmap bmp = new Bitmap(Image,bounds.Size))
								{
									ControlPaint.DrawImageDisabled(g, bmp, bounds.X, bounds.Y, Color.Red);
								}
            }

2. Example

Project: Krypton
Source File: RenderStandard.cs
View license
public override Rectangle DrawGridErrorGlyph(RenderContext context,
                                                     Rectangle cellRect,
                                                     PaletteState state,
                                                     bool rtl)
        {
            Debug.Assert(context != null);

            // Get the appropriate each to draw
            Image errorImage = _gridErrorIcon.Images[0];

            // Is there enough room to draw the image?
            if ((errorImage.Width < cellRect.Width) && (errorImage.Height < cellRect.Height))
            {
                // Find the drawing location of the image
                int y = cellRect.Top + (cellRect.Height - errorImage.Height) / 2;
                int x = (rtl ? cellRect.Left : cellRect.Right - errorImage.Width);

                if (state == PaletteState.Disabled)
                    ControlPaint.DrawImageDisabled(context.Graphics, errorImage, x, y, Color.Empty);
                else
                    context.Graphics.DrawImage(errorImage, x, y);

                // Reduce the cell rect by that used up
                cellRect.Width -= errorImage.Width;

                // With rtl we need to move across to the right
                if (rtl)
                    cellRect.X += errorImage.Width;
            }

            return cellRect;
        }

3. Example

View license
public override void Render(Graphics g, Rectangle r)
        {
            DrawBackground(g, r);
   /n ..... /n //View Source file for more details /n }

4. Example

Project: poderosa
Source File: GButton.cs
View license
protected static void DrawImage(Graphics g, DrawState state, Image image, int x, int y) {
            if (state == DrawState.Normal)
                g.DrawImage(image, x, y, image.Width, image.Height);
            else if (state == DrawState.Disabled)
                ControlPaint.DrawImageDisabled(g, image, x, y, SystemColors.Control);
            else if (state == DrawState.Focused || state == DrawState.Hover) {
                ControlPaint.DrawImageDisabled(g, image, x + 1, y, SystemColors.Control);
                g.DrawImage(image, x - 1, y - 1, image.Width, image.Height);
            }
        }

5. Example

Project: poderosa
Source File: TabBar.cs
View license
private static void DrawImage(Graphics g, DrawState state, Image image, int x, int y) {
            if (state == DrawState.Normal)
                g.DrawImage(image, x, y, image.Width, image.Height);
            else if (state == DrawState.Selected || state == DrawState.Hover) {
                ControlPaint.DrawImageDisabled(g, image, x + 1, y, SystemColors.Control);
                g.DrawImage(image, x - 1, y - 1, image.Width, image.Height);
            }
        }

6. Example

Project: DarkUI
Source File: DarkToolStripRenderer.cs
View license
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
        {
            var g = e.Graphics;

            if (e.Image == null)
                return;

            if (e.Item.Enabled)
                g.DrawImageUnscaled(e.Image, new Point(e.ImageRectangle.Left, e.ImageRectangle.Top));
            else
                ControlPaint.DrawImageDisabled(g, e.Image, e.ImageRectangle.Left, e.ImageRectangle.Top, Color.Transparent);
        }

7. Example

View license
public override void DrawImage(TreeListView.Node node, Graphics gfx, Rectangle bounds)
                {
                    // No image to draw
                    if (node.ImageIndex == -1)
                        return;

                    if (Owner.ImageList == null)
                        return;

                    if (node.ImageIndex >= Owner.ImageList.Images.Count)
                        return;

                    if (Owner.Control.Enabled && IsProjectFileOrDirectory(node))
                    {
                        Owner.ImageList.Draw(gfx, bounds.X, bounds.Y, bounds.Width, bounds.Height, node.ImageIndex);
                    }
                    else
                    {
                        using (var image = Owner.ImageList.Images[node.ImageIndex])
                        {
                            ControlPaint.DrawImageDisabled(gfx, image, bounds.X, bounds.Y, Owner.DisabledBackColor);
                        }
                    }
                }

8. Example

Project: ATF
Source File: TreeItemRenderer.cs
View license
public virtual void DrawImage(ImageList imageList, Graphics g, int x, int y, int index)
        {
            if ((Owner == null) || (Owner.Enabled))
            {
                using (var image = imageList.Images[index])
                    g.DrawImage(image, x, y);
            }
            else
            {
                using (var image = imageList.Images[index])
                    ControlPaint.DrawImageDisabled(g, image, x, y, Owner.BackColor);
            }
        }

9. Example

Project: ATF
Source File: TreeListView.Node.cs
View license
public virtual void DrawImage(Node node, Graphics gfx, Rectangle bounds)
            {
                // No image to draw
                if (node.ImageIndex == InvalidImageIndex)
                    return;

                if (Owner.ImageList == null)
                    return;

                if (node.ImageIndex >= Owner.ImageList.Images.Count)
                    return;

                // intentionally not using Owner.ImageList.Draw() any more due to rogue
                // pixels that show up if the image size doesn't match the bounds size

                using (Image image = Owner.ImageList.Images[node.ImageIndex])
                {
                    if (Owner.Control.Enabled)
                        gfx.DrawImage(image, bounds);
                    else
                        ControlPaint.DrawImageDisabled(gfx, image, bounds.X, bounds.Y, Owner.DisabledBackColor);
                }
            }

10. Example

Project: ATF
Source File: TreeListView.Node.cs
View license
public virtual void DrawStateImage(Node node, Graphics gfx, Rectangle bounds)
            {
                // No image to draw
                if (node.StateImageIndex == InvalidImageIndex)
                    return;

                if (Owner.StateImageList == null)
                    return;

                if (node.StateImageIndex >= Owner.StateImageList.Images.Count)
                    return;

                // intentionally not using Owner.StateImageList.Draw() any more due to
                // match DrawImage behavior. see comment in DrawImage.

                using (Image image = Owner.StateImageList.Images[node.StateImageIndex])
                {
                    if (Owner.Control.Enabled)
                        gfx.DrawImage(image, bounds);
                    else
                        ControlPaint.DrawImageDisabled(gfx, image, bounds.X, bounds.Y, Owner.DisabledBackColor);
                }
            }

11. Example

Project: Sardauscan
Source File: ImageButton.cs
View license
private void DrawImage(Graphics g,Image _Image,Point pt)
        {

					ImageAttributes ia = new ImageAttributes();
					if (currentState == CustomButtonState.Hot)
					{
						ia.SetColorMatrix(SkinInfo.HoverColorMatrix);
					}
					if (this.Enabled)
					{
						g.DrawImage(Image, new Rectangle(pt,_Image.Size), 0, 0, Image.Width, Image.Height, GraphicsUnit.Pixel, ia);
					}
					else
						ControlPaint.DrawImageDisabled(g, _Image, pt.X, pt.Y, SkinInfo.BackColor);

        }

12. Example

Project: Sardauscan
Source File: TaskListBox.cs
View license
private void DrawImage(Graphics g, Image image, Point pt, bool enabled,ColorMatrix colMat)
		{
			if (enabled)
			{
				ImageAttributes ia = new ImageAttributes();
                if (colMat == null)
                    colMat = new ColorMatrix();
                if (this.Lock)
                {
                    ColorMatrix cm =  colMat;
                    cm.Matrix33 *= 0.3f;

                    ia.SetColorMatrix(cm);
                }
                else
                    ia.SetColorMatrix(colMat);
				g.DrawImage(image, new Rectangle(pt, new Size(image.Width, image.Height)), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, ia);

				//						g.DrawImage(image, pt);
			}
			else
				ControlPaint.DrawImageDisabled(g, image, pt.X, pt.Y, SkinInfo.BackColor);

		}

13. Example

Project: xenadmin
Source File: DataGridViewExImageCell.cs
View license
protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates elementState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            if (!Show)
            {
                using (Brush b = new SolidBrush(Selected ? cellStyle.SelectionBackColor : cellStyle.BackColor))
                    graphics.FillRectangle(b, cellBounds);
            }
            else if (DataGridView.Enabled)
            {
                base.Paint(graphics, clipBounds, cellBounds, rowIndex, elementState, value, formattedValue, errorText,
                           cellStyle, advancedBorderStyle, paintParts);
            }
            else
            {
                Image img = (Image)value;
                using (Brush b = new SolidBrush(Selected ? cellStyle.SelectionBackColor : cellStyle.BackColor))
                    graphics.FillRectangle(b, cellBounds);
                if (img == null)
                    return;
                ControlPaint.DrawImageDisabled(graphics, img, cellBounds.X + ((cellBounds.Width - img.Width) / 2), cellBounds.Y + ((cellBounds.Height - img.Height) / 2),
                                               Selected ? cellStyle.SelectionBackColor : cellStyle.BackColor);
            }
        }

14. Example

Project: SharpBoot
Source File: W7R.cs
View license
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
        {
            // We only override the image drawing for context menus
            /* if ((e.ToolStrip is ContextMenuStrip) ||
                 (e.ToolStrip is ToolStripDropDownMenu))
             {*/


            if (e.Image != null)
            {
                var checkbox = e.Item as ToolStripMenuItem;
                if (checkbox == null || checkbox.CheckState == CheckState.Unchecked)
                {
                    var newrect = AdjustDrawRectangle(e.Item, e.ImageRectangle);
                    if (e.Item.Enabled)
                    {
                        newrect.X += 3;
                        e.Graphics.DrawImageUnscaledAndClipped(e.Image, newrect);
                    }
                    else
                        ControlPaint.DrawImageDisabled(e.Graphics, e.Image,
                            newrect.X,
                            newrect.Y,
                            Color.Transparent);
                }
            }


            /*  }
              else
              {
               



                 // base.OnRenderItemImage(e);
              }*/
        }

15. Example

Project: MapViewer
Source File: Renderers.cs
View license
protected virtual void DrawAlignedImage(Graphics g, Rectangle r, Image image) {
            if (image == null)
                return;

            // By default, the image goes in the top left of the rectangle
            Rectangle imageBounds = new Rectangle(r.Location, image.Size);

            // If the image is too tall to be drawn in the space provided, proportionally scale it down.
            // Too wide images are not scaled.
            if (image.Height > r.Height) {
                float scaleRatio = (float) r.Height / (float) image.Height;
                imageBounds.Width = (int) ((float) image.Width * scaleRatio);
                imageBounds.Height = r.Height - 1;
            }

            // Align and draw our (possibly scaled) image
            Rectangle alignRectangle = this.AlignRectangle(r, imageBounds);
            if (this.ListItem.Enabled)
                g.DrawImage(image, alignRectangle);
            else
                ControlPaint.DrawImageDisabled(g, image, alignRectangle.X, alignRectangle.Y, GetBackgroundColor());
        }

16. Example

Project: logwizard
Source File: Renderers.cs
View license
protected virtual void DrawAlignedImage(Graphics g, Rectangle r, Image image) {
            if (image == null)
                return;

            // By default, the image goes in the top left of the rectangle
            Rectangle imageBounds = new Rectangle(r.Location, image.Size);

            // If the image is too tall to be drawn in the space provided, proportionally scale it down.
            // Too wide images are not scaled.
            if (image.Height > r.Height) {
                float scaleRatio = (float)r.Height / (float)image.Height;
                imageBounds.Width = (int)((float)image.Width * scaleRatio);
                imageBounds.Height = r.Height - 1;
            }

            // Align and draw our (possibly scaled) image
            Rectangle alignRectangle = this.AlignRectangle(r, imageBounds);
            if (this.ListItem.Enabled)
                g.DrawImage(image, alignRectangle);
            else
                ControlPaint.DrawImageDisabled(g, image, alignRectangle.X, alignRectangle.Y, GetBackgroundColor());
        }

17. Example

Project: Bulk-Crap-Uninstaller
Source File: Renderers.cs
View license
protected virtual void DrawAlignedImage(Graphics g, Rectangle r, Image image) {
            if (image == null)
                return;

            // By default, the image goes in the top left of the rectangle
            Rectangle imageBounds = new Rectangle(r.Location, image.Size);

            // If the image is too tall to be drawn in the space provided, proportionally scale it down.
            // Too wide images are not scaled.
            if (image.Height > r.Height) {
                float scaleRatio = (float) r.Height / (float) image.Height;
                imageBounds.Width = (int) ((float) image.Width * scaleRatio);
                imageBounds.Height = r.Height - 1;
            }

            // Align and draw our (possibly scaled) image
            Rectangle alignRectangle = this.AlignRectangle(r, imageBounds);
            if (this.ListItem.Enabled)
                g.DrawImage(image, alignRectangle);
            else
                ControlPaint.DrawImageDisabled(g, image, alignRectangle.X, alignRectangle.Y, GetBackgroundColor());
        }

18. Example

Project: SquareOne
Source File: Renderers.cs
View license
protected virtual void DrawAlignedImage(Graphics g, Rectangle r, Image image) {
            if (image == null)
                return;

            // By default, the image goes in the top left of the rectangle
            Rectangle imageBounds = new Rectangle(r.Location, image.Size);

            // If the image is too tall to be drawn in the space provided, proportionally scale it down.
            // Too wide images are not scaled.
            if (image.Height > r.Height) {
                float scaleRatio = (float)r.Height / (float)image.Height;
                imageBounds.Width = (int)((float)image.Width * scaleRatio);
                imageBounds.Height = r.Height - 1;
            }

            // Align and draw our (possibly scaled) image
            Rectangle alignRectangle = this.AlignRectangle(r, imageBounds);
            if (this.ListItem.Enabled)
                g.DrawImage(image, alignRectangle);
            else
                ControlPaint.DrawImageDisabled(g, image, alignRectangle.X, alignRectangle.Y, GetBackgroundColor());
        }

19. Example

Project: dockpanelsuite
Source File: InertButton.cs
View license
private void DrawImage(Graphics g)
        {
            Image image = this.Enabled ? ImageEnabled :/n ..... /n //View Source file for more details /n }

20. Example

Project: ArnoldSimulator
Source File: InertButton.cs
View license
private void DrawImage(Graphics g)
		{
			Image image = this.Enabled ? ImageEnabled : ((ImageDisable/n ..... /n //View Source file for more details /n }

21. Example

Project: logwizard
Source File: Renderers.cs
View license
protected virtual int DrawImage(Graphics g, Rectangle r, Object imageSelector) {
            if (ima/n ..... /n //View Source file for more details /n }

22. Example

Project: Bulk-Crap-Uninstaller
Source File: Renderers.cs
View license
protected virtual int DrawImage(Graphics g, Rectangle r, Object imageSelector) {
            if (ima/n ..... /n //View Source file for more details /n }

23. Example

Project: just-gestures
Source File: ComboListView.cs
View license
protected void DrawImageAndText(Graphics g, Rectangle r)
        {
            int offset = 0;            
            if (m_columnIndex == 0)
            {
                int imgIndex = SmallImageList.Images.IndexOfKey(m_listItem.ImageKey);
                Rectangle r2 = new Rectangle(r.X, r.Y, r.Width, r.Height);
                int flags = ILD_TRANSPARENT;
                if (m_listItem.Selected)
                    flags |= ILD_BLEND25;
                if (m_listItem.Checked)
                {
                    bool result = ImageList_Draw(SmallImageList.Handle, imgIndex, g.GetHdc(), r2.X, r2.Y, flags);
                    g.ReleaseHdc();
                }
                else
                    ControlPaint.DrawImageDisabled(g, SmallImageList.Images[imgIndex], r2.X, r2.Y, Color.Transparent);
                offset = SmallImageList.ImageSize.Width;
            }
            r.X += offset;
            r.Width -= offset;
            offset = this.DrawText(g, r, m_listItem.SubItems[m_columnIndex].Text);
        }

24. Example

Project: just-gestures
Source File: GesturesListView.cs
View license
private int DrawImage(Graphics g, Rectangle r, Object imageSelector)
        {
            if (image/n ..... /n //View Source file for more details /n }

25. Example

View license
protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
        {
            Rectangle destRect = e.ImageRectangle;
            destRect.X += m_sideBorder + m_sideBorder / 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);
                }
            }
        }

26. Example

View license
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);
                }
            }
        }

27. Example

Project: MailSystem.NET
Source File: MenuItemVS.cs
View license
public void DrawIcon(Graphics g, Image icon, Rectangle bounds, bool selected, bool enabled, bool isChecked)
		{
			// make icon transparent
			Color transparentColor  = Color.FromArgb(0, 128, 128);
			Bitmap tempIcon = (Bitmap)icon;
			tempIcon.MakeTransparent(transparentColor);

			int iconTop = bounds.Top + (itemHeight - BITMAP_SIZE)/2;
			int iconLeft = bounds.Left + ( STRIPE_WIDTH - BITMAP_SIZE)/2;
			if (enabled) 
			{
				if (selected) 
				{
					if ( isChecked ) 
					{
						DrawCheckedRectangle(g, bounds);
						g.DrawImage(icon, iconLeft + 1, iconTop);
					}
					else 
					{
						ControlPaint.DrawImageDisabled(g, icon, iconLeft + 1, iconTop, Color.Black);
						g.DrawImage(icon, iconLeft, iconTop-1);
					}
				} 
				else 
				{
					if ( isChecked ) 
						DrawCheckedRectangle(g, bounds);
					g.DrawImage(icon, iconLeft + 1, iconTop);
				}
			} 
			else 
			{
				ControlPaint.DrawImageDisabled(g, icon, iconLeft + 1, iconTop, SystemColors.HighlightText);
			}
		}

28. Example

Project: MailSystem.NET
Source File: MenuItemVS.cs
View license
public void DrawIcon(Graphics g, Image icon, Rectangle bounds, bool selected, bool enabled, bool isChecked)
		{
			// make icon transparent
			Color transparentColor  = Color.FromArgb(0, 128, 128);
			Bitmap tempIcon = (Bitmap)icon;
			tempIcon.MakeTransparent(transparentColor);

			int iconTop = bounds.Top + (itemHeight - BITMAP_SIZE)/2;
			int iconLeft = bounds.Left + ( STRIPE_WIDTH - BITMAP_SIZE)/2;
			if (enabled) 
			{
				if (selected) 
				{
					if ( isChecked ) 
					{
						DrawCheckedRectangle(g, bounds);
						g.DrawImage(icon, iconLeft + 1, iconTop);
					}
					else 
					{
						ControlPaint.DrawImageDisabled(g, icon, iconLeft + 1, iconTop, Color.Black);
						g.DrawImage(icon, iconLeft, iconTop-1);
					}
				} 
				else 
				{
					if ( isChecked ) 
						DrawCheckedRectangle(g, bounds);
					g.DrawImage(icon, iconLeft + 1, iconTop);
				}
			} 
			else 
			{
				ControlPaint.DrawImageDisabled(g, icon, iconLeft + 1, iconTop, SystemColors.HighlightText);
			}
		}

29. Example

Project: ynoteclassic
Source File: InertButton.cs
View license
private void DrawImage(Graphics g)
        {
            Image image = Enabled ? ImageEnabled : ((Im/n ..... /n //View Source file for more details /n }

30. Example

Project: SquareOne
Source File: InertButton.cs
View license
private void DrawImage(Graphics g)
        {
            Image image = this.Enabled ? ImageEnabled :/n ..... /n //View Source file for more details /n }

31. Example

Project: SquareOne
Source File: Renderers.cs
View license
protected virtual int DrawImage(Graphics g, Rectangle r, Object imageSelector) {
            if (ima/n ..... /n //View Source file for more details /n }

32. Example

Project: SharpBoot
Source File: SplitButton.cs
View license
private void PaintTextandImage(Graphics g, Rectangle bounds)
        {
            // Figure out where our text and image should go
            Rectangle text_rectangle;
            Rectangle image_rectangle;

            CalculateButtonTextAndImageLayout(ref bounds, out text_rectangle, out image_rectangle);

            //draw the image
            if (Image != null)
            {
                if (Enabled)
                    g.DrawImage(Image, image_rectangle.X, image_rectangle.Y, Image.Width, Image.Height);
                else
                    ControlPaint.DrawImageDisabled(g, Image, image_rectangle.X, image_rectangle.Y, BackColor);
            }

            // If we dont' use mnemonic, set formatFlag to NoPrefix as this will show ampersand.
            if (!UseMnemonic)
                textFormatFlags = textFormatFlags | TextFormatFlags.NoPrefix;
            else if (!ShowKeyboardCues)
                textFormatFlags = textFormatFlags | TextFormatFlags.HidePrefix;

            //draw the text
            if (!string.IsNullOrEmpty(Text))
            {
                TextRenderer.DrawText(g, Text, Font, text_rectangle, Enabled ? ForeColor : SystemColors.ControlDark,
                        textFormatFlags);
            }
        }

33. Example

Project: ceptr
Source File: InertButton.cs
View license
private void DrawImage(Graphics g)
		{
			Image image = this.Enabled ? ImageEnabled : ((ImageDisable/n ..... /n //View Source file for more details /n }

34. Example

Project: HOPE
Source File: InertButton.cs
View license
private void DrawImage(Graphics g)
		{
			Image image = this.Enabled ? ImageEnabled : ((ImageDisable/n ..... /n //View Source file for more details /n }

35. Example

Project: gitextensions
Source File: SplitButton.cs
View license
private void PaintTextandImage(Graphics g, Rectangle bounds)
        {
            // Figure out where our text and image should go
            Rectangle text_rectangle;
            Rectangle image_rectangle;

            CalculateButtonTextAndImageLayout(ref bounds, out text_rectangle, out image_rectangle);

            //draw the image
            if (Image != null)
            {
                if (Enabled)
                    g.DrawImage(Image, image_rectangle.X, image_rectangle.Y, Image.Width, Image.Height);
                else
                    ControlPaint.DrawImageDisabled(g, Image, image_rectangle.X, image_rectangle.Y, BackColor);
            }

            // If we dont' use mnemonic, set formatFlag to NoPrefix as this will show ampersand.
            if (!UseMnemonic)
                textFormatFlags = textFormatFlags | TextFormatFlags.NoPrefix;
            else if (!ShowKeyboardCues)
                textFormatFlags = textFormatFlags | TextFormatFlags.HidePrefix;

            //draw the text
            if (!string.IsNullOrEmpty(Text))
            {
                if (Enabled)
                    TextRenderer.DrawText(g, Text, Font, text_rectangle, ForeColor, textFormatFlags);
                else
                    ControlPaint.DrawStringDisabled(g, Text, Font, BackColor, text_rectangle, textFormatFlags);
            }
        }

36. Example

Project: MapViewer
Source File: Renderers.cs
View license
protected virtual int DrawImage(Graphics g, Rectangle r, Object imageSelector) {
            if (ima/n ..... /n //View Source file for more details /n }

37. Example

Project: bdhero
Source File: SplitButton.cs
View license
private void PaintTextandImage(Graphics g, Rectangle bounds)
        {
            // Figure out where our text and image should go
            Rectangle text_rectangle;
            Rectangle image_rectangle;

            CalculateButtonTextAndImageLayout(ref bounds, out text_rectangle, out image_rectangle);

            //draw the image
            if (Image != null)
            {
                if (Enabled)
                    g.DrawImage(Image, image_rectangle.X, image_rectangle.Y, Image.Width, Image.Height);
                else
                    ControlPaint.DrawImageDisabled(g, Image, image_rectangle.X, image_rectangle.Y, BackColor);
            }

            // If we dont' use mnemonic, set formatFlag to NoPrefix as this will show ampersand.
            if (!UseMnemonic)
                textFormatFlags = textFormatFlags | TextFormatFlags.NoPrefix;
            else if (!ShowKeyboardCues)
                textFormatFlags = textFormatFlags | TextFormatFlags.HidePrefix;

            //draw the text
            if (!string.IsNullOrEmpty(Text))
            {
                if (Enabled)
                    TextRenderer.DrawText(g, Text, Font, text_rectangle, ForeColor, textFormatFlags);
                else
                    ControlPaint.DrawStringDisabled(g, Text, Font, BackColor, text_rectangle, textFormatFlags);
            }
        }

38. Example

Project: chummer5a
Source File: SplitButton.cs
View license
private void PaintTextandImage(Graphics g, Rectangle bounds)
    {
        // Figure out where our text and image should go
        Rectangle text_rectangle;
        Rectangle image_rectangle;

        CalculateButtonTextAndImageLayout(ref bounds, out text_rectangle, out image_rectangle);

        //draw the image
        if (Image != null)
        {
            if (Enabled)
                g.DrawImage(Image, image_rectangle.X, image_rectangle.Y, Image.Width, Image.Height);
            else
                ControlPaint.DrawImageDisabled(g, Image, image_rectangle.X, image_rectangle.Y, BackColor);
        }

        // If we dont' use mnemonic, set formatFlag to NoPrefix as this will show ampersand.
        if (!UseMnemonic)
            _textFormatFlags = _textFormatFlags | TextFormatFlags.NoPrefix;
        else if (!ShowKeyboardCues)
            _textFormatFlags = _textFormatFlags | TextFormatFlags.HidePrefix;

        //draw the text
        if (!string.IsNullOrEmpty(Text))
        {
            if (Enabled)
                TextRenderer.DrawText(g, Text, Font, text_rectangle, ForeColor, _textFormatFlags);
            else
                ControlPaint.DrawStringDisabled(g, Text, Font, BackColor, text_rectangle, _textFormatFlags);
        }
    }

39. Example

Project: naps2
Source File: ToolStripDoubleButton.cs
View license
protected override void OnPaint(PaintEventArgs e)
        {
            if (Owner == null)
         /n ..... /n //View Source file for more details /n }

40. Example

Project: MapViewer
Source File: Renderers.cs
View license
protected virtual int DrawImages(Graphics g, Rectangle r, ICollection imageSelectors) {
            // Collect the non-null images
            List<Image> images = new List<Image>();
            foreach (Object selector in imageSelectors) {
                Image image = this.GetImage(selector);
                if (image != null)
                    images.Add(image);
            }

            // Figure out how much space they will occupy
            int width = 0;
            int height = 0;
            foreach (Image image in images) {
                width += (image.Width + this.Spacing);
                height = Math.Max(height, image.Height);
            }

            // Align the collection of images within the cell
            Rectangle r2 = this.AlignRectangle(r, new Rectangle(0, 0, width, height));

            // Finally, draw all the images in their correct location
            Color backgroundColor = GetBackgroundColor();
            Point pt = r2.Location;
            foreach (Image image in images) {
                if (this.ListItem.Enabled)
                    g.DrawImage(image, pt);
                else
                    ControlPaint.DrawImageDisabled(g, image, pt.X, pt.Y, backgroundColor);
                pt.X += (image.Width + this.Spacing);
            }

            // Return the width that the images occupy
            return width;
        }

41. Example

Project: ElectronicObserver
Source File: ImageLabel.cs
View license
protected override void OnPaint(PaintEventArgs e)
		{

			Rectangle basearea = new Rectangle(Padding/n ..... /n //View Source file for more details /n }

42. Example

Project: logwizard
Source File: Renderers.cs
View license
protected virtual int DrawImages(Graphics g, Rectangle r, ICollection imageSelectors) {
            // Collect the non-null images
            List<Image> images = new List<Image>();
            foreach (Object selector in imageSelectors) {
                Image image = this.GetImage(selector);
                if (image != null)
                    images.Add(image);
            }

            // Figure out how much space they will occupy
            int width = 0;
            int height = 0;
            foreach (Image image in images) {
                width += (image.Width + this.Spacing);
                height = Math.Max(height, image.Height);
            }

            // Align the collection of images within the cell
            Rectangle r2 = this.AlignRectangle(r, new Rectangle(0, 0, width, height));

            // Finally, draw all the images in their correct location
            Color backgroundColor = GetBackgroundColor();
            Point pt = r2.Location;
            foreach (Image image in images) {
                if (this.ListItem.Enabled)
                    g.DrawImage(image, pt);
                else 
                    ControlPaint.DrawImageDisabled(g, image, pt.X, pt.Y, backgroundColor);
                pt.X += (image.Width + this.Spacing);
            }

            // Return the width that the images occupy
            return width;
        }

43. Example

Project: Bulk-Crap-Uninstaller
Source File: Renderers.cs
View license
protected virtual int DrawImages(Graphics g, Rectangle r, ICollection imageSelectors) {
            // Collect the non-null images
            List<Image> images = new List<Image>();
            foreach (Object selector in imageSelectors) {
                Image image = this.GetImage(selector);
                if (image != null)
                    images.Add(image);
            }

            // Figure out how much space they will occupy
            int width = 0;
            int height = 0;
            foreach (Image image in images) {
                width += (image.Width + this.Spacing);
                height = Math.Max(height, image.Height);
            }

            // Align the collection of images within the cell
            Rectangle r2 = this.AlignRectangle(r, new Rectangle(0, 0, width, height));

            // Finally, draw all the images in their correct location
            Color backgroundColor = GetBackgroundColor();
            Point pt = r2.Location;
            foreach (Image image in images) {
                if (this.ListItem.Enabled)
                    g.DrawImage(image, pt);
                else
                    ControlPaint.DrawImageDisabled(g, image, pt.X, pt.Y, backgroundColor);
                pt.X += (image.Width + this.Spacing);
            }

            // Return the width that the images occupy
            return width;
        }

44. Example

Project: Bulk-Crap-Uninstaller
Source File: Renderers.cs
View license
public override void Render(Graphics g, Rectangle r) {
            this.DrawBackground(g, r);
      /n ..... /n //View Source file for more details /n }

45. Example

Project: SquareOne
Source File: Renderers.cs
View license
protected virtual int DrawImages(Graphics g, Rectangle r, ICollection imageSelectors) {
            // Collect the non-null images
            List<Image> images = new List<Image>();
            foreach (Object selector in imageSelectors) {
                Image image = this.GetImage(selector);
                if (image != null)
                    images.Add(image);
            }

            // Figure out how much space they will occupy
            int width = 0;
            int height = 0;
            foreach (Image image in images) {
                width += (image.Width + this.Spacing);
                height = Math.Max(height, image.Height);
            }

            // Align the collection of images within the cell
            Rectangle r2 = this.AlignRectangle(r, new Rectangle(0, 0, width, height));

            // Finally, draw all the images in their correct location
            Color backgroundColor = GetBackgroundColor();
            Point pt = r2.Location;
            foreach (Image image in images) {
                if (this.ListItem.Enabled)
                    g.DrawImage(image, pt);
                else 
                    ControlPaint.DrawImageDisabled(g, image, pt.X, pt.Y, backgroundColor);
                pt.X += (image.Width + this.Spacing);
            }

            // Return the width that the images occupy
            return width;
        }

46. Example

Project: MapViewer
Source File: Renderers.cs
View license
public override void Render(Graphics g, Rectangle r) {
            this.DrawBackground(g, r);
      /n ..... /n //View Source file for more details /n }

47. Example

Project: logwizard
Source File: Renderers.cs
View license
public override void Render(Graphics g, Rectangle r) {
            this.DrawBackground(g, r);
      /n ..... /n //View Source file for more details /n }

48. Example

Project: SquareOne
Source File: Renderers.cs
View license
public override void Render(Graphics g, Rectangle r) {
            this.DrawBackground(g, r);
      /n ..... /n //View Source file for more details /n }

49. Example

Project: MailSystem.NET
Source File: ButtonXP.cs
View license
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
		{
			SolidBrush				_brush01/n ..... /n //View Source file for more details /n }

50. Example

Project: MailSystem.NET
Source File: ButtonXP.cs
View license
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
		{
			SolidBrush				_brush01/n ..... /n //View Source file for more details /n }