windowsforms-devexpress-dot-xtraverticalgrid-dot-events-dot-customdrawseparatoreventargs-e0aa7636.md
Gets the painted cell separator’s index.
Namespace : DevExpress.XtraVerticalGrid.Events
Assembly : DevExpress.XtraVerticalGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
public int SeparatorIndex { get; }
Public ReadOnly Property SeparatorIndex As Integer
| Type | Description |
|---|---|
| Int32 |
A zero-based integer representing the painted cell separator’s index.
|
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.
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;
}
Imports System.Drawing.Drawing2D
Imports DevExpress.XtraVerticalGrid.Events
Private Sub VGridControl1_CustomDrawSeparator(ByVal sender As Object, _
ByVal e As CustomDrawSeparatorEventArgs) Handles VGridControl1.CustomDrawSeparator
Select Case e.SeparatorIndex
Case 0
' Fills the background.
Using backBrush = New LinearGradientBrush(e.Bounds, Color.Yellow, Color.Orange, LinearGradientMode.Vertical)
e.Cache.FillRectangle(backBrush, e.Bounds)
End Using
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())
Case 1
Using backBrush = New LinearGradientBrush(e.Bounds, Color.Orange, Color.Yellow, LinearGradientMode.Vertical)
e.Cache.FillRectangle(backBrush, e.Bounds)
End Using
ControlPaint.DrawBorder3D(e.Graphics, e.Bounds)
e.SeparatorString = "/"
e.Cache.DrawString(e.SeparatorString, e.Appearance.Font, Brushes.DarkBlue, e.Bounds, e.Appearance.GetStringFormat())
Case Else
End Select
e.Handled = True
End Sub
See Also
CustomDrawSeparatorEventArgs Class