[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Get Started With Data Grid and Views
   [Expand]Data Binding
    Unbound Columns
   [Expand]Data Editing and Validation
   [Expand]Filter and Search
   [Expand]Focus and Selection Handling
    Format Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Collapse]Appearance and Conditional Formatting
    [Collapse]Custom Painting
      Custom Painting Basics
      Custom Painting Scenarios
      Elements that Can Be Custom Painted
      Manually Invalidating Controls
    [Expand]Alpha Blending and Background Images
    Split Presentation
    Row Preview Sections
   [Expand]Batch Modifications
    Hit Information
    Popup Menus
   [Expand]Save and Restore Layout
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Custom Painting Basics

Like other DevExpress .NET WinForms controls, the GridControl supports the Appearances mechanism, to customize the look and feel of its elements. It allows you to modify attributes such as background and foreground colors, background images, font settings, etc. If you need more control over element rendering, consider using the custom draw events provided by the GridControl, for each visual element it contains.


Custom painting and alpha blending features are not applied to the printed and exported versions of the Grid Control.

Expanded Online Video

Learn how to custom draw row cells and column headers using dedicated events.

Expanded More Videos

Expanded Custom Painting Basics

Custom draw events allow you to do the following.

  • Paint control elements manually.

    This enables you to provide any appearance you like for control elements. For instance, in the image below, the custom sort glyphs and filter buttons are painted within column headers.

  • Invoke the default painting mechanism of an element.

    It is possible to modify specific view information (e.g., display text) before invoking the default painting mechanism. The default painting method will automatically apply the changes made.

The image below shows a custom painted Grid View.


Custom draw events are raised before grid elements are painted. Each custom draw event handler receives a CustomDrawEventArgs descendant as a parameter. This object's properties specify the bounds of an element, the graphic surface, the appearance settings and various view information related to the painted element.

Custom draw event handlers provide the CustomDrawEventArgs.DefaultDraw method, which allows you to invoke the default painting mechanism of an element during event execution. There is also another implicit way to invoke the default painting mechanism. If the event's CustomDrawEventArgs.Handled parameter is set to false (the default value), the default painting mechanism will automatically be invoked after your custom draw event handler is completed. Note that the default painting mechanism overrides all rendering you may have performed before. The DefaultDraw method automatically sets the Handled parameter to true, to prevent the default painting mechanism from being invoked again after event execution. However, if you paint an element manually and do not use the DefaultDraw method, you should manually set the Handled parameter to true.

Some event handlers provide the Info parameter, which contains view settings specific to the painted element (display text, bounds, etc.). For instance, you can modify the Info parameter as required, and then invoke the default painting mechanism, which will render the element as specified by the Info parameter. The Info parameter is available when the following elements are painted: Filter Panel, band and column headers, View Footer, Group Footer, group rows, Preview Section, row indicator and footer cells.

Some custom draw events provide properties that specify an element's display text. You can modify these properties and then invoke the default painting mechanism. For instance, the GridView.CustomDrawCell event provides the DisplayText property, and the CardView.CustomDrawCardCaption event provides the CardCaption property, which can be modified before the default rendering.

See the following documents for information on custom drawing approaches and a list of elements that can be custom painted.


In certain paint themes (e.g., skins and Office2003), you cannot change the background of some elements. Changing the background of these elements via the Appearance parameter of custom draw events is also not supported.

Expanded See Also

Is this topic helpful?​​​​​​​