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

Draws the background image of the current visual style element within the specified bounding rectangle.

Syntax

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

Parameters

dc
The System.Drawing.IDeviceContext used to draw the background image.
bounds
A System.Drawing.Rectangle in which the background image is drawn.

Remarks

This method draws the background of the current visual style element specified by the VisualStyleRenderer.Class, VisualStyleRenderer.Part, and VisualStyleRenderer.State properties.

If the System.Drawing.Rectangle.Width or System.Drawing.Rectangle.Height of the rectangle specified by the bounds parameter is less than 0, the VisualStyleRenderer.DrawBackground(System.Drawing.IDeviceContext, 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