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.

Exception Condition
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
Available since 2.0
Return to top
Show: