menu

WinForms

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

    Show / Hide Table of Contents

    Class GDIUtils

    Class representing different GDI capabilities.

    Inheritance
    System.Object
    GDIUtils
    Implements
    System.IDisposable
    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.HTMLUI.Base.Utility
    Assembly: Syncfusion.HTMLUI.Base.dll
    Syntax
    public sealed class GDIUtils : IDisposable

    Constructors

    GDIUtils()

    Default constructor.

    Declaration
    public GDIUtils()

    Properties

    Dark

    Gets or sets the dark.

    Declaration
    public Color Dark { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The dark.

    DarkBrush

    Gets the dark brush.

    Declaration
    public Brush DarkBrush { get; }
    Property Value
    Type Description
    System.Drawing.Brush

    The dark brush.

    DarkDark

    Gets or sets the dark dark.

    Declaration
    public Color DarkDark { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The dark dark.

    DarkDarkBrush

    Gets the dark dark brush.

    Declaration
    public Brush DarkDarkBrush { get; }
    Property Value
    Type Description
    System.Drawing.Brush

    The dark dark brush.

    DarkDarkPen

    Gets the dark dark pen.

    Declaration
    public Pen DarkDarkPen { get; }
    Property Value
    Type Description
    System.Drawing.Pen

    The dark dark pen.

    DarkPen

    Gets the dark pen.

    Declaration
    public Pen DarkPen { get; }
    Property Value
    Type Description
    System.Drawing.Pen

    The dark pen.

    Light

    Gets or sets the light.

    Declaration
    public Color Light { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The light.

    LightBrush

    Gets the light brush.

    Declaration
    public Brush LightBrush { get; }
    Property Value
    Type Description
    System.Drawing.Brush

    The light brush.

    LightLight

    Gets or sets the light light.

    Declaration
    public Color LightLight { get; set; }
    Property Value
    Type Description
    System.Drawing.Color

    The light light.

    LightLightBrush

    Gets the light light brush.

    Declaration
    public Brush LightLightBrush { get; }
    Property Value
    Type Description
    System.Drawing.Brush

    The light light brush.

    LightLightPen

    Gets the light light pen.

    Declaration
    public Pen LightLightPen { get; }
    Property Value
    Type Description
    System.Drawing.Pen

    The light light pen.

    LightPen

    Gets the light pen.

    Declaration
    public Pen LightPen { get; }
    Property Value
    Type Description
    System.Drawing.Pen

    The light pen.

    OneLineFormat

    Gets the one line format.

    Declaration
    public static StringFormat OneLineFormat { get; }
    Property Value
    Type Description
    System.Drawing.StringFormat

    The one line format.

    OneLineNoTrimming

    Gets the one line no trimming.

    Declaration
    public static StringFormat OneLineNoTrimming { get; }
    Property Value
    Type Description
    System.Drawing.StringFormat

    The one line no trimming.

    Methods

    CalculateCenter(Rectangle, Size)

    Calculates X and Y coordinates to place object at the center of the rectangle.

    Declaration
    public static Point CalculateCenter(Rectangle rect, Size sz)
    Parameters
    Type Name Description
    System.Drawing.Rectangle rect

    Destination rectangle.

    System.Drawing.Size sz

    Object size.

    Returns
    Type Description
    System.Drawing.Point

    Point class with X and Y coordinates of center.

    Dispose()

    Destroys all pens and brushes used by the class.

    Declaration
    public void Dispose()

    Draw3DBox(Graphics, Rectangle, Canvas3DStyle)

    Draws a 3D box according to style specification. There are four styles available to draw.

    Declaration
    public void Draw3DBox(Graphics graph, Rectangle rect, Canvas3DStyle style)
    Parameters
    Type Name Description
    System.Drawing.Graphics graph

    Graphics object used for drawing.

    System.Drawing.Rectangle rect

    Box rectangle.

    Canvas3DStyle style

    Style of box.

    Draw3DLine(Graphics, Point, Point)

    Draws a 3D Line. 3D Line is a simple line which contains one dark and one light line. Using dark and light line, we create an optical 3D effect.

    Declaration
    public void Draw3DLine(Graphics graph, Point pnt1, Point pnt2)
    Parameters
    Type Name Description
    System.Drawing.Graphics graph

    Graphics object which is used by function to draw.

    System.Drawing.Point pnt1

    Start point.

    System.Drawing.Point pnt2

    End point.

    Draw3DRect(Graphics, Rectangle, Color, Color)

    Overloaded. Draws 3D-style rectangle.

    Declaration
    public static void Draw3DRect(Graphics g, Rectangle rc, Color clrTL, Color clrBR)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    Graphics canvas where rectangle must be drawn.

    System.Drawing.Rectangle rc

    Rectangle coordinates.

    System.Drawing.Color clrTL

    Color of top left corner of rectangle.

    System.Drawing.Color clrBR

    Color of bottom right corner of rectangle.

    Draw3DRect(Graphics, Int32, Int32, Int32, Int32, Color, Color)

    Draws 3D-style rectangle.

    Declaration
    public static void Draw3DRect(Graphics g, int x, int y, int width, int height, Color clrTL, Color clrBR)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    Graphics object.

    System.Int32 x

    X coordinate of top left corner of the rectangle.

    System.Int32 y

    Y coordinate of top left corner of the rectangle.

    System.Int32 width

    Width of the rectangle.

    System.Int32 height

    Height of the rectangle.

    System.Drawing.Color clrTL

    Color that is to be used for top left corner drawing.

    System.Drawing.Color clrBR

    Color that is to be used for bottom right corner drawing.

    DrawActiveRectangle(Graphics, Rectangle, HightlightStyle)

    Draws an active rectangle by blue colors.

    Declaration
    public void DrawActiveRectangle(Graphics graph, Rectangle rect, HightlightStyle state)
    Parameters
    Type Name Description
    System.Drawing.Graphics graph

    Graphic context where rectangle must be drawn.

    System.Drawing.Rectangle rect

    Destination rectangle.

    HightlightStyle state

    State of rectangle. Influence on colors by which rectangle will be drawn.

    DrawActiveRectangle(Graphics, Rectangle, HightlightStyle, Boolean)

    Draws an active rectangle.

    Declaration
    public void DrawActiveRectangle(Graphics graph, Rectangle rect, HightlightStyle state, bool bSubRect)
    Parameters
    Type Name Description
    System.Drawing.Graphics graph

    Graphic context where rectangle must be drawn.

    System.Drawing.Rectangle rect

    Destination rectangle.

    HightlightStyle state

    State of rectangle. Influence on colors by which rectangle will be drawn.

    System.Boolean bSubRect

    Indicates whether we need rectangle width and height fix.

    DrawArrowGlyph(Graphics, Rectangle, Boolean)

    Overloaded. Draws arrow glyph at the center of the rectangle. Width and height of arrow will be 5 and 3. For arrow drawing, SystemColors.Highlight color will be used. TIP: Use an odd number for the arrowWidth and arrowWidth/2+1 for the arrowHeight so that the arrow gets the same pixel number on the left and on the right and get symmetrically painted.

    Declaration
    public static void DrawArrowGlyph(Graphics g, Rectangle rc, bool up)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    Graphics object.

    System.Drawing.Rectangle rc

    Destination rectangle.

    System.Boolean up

    Direction of arrow.

    DrawArrowGlyph(Graphics, Rectangle, Boolean, Brush)

    Draws arrow glyph at the center of the rectangle. Width and height of arrow will be 5 and 3. TIP: Use an odd number for the arrowWidth and arrowWidth/2+1 for the arrowHeight so that the arrow gets the same pixel number on the left and on the right and get symmetrically painted.

    Declaration
    public static void DrawArrowGlyph(Graphics g, Rectangle rc, bool up, Brush brush)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    Graphics object.

    System.Drawing.Rectangle rc

    Destination rectangle.

    System.Boolean up

    Direction of arrow.

    System.Drawing.Brush brush

    Brush which must be used for drawing.

    DrawArrowGlyph(Graphics, Rectangle, Boolean, Color)

    Draws arrow glyph at the center of rectangle. Width and height of arrow will be 5 and 3. TIP: Use an odd number for the arrowWidth and arrowWidth/2+1 for the arrowHeight so that the arrow gets the same pixel number on the left and on the right and get symmetrically painted.

    Declaration
    public static void DrawArrowGlyph(Graphics g, Rectangle rc, bool up, Color clr)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    Graphics object.

    System.Drawing.Rectangle rc

    Destination rectangle.

    System.Boolean up

    Direction of arrow.

    System.Drawing.Color clr

    Color which must be used for drawing.

    DrawArrowGlyph(Graphics, Rectangle, Int32, Int32, Boolean, Brush)

    Draws arrow glyph at the center of the rectangle. TIP: Use an odd number for the arrowWidth and arrowWidth/2+1 for the arrowHeight so that the arrow gets the same pixel number on the left and on the right and get symmetrically painted.

    Declaration
    public static void DrawArrowGlyph(Graphics g, Rectangle rc, int width, int height, bool isUp, Brush brush)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    Graphics object

    System.Drawing.Rectangle rc

    Destination rectangle. Arrow Glyph will be placed at the center of the destination rectangle.

    System.Int32 width

    Width of arrow.

    System.Int32 height

    Height of arrow.

    System.Boolean isUp

    Direction arrow.

    System.Drawing.Brush brush

    Brush which must be used for drawing.

    DrawArrowGlyph(Graphics, Rectangle, Int32, Int32, Boolean, Color)

    Draws arrow glyph at the center of rectangle. TIP: Use an odd number for the arrowWidth and arrowWidth/2+1 for the arrowHeight so that the arrow gets the same pixel number on the left and on the right and get symmetrically painted.

    Declaration
    public static void DrawArrowGlyph(Graphics g, Rectangle rc, int width, int height, bool isUp, Color clr)
    Parameters
    Type Name Description
    System.Drawing.Graphics g

    Graphics object.

    System.Drawing.Rectangle rc

    Destination Rectangle. Arrow glyph will be placed at the center of the destination rectangle.

    System.Int32 width

    Width of arrow.

    System.Int32 height

    Height of arrow.

    System.Boolean isUp

    Direction arrow.

    System.Drawing.Color clr

    Color which must be used by arrow draw function.

    Finalize()

    Destructor.

    Declaration
    protected void Finalize()

    FixRectangleHeightWidth(Rectangle)

    Makes rectangle's width and height less on one pixel. This is useful because in some cases, a rectangle's last pixels does not show.

    Declaration
    public static Rectangle FixRectangleHeightWidth(Rectangle rect)
    Parameters
    Type Name Description
    System.Drawing.Rectangle rect

    Rectangle whose contexts must be fixed.

    Returns
    Type Description
    System.Drawing.Rectangle

    A new rectangle object which contains fixed values.

    FixRectangleHeightWidth(Int32, Int32, Int32, Int32)

    Fixes the width of the rectangle height.

    Declaration
    public static Rectangle FixRectangleHeightWidth(int x, int y, int width, int height)
    Parameters
    Type Name Description
    System.Int32 x

    The x.

    System.Int32 y

    The y.

    System.Int32 width

    The width.

    System.Int32 height

    The height.

    Returns
    Type Description
    System.Drawing.Rectangle

    A new rectangle object which contains fixed values.

    GetTileBitmap(Rectangle, Bitmap)

    Creates bitmap with specified size and infill. Bitmap sent by parameter will be used to fill destination area. If bitmap is less then destination area, it will be tiled.

    Declaration
    public static Bitmap GetTileBitmap(Rectangle rcDest, Bitmap bitmap)
    Parameters
    Type Name Description
    System.Drawing.Rectangle rcDest

    Destination size.

    System.Drawing.Bitmap bitmap

    Infill of output bitmap.

    Returns
    Type Description
    System.Drawing.Bitmap

    Returns bitmap filled by input bitmap.

    GetTileBitmap(Size, Bitmap)

    Overloaded. Creates bitmap with specified size and infill. Bitmap sent by parameter will be used to fill destination area. If bitmap is less than destination area, it will be tiled.

    Declaration
    public static Bitmap GetTileBitmap(Size sz, Bitmap bitmap)
    Parameters
    Type Name Description
    System.Drawing.Size sz
    System.Drawing.Bitmap bitmap

    Infill of output bitmap.

    Returns
    Type Description
    System.Drawing.Bitmap

    Returns bitmap filled by input bitmap.

    Implements

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