VisualStyleRenderer.DrawImage Method

Definition

Draws the specified image within the specified bounding rectangle.

Overloads

DrawImage(Graphics, Rectangle, Image)

Draws the specified image within the specified bounds.

DrawImage(Graphics, Rectangle, ImageList, Int32)

Draws the image from the specified ImageList within the specified bounds.

DrawImage(Graphics, Rectangle, Image)

Draws the specified image within the specified bounds.

public void DrawImage (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Drawing.Image image);

Parameters

g
Graphics

The Graphics used to draw the image.

bounds
Rectangle

A Rectangle in which the image is drawn.

image
Image

The Image to draw.

Exceptions

g or image is null.

Remarks

If the visual style applies one of the effects specified by the System.Windows.Forms.VisualStyles.IconEffect values to the current element, this method will apply the effect to the drawn image.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

DrawImage(Graphics, Rectangle, ImageList, Int32)

Draws the image from the specified ImageList within the specified bounds.

public void DrawImage (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.ImageList imageList, int imageIndex);

Parameters

g
Graphics

The Graphics used to draw the image.

bounds
Rectangle

A Rectangle in which the image is drawn.

imageList
ImageList

An ImageList that contains the Image to draw.

imageIndex
Int32

The index of the Image within imageList to draw.

Exceptions

g or image is null.

imageIndex is less than 0, or greater than or equal to the number of images in imageList.

Remarks

If the visual style applies one of the effects specified by the System.Windows.Forms.VisualStyles.IconEffect values to the current element, this method will apply the effect to the drawn image.

Applies to

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9