Skip to main content

Docking Frame and Resizing Bar Custom Painting

  • 2 minutes to read

This topic explains the basic principles of custom painting docking frames and resizing bars.

Basic Principles of Painting Selections


If you need to provide custom painting for individual controls, handle their OnCustomDrawDockingSelection and OnCustomDrawResizingSelection events. If you need to provide the same painting for all dock controls in an application, handle the OnCustomDrawDockingSelection and OnCustomDrawResizingSelection events of the docking manager.

All the mentioned events have a common syntax. The code below illustrates this.

procedure(Sender: TdxCustomDockControl; DC: HDC; Zone: TdxZone; ARect: TRect; Erasing: Boolean; var Handled: Boolean);

The Zone parameter represents the dock zone when painting the docking frame. Note that if the potential state of the dock control is floating, this parameter returns nil. Thus you can provide a different appearance for the frame when it indicates floating and docked positions. To do so, you need to provide different painting algorithms when the parameter value is nil and not. Also, you can read the zone’s settings to determine the potential edge where the control will be docked if released. This enables you to provide different painting with respect to docking type.

When resizing, the Zone parameter represents the resize zone where the operation has been initiated. In this instance, the parameter value cannot be nil. You can use properties of the obtained zone to determine whether horizontal or vertical resizing is being performed.

The Erasing parameter specifies whether the selection must be painted or erased. This is needed since the selection is painted on screen directly and the previously painted selection must be erased before painting it in another position. You will not need this parameter in most cases. The reason is that it is recommended to paint selections using inverse brushes. Painting the same selection at the same position will automatically erase the previously painted selection (all colors will be double inverted and thus restored).

The Handled parameter specifies whether default painting needs to be performed. Set this parameter to True if the required painting is performed by the event handler. Note that this parameter can also be used to provide conditional custom painting. For instance, you can perform painting and set this parameter to True only when horizontal resizing is performed. In other cases, the selection will be painted by default.

See Also