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

TToolButton.Paint

Draws the tool bar button to the Canvas for the control.

Declaration

Source position: comctrls.pp line 2146

protected procedure TToolButton.Paint; override;

Description

Paint is an overridden method in TToolButton, and provides nested routines used to draw the the tool button using the style, caption, and image for the control. Paint requires ToolBar to be assigned before it can render the button control using the routines in the overridden method. When ToolBar is unassigned, only the inherited Paint method is called.

Paint calculates the area display area for the button, and calls GetButtonDrawDetail to get the theme element details for the control.

When an OnPaintButton event handler has been assigned for the ToolBar, it is used to render the button using theme details. No additional actions are performed in the method.

When OnPaintButton is unassigned, the default drawing routines are used to render the button on the Canvas for the control. This includes decorations like a drop-down indicator, an image using the required state, and dividers or separators for the button. Space is reserved as padding between the icon and text on the control (when both are used). The value in the cHorIconTextDist or cVerIconTextDist constant is scaled to the PPI setting for the control Font, and applied to the text position based on the setting in List. cHorIconTextDist is used when List is True. Methods in ThemeServices are called to render the control to the Handle for the Canvas.

Paint calls the inherited method prior to exit to signal the OnPaint event handler (when assigned).

See also

TToolBar

  

Implements an application tool bar with buttons or other visual controls.

TGraphicControl.Canvas

  

A clipped window into the parent Canvas.

TGraphicControl.Paint

  

Implements the default handler used to draw the control.

TGraphicControl.OnPaint

  

Event handler signalled to paint the control.

TThemeServices.GetElementDetails

  

Fills members in the theme element details.

TThemeServices.DrawElement

  

Draws a theme element using the specified theme element details.

TThemedElementDetails

  

Record type with a theme element, part, and state values.

ThemeServices

  

Provides access to the Theme Services singleton for the widgetset.


Version 3.2 Generated 2024-02-25 Home