menu

WinForms

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class BrushPainter - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class BrushPainter

    A helper class that provides the options to paints window background based on the BrushInfo information.

    Inheritance
    System.Object
    BrushPainter
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Syncfusion.WinForms.Core
    Assembly: Syncfusion.Shared.Base.dll
    Syntax
    public static class BrushPainter

    Methods

    DrawBorder(Graphics, Rectangle, BorderStyle, Border3DStyle, ButtonBorderStyle, Color)

    Draws a border based on the border style and border color information.

    Declaration
    public static void DrawBorder(Graphics g, Rectangle rc, BorderStyle borderStyle, Border3DStyle border3DStyle, ButtonBorderStyle borderSingle, Color borderColor)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Rectangle rc

    A System.Drawing.Rectangle value.

    System.Windows.Forms.BorderStyle borderStyle

    A System.Windows.Forms.BorderStyle context.

    System.Windows.Forms.Border3DStyle border3DStyle

    A System.Windows.Forms.Border3DStyle context.

    System.Windows.Forms.ButtonBorderStyle borderSingle

    A System.Windows.Forms.ButtonBorderStyle context.

    System.Drawing.Color borderColor

    A System.Drawing.Color context.

    DrawBorder(Graphics, Rectangle, BorderStyle, Border3DStyle, ButtonBorderStyle, Color, Border3DSide)

    Draws a border based on the border style and border color.

    Declaration
    public static void DrawBorder(Graphics g, Rectangle rc, BorderStyle borderStyle, Border3DStyle border3DStyle, ButtonBorderStyle borderSingle, Color borderColor, Border3DSide sides)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Rectangle rc

    A System.Drawing.Rectangle value.

    System.Windows.Forms.BorderStyle borderStyle

    A System.Windows.Forms.BorderStyle context.

    System.Windows.Forms.Border3DStyle border3DStyle

    A System.Windows.Forms.Border3DStyle used for the border style.

    System.Windows.Forms.ButtonBorderStyle borderSingle

    A System.Windows.Forms.ButtonBorderStyle context.

    System.Drawing.Color borderColor

    A System.Drawing.Color context.

    System.Windows.Forms.Border3DSide sides

    A System.Windows.Forms.Border3DStyle used for the 3-D border style.

    DrawBorder(Graphics, Rectangle, BorderStyle, Border3DStyle, ButtonBorderStyle, Color, Border3DSide, Boolean)

    Draws the borders based on the specified styles information.

    Declaration
    public static void DrawBorder(Graphics g, Rectangle rc, BorderStyle borderStyle, Border3DStyle border3DStyle, ButtonBorderStyle borderSingle, Color borderColor, Border3DSide sides, bool useTransform)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Rectangle rc

    A output rectangle.

    System.Windows.Forms.BorderStyle borderStyle

    A border style.

    System.Windows.Forms.Border3DStyle border3DStyle

    3D border style.

    System.Windows.Forms.ButtonBorderStyle borderSingle

    Border style in single mode.

    System.Drawing.Color borderColor

    Border color in single mode.

    System.Windows.Forms.Border3DSide sides

    Sides that have to be drawn by methods.

    System.Boolean useTransform

    True - fix known bug in method, otherwise leave old code (for compatibility only).

    DrawLine(IntPtr, Pen, Int32, Int32, Int32, Int32)

    Draws the line based on the position values.

    Declaration
    public static void DrawLine(IntPtr hdc, Pen pen, int x1, int y1, int x2, int y2)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Drawing.Pen pen

    A System.Drawing.Pen context

    System.Int32 x1

    Start X position

    System.Int32 y1

    Start Y position

    System.Int32 x2

    End X position

    System.Int32 y2

    End Y position

    DrawRectangle(IntPtr, Pen, Rectangle)

    Draws the rectangle based on the System.Drawing.Pen information.

    Declaration
    public static void DrawRectangle(IntPtr hdc, Pen pen, Rectangle rect)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Drawing.Pen pen

    A System.Drawing.Pen context.

    System.Drawing.Rectangle rect

    Rectangle area.

    FillGradient(Graphics, Rectangle, ArrayList)

    Fills a rectangle with gradient style based on the foreColors values.

    Declaration
    public static void FillGradient(Graphics g, Rectangle rc, ArrayList foreColors)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Rectangle rc

    A System.Drawing.Rectangle value.

    System.Collections.ArrayList foreColors

    A System.Collections.ArrayList contains the colors details.

    FillGradient(Graphics, Rectangle, ArrayList, Boolean)

    Fills a rectangle with gradient style based on the foreColors values.

    Declaration
    public static void FillGradient(Graphics g, Rectangle rc, ArrayList foreColors, bool isVerticalGradient)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Rectangle rc

    A System.Drawing.Rectangle value.

    System.Collections.ArrayList foreColors

    A System.Collections.ArrayList contains the colors details.

    System.Boolean isVerticalGradient

    Boolean value indicates to draw in vertical or horizontal.

    FillGradient(Graphics, Rectangle, Color, Color)

    Fills the gradient style to rectangle based on the color values.

    Declaration
    public static void FillGradient(Graphics g, Rectangle rc, Color color1, Color color2)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Rectangle rc

    A System.Drawing.Rectangle value.

    System.Drawing.Color color1

    A System.Drawing.Color contains the first color of gradient fill.

    System.Drawing.Color color2

    A System.Drawing.Color contains the second color the gradient fill.

    FillGradient(Graphics, Rectangle, Color, Color, Boolean)

    Fills the gradient style to rectangle based on the color values.

    Declaration
    public static void FillGradient(Graphics g, Rectangle rc, Color color1, Color color2, bool isVerticalGradient)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Rectangle rc

    A System.Drawing.Rectangle value.

    System.Drawing.Color color1

    A System.Drawing.Color contains the first color of gradient fill.

    System.Drawing.Color color2

    A System.Drawing.Color contains the second color the gradient fill.

    System.Boolean isVerticalGradient

    Boolean value indicates to draw in vertical or horizontal.

    FillGradient(IntPtr, Rectangle, Color, Color)

    Fills the gradient style to rectangle based on the color values.

    Declaration
    public static void FillGradient(IntPtr hdc, Rectangle rect, Color color1, Color color2)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Drawing.Rectangle rect

    Rectangle area.

    System.Drawing.Color color1

    Starting color of the gradient.

    System.Drawing.Color color2

    Ending color of the gradient.

    FillGradient(IntPtr, Rectangle, Color, Color, Boolean)

    Fills the gradient style to rectangle based on the color values.

    Declaration
    public static void FillGradient(IntPtr hdc, Rectangle rect, Color color1, Color color2, bool isVerticalGradient)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Drawing.Rectangle rect

    Rectangle area.

    System.Drawing.Color color1

    Starting color of the gradient.

    System.Drawing.Color color2

    Ending color of the gradient.

    System.Boolean isVerticalGradient

    Boolean value indicates to draw in vertical or horizontal.

    FillPath(Graphics, GraphicsPath, BrushInfo)

    Fills the interior of a path based on the BrushInfo information.

    Declaration
    public static void FillPath(Graphics g, GraphicsPath path, BrushInfo brush)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Drawing2D.GraphicsPath path

    A System.Drawing.Drawing2D.GraphicsPath context.

    BrushInfo brush

    A BrushInfo value.

    FillPath(Graphics, GraphicsPath, GradientStyle, Color[])

    Fills the interior of a path based on the gradient style and color values.

    Declaration
    public static void FillPath(Graphics g, GraphicsPath p, GradientStyle gradientStyle, Color[] colors)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Drawing2D.GraphicsPath p

    A System.Drawing.Drawing2D.GraphicsPath context.

    GradientStyle gradientStyle

    A GradientStyle value.

    System.Drawing.Color[] colors

    A array of the System.Drawing.Color value.

    FillPath(Graphics, GraphicsPath, Color)

    Fills the interior of path based on the System.Drawing.Color value.

    Declaration
    public static void FillPath(Graphics g, GraphicsPath path, Color color)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Drawing2D.GraphicsPath path

    A System.Drawing.Drawing2D.GraphicsPath context.

    System.Drawing.Color color

    A System.Drawing.Color value.

    FillPath(IntPtr, GraphicsPath, BrushInfo)

    Fills the interior of a path based on the BrushInfo information.

    Declaration
    public static void FillPath(IntPtr hdc, GraphicsPath path, BrushInfo brush)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Drawing.Drawing2D.GraphicsPath path

    A System.Drawing.Drawing2D.GraphicsPath context.

    BrushInfo brush

    A BrushInfo context.

    FillPath(IntPtr, GraphicsPath, Color)

    Fills the interior of a path based on the System.Drawing.Color information.

    Declaration
    public static void FillPath(IntPtr hdc, GraphicsPath path, Color color)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Drawing.Drawing2D.GraphicsPath path

    A System.Drawing.Drawing2D.GraphicsPath context.

    System.Drawing.Color color

    A System.Drawing.Colorcontext.

    FillRectangle(Graphics, Rectangle, BrushInfo)

    Fills the interior of a rectangle based on the BrushInfo information.

    Declaration
    public static void FillRectangle(Graphics g, Rectangle r, BrushInfo brush)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Rectangle r

    A System.Drawing.Rectangle structure that represents the rectangle to fill.

    BrushInfo brush

    BrushInfo object that determines the characteristics of the fill.

    FillRectangle(Graphics, Rectangle, GradientStyle, Color, Color)

    Fills the interior of a rectangle based on the gradient style information.

    Declaration
    public static void FillRectangle(Graphics g, Rectangle r, GradientStyle gradientStyle, Color foreColor, Color backColor)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Rectangle r

    A System.Drawing.Rectangle structure that represents the rectangle to fill.

    GradientStyle gradientStyle

    A GradientStyle value.

    System.Drawing.Color foreColor

    A System.Drawing.Color used for the fore color of the gradient fill.

    System.Drawing.Color backColor

    A System.Drawing.Color used for the back color gradient fill.

    FillRectangle(Graphics, Rectangle, GradientStyle, Color[])

    Fills the interior of a rectangle based on the gradient style information.

    Declaration
    public static void FillRectangle(Graphics g, Rectangle r, GradientStyle gradientStyle, Color[] colors)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context

    System.Drawing.Rectangle r

    A System.Drawing.RectangleF structure that represents the rectangle to fill.

    GradientStyle gradientStyle

    A GradientStyle value.

    System.Drawing.Color[] colors

    An array of System.Drawing.Color used for the gradient fill.

    FillRectangle(Graphics, Rectangle, PatternStyle, Color, Color)

    Fills the interior of a rectangle based on the pattern style and color values.

    Declaration
    public static void FillRectangle(Graphics g, Rectangle r, PatternStyle hatchStyle, Color foreColor, Color backColor)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context

    System.Drawing.Rectangle r

    A System.Drawing.Rectangle structure that represents the rectangle to fill.

    PatternStyle hatchStyle

    A PatternStyle information.

    System.Drawing.Color foreColor

    A System.Drawing.Color used for the fore color of pattern fill.

    System.Drawing.Color backColor

    A System.Drawing.Color used for the back color of pattern fill.

    FillRectangle(Graphics, Rectangle, Color)

    Fills the interior of a rectangle based on the color value.

    Declaration
    public static void FillRectangle(Graphics g, Rectangle r, Color color)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Rectangle r

    A System.Drawing.Rectangle structure that represents the rectangle to fill.

    System.Drawing.Color color

    A System.Drawing.Color value.

    FillRectangle(IntPtr, Rectangle, BrushInfo)

    Fills the interior of rectangle based on the BrushInfo information.

    Declaration
    public static void FillRectangle(IntPtr hdc, Rectangle r, BrushInfo brush)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Drawing.Rectangle r

    A System.Drawing.Rectangle context.

    BrushInfo brush

    A BrushInfo context.

    FillRectangle(IntPtr, Rectangle, Color)

    Fills the interior of rectangle based on the System.Drawing.Color information.

    Declaration
    public static void FillRectangle(IntPtr hdc, Rectangle r, Color color)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Drawing.Rectangle r

    A System.Drawing.Rectangle context.

    System.Drawing.Color color

    A System.Drawing.Color context.

    FillRegion(Graphics, Region, BrushInfo)

    Fills the interior of a region based on the BrushInfo information.

    Declaration
    public static void FillRegion(Graphics g, Region r, BrushInfo brush)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Region r

    A System.Drawing.Region structure that represents the region to fill.

    BrushInfo brush

    A BrushInfo object that determines the characteristics of the fill.

    FillRegion(Graphics, Region, GradientStyle, Color[])

    Fills the interior of a region based on the gradient style.

    Declaration
    public static void FillRegion(Graphics g, Region r, GradientStyle gradientStyle, Color[] colors)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Region r

    A System.Drawing.Region structure that represents the region to fill.

    GradientStyle gradientStyle

    A GradientStyle value.

    System.Drawing.Color[] colors

    An array of System.Drawing.Color used for the gradient fill.

    FillRegion(Graphics, Region, PatternStyle, Color, Color)

    Fills the interior of a region based on the PatternStyle information.

    Declaration
    public static void FillRegion(Graphics g, Region r, PatternStyle hatchStyle, Color foreColor, Color backColor)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Region r

    A System.Drawing.Region structure that represents the region to fill.

    PatternStyle hatchStyle

    A PatternStyle value.

    System.Drawing.Color foreColor

    A System.Drawing.Color used for the fore color of pattern fill.

    System.Drawing.Color backColor

    A System.Drawing.Color used for the back color of pattern fill.

    FillRegion(Graphics, Region, Color)

    Fills the interior of a region based on the color value.

    Declaration
    public static void FillRegion(Graphics g, Region r, Color color)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    A System.Drawing.Graphics context.

    System.Drawing.Region r

    A System.Drawing.Region structure that represents the region to fill.

    System.Drawing.Color color

    A System.Drawing.Color value.

    FillRegion(IntPtr, Region, BrushInfo)

    Fills the region based on the BrushInfo information.

    Declaration
    public static void FillRegion(IntPtr hdc, Region region, BrushInfo brush)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Drawing.Region region

    A System.Drawing.Region context.

    BrushInfo brush

    A BrushInfo context.

    FillRegion(IntPtr, Region, Color)

    Fills the region based on the color information.

    Declaration
    public static void FillRegion(IntPtr hdc, Region region, Color color)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Drawing.Region region

    A System.Drawing.Region context.

    System.Drawing.Color color

    A System.Drawing.Colorcontext.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved