Skip to main content

SpreadsheetControl.CustomDrawFrozenPaneBorder Event

Enables frozen pane borders to be painted manually.

Namespace: DevExpress.XtraSpreadsheet

Assembly: DevExpress.XtraSpreadsheet.v24.1.dll

NuGet Package: DevExpress.Win.Spreadsheet

Declaration

public event CustomDrawFrozenPaneBorderEventHandler CustomDrawFrozenPaneBorder

Event Data

The CustomDrawFrozenPaneBorder event's data class is CustomDrawFrozenPaneBorderEventArgs. The following properties provide information specific to this event:

Property Description
Cache Gets an object that serves as the storage for pens, fonts and brushes. Inherited from CustomDrawObjectEventsArgs.
ForeColor Gets the color of the frozen pane border line.
Graphics Gets an object used for painting. Inherited from CustomDrawObjectEventsArgs.
Handled Gets or sets whether an event is handled. If true, the default actions are not required. Inherited from CustomDrawObjectEventsArgs.
Point1 Gets the first endpoint of the frozen pane border line.
Point2 Gets the second endpoint of the frozen pane border line.
Type Gets whether the frozen pane is vertical or horizontal.
Width Gets the width of the frozen pane border line.

The event data class exposes the following methods:

Method Description
DrawDefault() Renders the element using the default drawing mechanism. Inherited from CustomDrawObjectEventsArgs.

Remarks

The CustomDrawFrozenPaneBorder event is raised before a frozen pane border is painted. Event argument properties provide the objects and information required to paint the frozen pane border.

Set the CustomDrawObjectEventsArgs.Handled property to true to cancel default painting. Use the CustomDrawObjectEventsArgs.DrawDefault method to perform default painting within the event handler.

The following code paints borders of the vertical and horizontal frozen panes in different colors and line widths. The worksheet appears as shown in the image below.

SpreadsheetControl_CustomDrawFrozenPaneBorder

using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraSpreadsheet;

// ...

       private void spreadsheetControl1_CustomDrawFrozenPaneBorder
       (object sender, CustomDrawFrozenPaneBorderEventArgs e)
       {
            e.Handled = true;

            // Vertical frozen pane border
            //(line color is pink, line width is 3)
            if (e.Type == FrozenPaneBorderType.Vertical)
                using (Pen pen = new Pen(Color.DeepPink, 3))
                {
                    e.Graphics.DrawLine(pen, e.Point1, e.Point2);
                }


            // Horizontal frozen pane border
            //(line color is violet, line width is default)
            else 
               e.Graphics.DrawLine(Pens.BlueViolet, e.Point1, e.Point2);
        }
See Also