RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TToolBar.OnCustomDrawButton Event

Occurs when one of the buttons in the toolbar must be painted.

Pascal
property OnCustomDrawButton: TTBCustomDrawBtnEvent;
C++
__property TTBCustomDrawBtnEvent OnCustomDrawButton;

Write an OnCustomDrawButton event handler to enhance or replace the automatic painting of the toolbar's buttons. Use the toolbar's Canvas property to render the button's image. OnCustomDrawButton is for painting individual buttons on the toolbar. The painting of the toolbar itself should be handled in an OnCustomDraw or OnAdvancedCustomDraw event handler. 

Sender is the toolbar that contains the button. 

Button is the button that needs to be painted. Use its properties to determine what to paint and where the button sits on the toolbar's canvas. 

State provides information that you may want to visually represent when painting the button. 

Leave DefaultDraw as true if the button should be painted using the normal process after the event handler exists. Set DefaultDraw to false if the OnCustomDrawButton event handler has completely painted the tool button.

Note: OnCustomDrawButton only occurs prior to painting the button. To respond at other points in the process of painting a button (when the background is erased, or after the default painting of the button), use OnAdvancedCustomDrawButton instead.
 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!