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

CustomDrawSeparatorEventArgs.SeparatorString Property

Gets or sets the painted cell separator’s text.

Namespace: DevExpress.XtraVerticalGrid.Events

Assembly: DevExpress.XtraVerticalGrid.v18.2.dll

Declaration

public string SeparatorString { get; set; }

Property Value

Type Description
String

A String value representing the painted cell separator’s text.

Remarks

Initially, the SeparatorString property contains the separator’s default text specified by the row’s MultiEditorRow.SeparatorString property. This property can be used in two ways:

  • reading the property’s value to paint the default text;
  • change the SeparatorString property value and leave the CustomDrawEventArgs.Handled property set to false. This forces the control to paint the cell separator in the default manner but with modified text.

Note: assigning values to the SeparatorString property has no effect if the row’s MultiEditorRow.SeparatorKind property is set to the SeparatorKind.VertLine value.

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