VisualStyleRenderer.DrawImage 方法

定义

在指定的边框内绘制指定的图像。Draws the specified image within the specified bounding rectangle.

重载

DrawImage(Graphics, Rectangle, Image)

在指定的边界内绘制指定的图像。Draws the specified image within the specified bounds.

DrawImage(Graphics, Rectangle, ImageList, Int32)

在指定的边界内绘制指定的 ImageList 中的图像。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

参数

g
Graphics

用于绘制图像的 GraphicsThe Graphics used to draw the image.

bounds
Rectangle

在其中绘制图像的 RectangleA Rectangle in which the image is drawn.

image
Image

要绘制的 ImageThe Image to draw.

异常

gimagenullg or image is null.

注解

如果视觉样式将 System.Windows.Forms.VisualStyles.IconEffect 值指定的某个效果应用于当前元素,则此方法会将该效果应用于所绘制图像。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.

DrawImage(Graphics, Rectangle, ImageList, Int32)

在指定的边界内绘制指定的 ImageList 中的图像。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

参数

g
Graphics

用于绘制图像的 GraphicsThe Graphics used to draw the image.

bounds
Rectangle

在其中绘制图像的 RectangleA Rectangle in which the image is drawn.

imageList
ImageList

包含要绘制的 ImageListImageAn ImageList that contains the Image to draw.

imageIndex
Int32

要绘制的 ImageimageList 中的索引。The index of the Image within imageList to draw.

异常

gimagenullg or image is null.

imageIndex 小于 0,或者大于等于 imageList 中的图像数。imageIndex is less than 0, or greater than or equal to the number of images in imageList.

注解

如果视觉样式将 System.Windows.Forms.VisualStyles.IconEffect 值指定的某个效果应用于当前元素,则此方法会将该效果应用于所绘制图像。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.

适用于