Skip to main content

TcxSchedulerResourceNavigator.OnCustomDrawButton Event

Fires when either the built-in or a custom resource navigation button is about to be drawn.

Declaration

property OnCustomDrawButton: TcxSchedulerNavigatorCustomDrawButtonEvent read; write;

Remarks

Handle this event to provide custom drawing of the built-in or custom resource navigation button.

The Sender parameter specifies the resource navigator.

The ACanvas parameter specifies the drawing surface.

The AButton parameter specifies the instance, which represents the button to be drawn.

The ADone parameter specifies whether the default behavior is required when the event handler has finished executing. Assign the ADone parameter a value of True to prevent the default behavior from being executed when the OnCustomDrawButton event handler exits.

The following code shows how to implement custom drawing of the built-in buttons using the Office11 style:

uses dxOffice11;
// ...
begin
  with AButton do
  begin
    FillTubeGradientRect(ACanvas.Handle, Bounds,
      dxOffice11ToolbarsColor1, dxOffice11ToolbarsColor2, Rotated);
    if State in [cxbsHot, cxbsPressed] then
      TcxOffice11LookAndFeelPainter.DrawButton(ACanvas, Bounds, '', State);
    if ActualImageList <> nil then
      ActualImageList.Draw(ACanvas.Canvas, Bounds.Left + 4 - 2 * Byte(Rotated),
        Bounds.Top + 3 + Byte(Rotated), ActualImageIndex, Enabled);
    ADone := True;
  end;
end;

This is the result when the above code has been executed:

See Also