Skip to main content

Custom Painting Active Elements

  • 2 minutes to read

Group headers, links and scroll buttons are defined as active elements since they provide end-users with a response to specific actions. For instance, links and group headers can change their look & feel when pressed. Thus, these elements can have a number of states, which must be taken into account for custom painting.

NavBar elements can have several states at once. For instance, when a user presses a link, it becomes pressed and hot-tracked at the same time.

The current state of a NavBar element can be determined using the State property of the AViewInfo parameter of custom draw events. The State property represents a set of states enumerated by the TdxNavBarObjectState type. These states are active, disabled, expanded, hot-tracked, pressed and selected (the disabled state relates only to links and the expanded and active states relate only to group headers). Please refer to the TdxNavBarObjectState type topic for more information.

A NavBar control enables you to specify separate styles for group headers, links and scroll buttons depending on their states. These styles are specified by the properties of the NavBar control’s OptionsStyle.DefaultStyles object and various custom styles.

Custom painting provides you more flexibility when customizing the appearance of NavBar elements. For instance, you can fill the background in a particular manner, render links and group buttons as you wish, etc. To implement custom painting of group headers, links and scroll buttons, you can handle the following events:

Event Comment
OnCustomDraw.GroupCaption Use this event to draw the group headers.
OnCustomDraw.Link Use this event to draw the individual links.
OnCustomDraw.TopScrollButton Use this event to draw the scroll buttons displayed at the top of the group’s client area.
OnCustomDraw.BottomScrollButton Use this event to draw the scroll buttons displayed at the bottom of the group’s client area.
See Also