[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Buttons' (#lcl)

# TCustomSpeedButton.PaintBackground

Paints the background for the control to the specified rectangle.

## Declaration

Source position: buttons.pp line 386

`protected procedure TCustomSpeedButton.PaintBackground(`
`var PaintRect: TRect`
`); virtual;`

## Arguments

`PaintRect` |  | Rectangle where the control is drawn.

## Description

PaintBackground is a method used to draw the background for the speed button control on its Canvas. When Transparent is True and the theme element has transparent areas, the value in Color is used to fill the drawing area in PaintRect.

The DrawElement method in ThemeServices is called to render the drawing area to the Canvas for the control. PaintRect is updated following the drawing operation with the reduced content rectangle (the button surface without borders/edges) needed for the control.

PaintBackground is called when the MeasureDraw method is used to render the control. The adjusted rectangle is later used in the method to calculate the drawing areas for the glyph bitmap and caption text.

## See also

TCustomSpeedButton.Color |  | The background color for the control.
TCustomSpeedButton.MeasureDraw |  | Calculates the Width and Height for the layout used on the speed button and optionally renders the control.
TCustomSpeedButton.Paint |  | Updates the state for the control, and paints it to the control Canvas.
TCustomSpeedButton.Transparent |  | Indicates if the control is drawn with transparency.
ThemeServices |  | Provides access to the Theme Services singleton for the widgetset.
TGraphicControl.Canvas |  | A clipped window into the parent Canvas.