Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Docking Frame Custom Painting Sample

  • 2 minutes to read

You have the following options to paint a docking frame that is displayed during docking operations:

  • Fill this frame with the clHighlight system color. To do this, set the doFillDockingSelection flag in the Options property of a docking controller or manager).

  • Custom paint the docking frame by handling the docking manager’s OnCustomDrawDockingSelection event.

  • Custom paint the docking frame for an individual dock control by handling only the control’s OnCustomDrawDockingSelection event.

Refer to the Docking Frame and Resizing Bar Custom Painting topic, for basic information about these events.

The following sample code handles the OnCustomDrawDockingSelection event of the docking manager. If the potential state of the dock control is floating, the docking frame is painted by default. Otherwise, the potential position of the dock control is filled with an inverse solid brush.

Delphi
procedure TForm1.dxDockingManager1CustomDrawDockingSelection(Sender: TdxCustomDockControl; DC: HDC; Zone: TdxZone; ARect: TRect; Erasing: Boolean; var Handled: Boolean);
var
  ABrush, AOldBrush: HBRUSH;
begin
  if Zone = nil then Exit;
  ABrush := CreateSolidBrush($FFFFFF);
  AOldBrush := SelectObject(DC, ABrush);
  try
    with ARect do
      PatBlt(DC, Left, Top, Right - Left, Bottom - Top, PATINVERT);
    Handled := True;
  finally
    SelectObject(DC, AOldBrush);
    DeleteObject(ABrush);
  end;
end;

The image below illustrates a docking operation when the event is handled in this manner.

See Also