CustomDrawSeparatorEventArgs.SeparatorIndex Property
Gets the painted cell separator’s index.
Namespace: DevExpress.XtraVerticalGrid.Events
Assembly: DevExpress.XtraVerticalGrid.v24.2.dll
Declaration
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.
using System.Drawing.Drawing2D;
using DevExpress.XtraVerticalGrid.Events;
// ...
private void vGridControl1_CustomDrawSeparator(object sender, CustomDrawSeparatorEventArgs e) {
switch(e.SeparatorIndex) {
case 0:
// Fills the background.
using(var backBrush = new LinearGradientBrush(e.Bounds, Color.Yellow, Color.Orange,
LinearGradientMode.Vertical))
e.Cache.FillRectangle(backBrush, e.Bounds);
ControlPaint.DrawBorder3D(e.Graphics, e.Bounds);
e.SeparatorString = ",";
// Paints the text which is displayed within the separator.
e.Cache.DrawString(e.SeparatorString, e.Appearance.Font,
Brushes.DarkBlue, e.Bounds, e.Appearance.GetStringFormat());
break;
case 1:
using(var backBrush = new LinearGradientBrush(e.Bounds, Color.Orange, Color.Yellow,
LinearGradientMode.Vertical))
e.Cache.FillRectangle(backBrush, e.Bounds);
ControlPaint.DrawBorder3D(e.Graphics, e.Bounds);
e.SeparatorString = "/";
e.Cache.DrawString(e.SeparatorString, e.Appearance.Font,
Brushes.DarkBlue, e.Bounds, e.Appearance.GetStringFormat());
break;
default:
break;
}
e.Handled = true;
}
See Also