System.Windows.Forms.VisualStyles.VisualStyleRenderer.DrawBackground Method

Draws the background image of the current visual style element within the specified bounding rectangle and clipped to the specified clipping rectangle.

Syntax

public void DrawBackground (System.Drawing.IDeviceContext dc, System.Drawing.Rectangle bounds, System.Drawing.Rectangle clipRectangle)

Parameters

dc
The System.Drawing.IDeviceContext used to draw the background image.
bounds
A System.Drawing.Rectangle in which the background image is drawn.
clipRectangle
A System.Drawing.Rectangle that defines a clipping rectangle for the drawing operation.

Remarks

This method draws the background of the current visual style element specified by the VisualStyleRenderer.Class, VisualStyleRenderer.Part, and VisualStyleRenderer.State properties. The background will be clipped to the area specified by the clipRectangle parameter.

If the System.Drawing.Rectangle.Width or System.Drawing.Rectangle.Height of the rectangle specified by either the bounds or clipRectangle parameters is less than 0, the VisualStyleRenderer.DrawBackground(System.Drawing.IDeviceContext, System.Drawing.Rectangle, System.Drawing.Rectangle) method will return without drawing the background.

The background of a visual style element can be a bitmap file or a filled border. To determine the background type, call the VisualStyleRenderer.GetEnumValue(EnumProperty) method with an argument value of EnumProperty.BackgroundType. To determine whether the element background will scale to fit the specified bounds, call the VisualStyleRenderer.GetEnumValue(EnumProperty) method with an argument value of EnumProperty.SizingType.

Requirements

Namespace: System.Windows.Forms.VisualStyles
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0