Edit

Share via


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);
public void DrawImage (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Drawing.Image image);
member this.DrawImage : System.Drawing.Graphics * System.Drawing.Rectangle * System.Drawing.Image -> unit
Public Sub DrawImage (g As Graphics, bounds As Rectangle, image As 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

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);
public void DrawImage (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.ImageList imageList, int imageIndex);
member this.DrawImage : System.Drawing.Graphics * System.Drawing.Rectangle * System.Windows.Forms.ImageList * int -> unit
Public Sub DrawImage (g As Graphics, bounds As Rectangle, imageList As ImageList, imageIndex As Integer)

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