Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

VisualStyleRenderer.DrawBackground Method (IDeviceContext, Rectangle, Rectangle)

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

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

public void DrawBackground(
	IDeviceContext dc,
	Rectangle bounds,
	Rectangle clipRectangle
)

Parameters

dc
Type: System.Drawing.IDeviceContext

The IDeviceContext used to draw the background image.

bounds
Type: System.Drawing.Rectangle

A Rectangle in which the background image is drawn.

clipRectangle
Type: System.Drawing.Rectangle

A Rectangle that defines a clipping rectangle for the drawing operation.

ExceptionCondition
ArgumentNullException

dc is null.

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

If the Width or Height of the rectangle specified by either the bounds or clipRectangle parameters is less than 0, the DrawBackground 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 GetEnumValue method with an argument value of EnumProperty.BackgroundType. To determine whether the element background will scale to fit the specified bounds, call the GetEnumValue method with an argument value of EnumProperty.SizingType.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft