Skip to main content

TdxAlertWindowManager.OnCustomDrawBackground Event

Enables you to custom paint an alert window‘s background.

Declaration

property OnCustomDrawBackground: TdxAlertWindowManagerCustomDrawBackgroundEvent read; write;

Remarks

Sender specifies the alert window manager that fired the event.

AAlertWindow specifies the alert window being custom painted.

ACanvas specifies the drawing surface.

AViewInfo provides ViewInfo information (a TdxAlertWindowViewInfo class instance) used to paint the alert window’s background. Refer to the TdxAlertWindowHitTest.HitBackground property description to learn about the main TdxAlertWindowViewInfo properties accessible via AViewInfo that you can use for custom painting.

ADone specifies whether default painting is required. Set ADone to True, to prevent default code execution.

The following code snippet demonstrates how to handle the OnCustomDrawBackground event to custom paint an alert window’s background to help end-users discern messages displayed in this window.

const
  cxBackColorMap: array[0..3] of TColor = (clLtGray, clMedGray, clDkGray, clMedGray);
procedure <Form>.<dxAlertWindowManager>CustomDrawBackground(Sender: TObject; AAlertWindow: TdxAlertWindow; ACanvas: TcxCanvas; AViewInfo: TdxAlertWindowViewInfo; var ADone: Boolean);
begin
  ACanvas.FillRect(AViewInfo.Bounds, cxBackColorMap[AAlertWindow.CurrentMessageIndex mod 4]);
  ADone := True;
end;
See Also