Skip to main content
A newer version of this page is available. .

CustomDrawSeparatorEventArgs.SeparatorIndex Property

Gets the painted cell separator’s index.

Namespace: DevExpress.XtraVerticalGrid.Events

Assembly: DevExpress.XtraVerticalGrid.v19.1.dll

Declaration

public int SeparatorIndex { get; }

Property Value

Type Description
Int32

A zero-based integer representing the painted cell separator’s index.

Remarks

When a multi-editor row consists of more than one item, row header cells as well as value cells are displayed one after another divided by cell separators. The SeparatorIndex property allows you to identify the painted cell separator. This can be useful for instance, when you need to paint different cell separators differently, as shown in the example below.

Example

The following sample code handles the VGridControlBase.CustomDrawSeparator event to custom paint cell separators. The image below shows the result.

SeparatorIndex property

using System.Drawing.Drawing2D;
using DevExpress.XtraVerticalGrid.Events;

// ...
private void vGridControl1_CustomDrawSeparator(object sender, CustomDrawSeparatorEventArgs e) {
   switch (e.SeparatorIndex) {
      case 0:
         // Fills the background.
         e.Graphics.FillRectangle(new LinearGradientBrush(e.Bounds, Color.Yellow, Color.Orange, 
           LinearGradientMode.Vertical), e.Bounds);

         ControlPaint.DrawBorder3D(e.Graphics, e.Bounds);
         e.SeparatorString = ",";
         // Paints the text which is displayed within the separator.
         e.Graphics.DrawString(e.SeparatorString, e.Appearance.Font, 
           new SolidBrush(Color.DarkBlue), e.Bounds, e.Appearance.GetStringFormat());
         break;
      case 1:
         e.Graphics.FillRectangle(new LinearGradientBrush(e.Bounds, Color.Orange, Color.Yellow, 
           LinearGradientMode.Vertical), e.Bounds);
         ControlPaint.DrawBorder3D(e.Graphics, e.Bounds);
         e.SeparatorString = "/";
         e.Graphics.DrawString(e.SeparatorString, e.Appearance.Font, 
           new SolidBrush(Color.DarkBlue), e.Bounds, e.Appearance.GetStringFormat());
         break;
      default:
         break;
   }

   e.Handled = true;
}
See Also