VisualStyleRenderer.DrawImage Method (Graphics, Rectangle, ImageList, Int32)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.Windows.Forms.VisualStyles
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public void DrawImage(
	Graphics g,
	Rectangle bounds,
	ImageList imageList,
	int imageIndex
)

Parameters

g
Type: System.Drawing.Graphics

The Graphics used to draw the image.

bounds
Type: System.Drawing.Rectangle

A Rectangle in which the image is drawn.

imageList
Type: System.Windows.Forms.ImageList

An ImageList that contains the Image to draw.

imageIndex
Type: System.Int32

The index of the Image within imageList to draw.

Exception Condition
ArgumentNullException

g or image is null.

ArgumentOutOfRangeException

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

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.

.NET Framework
Available since 2.0
Return to top
Show: