Skip to main content

Custom Draw

  • 2 minutes to read

The Spreadsheet control provides the Custom Draw feature offering greater flexibility in customizing the control’s appearance. Custom Draw can be used either independently or collectively with other appearance customization techniques. To use this feature, you need handle the OnCustomDraw~ events.

How a Custom Draw Event Works

Each custom draw event provides a set of four parameters which supply the information required for drawing each element of a View worksheet:

  1. The Sender parameter specifies the View worksheet whose element is going to be repainted;

  2. The ACanvas parameter provides the canvas where the element is painted;

  3. The AViewInfo parameter provides access to the ViewInfo object which contains all the information required for painting each element;

  4. The AHandled parameter is False by default. Set it to True to notify the Spreadsheet control that you have handled drawing of that visual element.

The following table lists all available OnCustomDraw~ events:

Event Description Affected Area
OnCustomDrawTableViewCell Handle this event to custom draw data cells within the active Table View worksheet.
OnCustomDrawTableViewCommonCell Handle this event to custom draw helper cell-related visual elements within the active Table View worksheet. For instance, you can use this event to provide a custom painter for horizontal and vertical frozen pane separators.
OnCustomDrawTableViewHeaderCell Handle this event to provide a custom painter for both the horizontal and vertical standard headers.

To learn about the practical aspects of using the Custom Draw feature, refer to the following topic: How to Custom Paint Table Views.