menu

WinForms

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

    Show / Hide Table of Contents

    Class ImagePainter

    Represents a class that provides the various options for drawing the images and icons.

    Inheritance
    System.Object
    ImagePainter
    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.Core.WinForms.dll
    Syntax
    public class ImagePainter

    Constructors

    ImagePainter(String, Assembly)

    Initializes a new instance of the ImagePainter class, with manifestPrefix and a reference to the assembly to load bitmaps from.

    Declaration
    public ImagePainter(string manifestPrefix, Assembly ass)
    Parameters
    Type Name Description
    System.String manifestPrefix

    The manifest to load from. The bitmaps should be saved in the Resources tree in the Visual Studio project with the build action set to "Embedded Resource".

    System.Reflection.Assembly ass

    The assembly to load from. The bitmaps should be saved in the Resources tree in Visual Studio project with the build action set to "Embedded Resource".

    Methods

    DrawGrayedImage(Graphics, Image, Rectangle, RectangleF)

    Draws the grayed image from source rectangle to destination rectangle.

    Declaration
    public static void DrawGrayedImage(Graphics graphics, Image image, Rectangle destRect, RectangleF srcRect)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A System.Drawing.Graphics context.

    System.Drawing.Image image

    A System.Drawing.Image context.

    System.Drawing.Rectangle destRect

    The destination rectangle.

    System.Drawing.RectangleF srcRect

    The source rectangle.

    DrawGrayedImage(Graphics, Image, Rectangle, RectangleF, Single)

    Draws the grayed image from source rectangle to destination rectangle based on the gray Scale value.

    Declaration
    public static void DrawGrayedImage(Graphics graphics, Image image, Rectangle destRect, RectangleF srcRect, float grayScale)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A System.Drawing.Graphics context.

    System.Drawing.Image image

    A System.Drawing.Image context.

    System.Drawing.Rectangle destRect

    The destination rectangle.

    System.Drawing.RectangleF srcRect

    The source rectangle.

    System.Single grayScale

    The gray scale value.

    DrawGrayedImage(Graphics, Image, Int32, Int32)

    Draws the grayed image at the specified coordinates.

    Declaration
    public static void DrawGrayedImage(Graphics graphics, Image image, int left, int top)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A System.Drawing.Graphics context.

    System.Drawing.Image image

    A System.Drawing.Image context.

    System.Int32 left

    The integer value indicates the left position of the image.

    System.Int32 top

    The integer value indicates the top position of the image.

    DrawGrayedImage(Graphics, Image, Int32, Int32, Single)

    Draws the image based on the greyScale value.

    Declaration
    public static void DrawGrayedImage(Graphics graphics, Image image, int left, int top, float grayScale)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A System.Drawing.Graphics context.

    System.Drawing.Image image

    A System.Drawing.Image context.

    System.Int32 left

    The integer value indicates the left position of the image.

    System.Int32 top

    The integer value indicates the top position of the image.

    System.Single grayScale

    The float value indicates the gray scale value of the image.

    DrawIcon(IntPtr, Icon, Rectangle)

    Draws the image represented by the specified System.Drawing.Icon within the area specified by a System.Drawing.Rectangle structure.

    Declaration
    public static void DrawIcon(IntPtr hdc, Icon icon, Rectangle rect)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Drawing.Icon icon

    A System.Drawing.Icon context.

    System.Drawing.Rectangle rect

    A System.Drawing.Rectangle context.

    DrawImage(Graphics, Image, ImageLayout, Rectangle, Point, RightToLeft)

    Draws the image on the given graphics based on the image layout type and rectangle values.

    Declaration
    public static void DrawImage(Graphics graphics, Image image, ImageLayout imageLayout, Rectangle clientRect, Point offset, RightToLeft rightToLeft)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A graphics object used to draw the image.

    System.Drawing.Image image

    A image used to draw on the graphics.

    System.Windows.Forms.ImageLayout imageLayout

    Image layout of the image to draw.

    System.Drawing.Rectangle clientRect

    A rectangle area where need to draw the image.

    System.Drawing.Point offset

    The offset value used to adjust the image location.

    System.Windows.Forms.RightToLeft rightToLeft

    A boolean value indicates the right to left mode.

    DrawImage(Graphics, Image, ImageLayout, Rectangle, Point, RightToLeft, ImageAttributes)

    Draws the image on the given graphics based on the image layout type, rectangle and image attribute values.

    Declaration
    public static void DrawImage(Graphics graphics, Image image, ImageLayout imageLayout, Rectangle clientRect, Point offset, RightToLeft rightToLeft, ImageAttributes imageAttributes)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A graphics object used to draw the image.

    System.Drawing.Image image

    A image value.

    System.Windows.Forms.ImageLayout imageLayout

    Image layout of the image.

    System.Drawing.Rectangle clientRect

    A rectangle area where need to draw the image.

    System.Drawing.Point offset

    The offset value.

    System.Windows.Forms.RightToLeft rightToLeft

    A boolean value indicates the right to left mode.

    System.Drawing.Imaging.ImageAttributes imageAttributes

    A image attribute value.

    DrawImage(Graphics, Rectangle, Point, Bitmap, Color)

    Paints the bitmap by substituting black pixels with a new color.

    Declaration
    public static Rectangle DrawImage(Graphics graphics, Rectangle bounds, Point offset, Bitmap bmp, Color newColor)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A graphics object used to draw the bitmap.

    System.Drawing.Rectangle bounds

    A rectangle which contains the boundary data.

    System.Drawing.Point offset

    A point that specifies pixels to offset the bitmap from its origin point.

    System.Drawing.Bitmap bmp

    The bitmap to be drawn on the screen.

    System.Drawing.Color newColor

    The new color used to substitute black pixels.

    Returns
    Type Description
    System.Drawing.Rectangle

    Returns a rectangle which contains the boundary data of the drawn bitmap.

    DrawImage(Graphics, Rectangle, Point, Bitmap, Color, Color)

    Paints the bitmap by substituting old color with a new color.

    Declaration
    public static Rectangle DrawImage(Graphics graphics, Rectangle bounds, Point offset, Bitmap bmp, Color newColor, Color oldColor)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A graphics object used to draw the bitmap.

    System.Drawing.Rectangle bounds

    A rectangle which contains the boundary data.

    System.Drawing.Point offset

    A point that specifies pixels to offset the bitmap from its origin point.

    System.Drawing.Bitmap bmp

    The bitmap to be drawn on the screen.

    System.Drawing.Color newColor

    The new color used to substitute old color.

    System.Drawing.Color oldColor

    The old color value.

    Returns
    Type Description
    System.Drawing.Rectangle

    A rectangle which contains the boundary data of the drawn bitmap.

    DrawImage(Graphics, Rectangle, Point, String, Color)

    Loads the bitmap from the manifest and paints it by substituting black pixels with a new color.

    Declaration
    public void DrawImage(Graphics graphics, Rectangle bounds, Point offset, string bitmapName, Color newColor)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A graphics object used to draw the bitmap.

    System.Drawing.Rectangle bounds

    A rectangle which contains the boundary data.

    System.Drawing.Point offset

    A point that specifies pixel to offset the bitmap from its origin point.

    System.String bitmapName

    The name of the bitmap.

    System.Drawing.Color newColor

    The new color used to substitute black pixels.

    DrawImage(Graphics, Rectangle, Point, String, Color, Color)

    Loads the bitmap from the manifest and paints it by substituting old color with a new color.

    Declaration
    public void DrawImage(Graphics graphics, Rectangle bounds, Point offset, string bitmapName, Color newColor, Color oldColor)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A graphics object used to draw the bitmap.

    System.Drawing.Rectangle bounds

    A rectangle which contains the boundary data.

    System.Drawing.Point offset

    A point that specifies pixel to offset the bitmap from its origin point.

    System.String bitmapName

    The name of the bitmap.

    System.Drawing.Color newColor

    The new color used to substitute black pixels.

    System.Drawing.Color oldColor

    The old color value.

    DrawImage(IntPtr, Image, Rectangle)

    Draws an image to graphics context using the native methods.

    Declaration
    public static void DrawImage(IntPtr hdc, Image image, Rectangle rect)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Drawing.Image image

    A System.Drawing.Image value.

    System.Drawing.Rectangle rect

    A System.Drawing.Rectangle context.

    DrawImageFromImageList(IntPtr, ImageList, Int32, Rectangle)

    Draws an image from the System.Windows.Forms.ImageList based on the specified index.

    Declaration
    public static void DrawImageFromImageList(IntPtr hdc, ImageList imageList, int index, Rectangle rect)
    Parameters
    Type Name Description
    System.IntPtr hdc

    A handle to the device context.

    System.Windows.Forms.ImageList imageList

    The System.Windows.Forms.ImageList containing the images.

    System.Int32 index

    The index of the image.

    System.Drawing.Rectangle rect

    The rectangle into which to draw.

    DrawRotatedImage(Graphics, Bitmap, Single, Rectangle)

    Draws the rotated image at specified location based on the angle information.

    Declaration
    public static void DrawRotatedImage(Graphics gr, Bitmap bitmap, float angle, Rectangle rect)
    Parameters
    Type Name Description
    System.Drawing.Graphics gr

    A System.Drawing.Graphics context.

    System.Drawing.Bitmap bitmap

    A System.Drawing.Bitmap context.

    System.Single angle

    A angle value.

    System.Drawing.Rectangle rect

    A System.Drawing.Rectangle value.

    DrawShadowImage(Graphics, Image, Point, Single, Int32, ShadowOption)

    Draws the image with shadow at specified position based on the shadowScale and shadowOffset values.

    Declaration
    public static void DrawShadowImage(Graphics graphics, Image image, Point point, float shadowScale, int shadowOffset, ShadowOption options)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A System.Drawing.Graphics context.

    System.Drawing.Image image

    A System.Drawing.Image context.

    System.Drawing.Point point

    A point value holds the image location.

    System.Single shadowScale

    A shadow scale value used to specify the shadow level.The shadowScale should be in the range 0 to 1.

    System.Int32 shadowOffset

    A shadow offset value.

    ShadowOption options

    A ShadowOption specifies options to draw shadow.

    DrawShadowImage(Graphics, Image, Rectangle, Single, Int32, ShadowOption)

    Draws the image with shadow at specified coordinates based on the shadowScale and shadowOffset values.

    Declaration
    public static void DrawShadowImage(Graphics graphics, Image image, Rectangle rectange, float shadowScale, int shadowOffset, ShadowOption options)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A System.Drawing.Graphics context.

    System.Drawing.Image image

    A System.Drawing.Image context.

    System.Drawing.Rectangle rectange

    A System.Drawing.Rectangle context.

    System.Single shadowScale

    A shadow scale value used to specify the shadow level.The shadowScale should be in the range 0 to 1.

    System.Int32 shadowOffset

    A shadow offset value. This value is must be greater than zero.

    ShadowOption options

    A ShadowOption value.

    DrawShadowImage(Graphics, Image, Int32, Int32, Int32, Int32, Single, Int32, ShadowOption)

    Draws the image with shadow at specified coordinates based on the shadowScale and shadowOffset values.

    Declaration
    public static void DrawShadowImage(Graphics graphics, Image image, int x, int y, int width, int height, float shadowScale, int shadowOffset, ShadowOption options)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A System.Drawing.Graphics context.

    System.Drawing.Image image

    A System.Drawing.Image context.

    System.Int32 x

    The integer value indicates the left position of the image.

    System.Int32 y

    The integer value indicates the top position of the image.

    System.Int32 width

    The integer value indicates the width of the image.

    System.Int32 height

    The integer value indicates the height of the image.

    System.Single shadowScale

    A shadow scale value used to specify the shadow level.The shadow scale should be in the range 0 to 1.

    System.Int32 shadowOffset

    A shadow offset value.

    ShadowOption options

    A ShadowOption specifies options to draw shadow.

    DrawTransparentImage(Graphics, Point, Image, Single)

    Draws the transparent image at specified position based on the transparency value.

    Declaration
    public static void DrawTransparentImage(Graphics graphics, Point point, Image image, float transparency)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A System.Drawing.Graphics context.

    System.Drawing.Point point

    A System.Drawing.Point context.

    System.Drawing.Image image

    A System.Drawing.Image context.

    System.Single transparency

    A transparency value. The transparency should be in the range 0 to 1.

    DrawTransparentImage(Graphics, Rectangle, Image, Single)

    Draws the transparent image at specified rectangle based on the transparency value.

    Declaration
    public static void DrawTransparentImage(Graphics graphics, Rectangle rect, Image image, float transparency)
    Parameters
    Type Name Description
    System.Drawing.Graphics graphics

    A System.Drawing.Graphics context.

    System.Drawing.Rectangle rect

    A System.Drawing.Rectangle context.

    System.Drawing.Image image

    A System.Drawing.Image context.

    System.Single transparency

    A transparency value. The transparency should be in the range 0 to 1.

    GetBitmap(String)

    Gets a bitmap from cache or loads bitmap from manifest on first use.

    Declaration
    public Bitmap GetBitmap(string bitmapName)
    Parameters
    Type Name Description
    System.String bitmapName

    The bitmap name.

    Returns
    Type Description
    System.Drawing.Bitmap

    Reference to bitmap; NULL if bitmap failed to load.

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