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

RepositoryItemLookUpEdit.CustomDrawLine Event

Provides the capability to perform custom painting of vertical grid lines in the drop-down.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v19.1.dll

Declaration

[DXCategory("Events")]
public event LookUpCustomDrawLineEventHandler CustomDrawLine

Event Data

The CustomDrawLine event's data class is DevExpress.XtraEditors.Popup.LookUpCustomDrawLineArgs.

Remarks

If the RepositoryItemLookUpEdit.ShowLines property is set to true, vertical lines separating the grid columns (see RepositoryItemLookUpEdit.Columns) are displayed in the drop-down.

By default, the line appearance depends on the skin settings, if applied; or otherwise, on the system settings. The CustomDrawLine event fires each time the drop-down is about to be painted, and allows you specify custom appearance settings or perform custom painting of vertical grid lines in the drop-down.

You can specify custom appearance settings using the event arguments’ Apperance property. The code snippet below shows how to specify a custom color for the vertical grid lines.


private void lookUpEdit1_CustomDrawLine(object sender, DevExpress.XtraEditors.Popup.LookUpCustomDrawLineArgs e) {
     e.Appearance.ForeColor = Color.Red;
 }

The result is shown below.

LookUpEdit_CustomDrawLineAppearance

You can also provide custom painting of the lines using the Graphics object accessible through the arguments’ Cache property. The code snippet below shows how to draw the grid lines with a custom color and dash style. Note that the arguments’ Handled property must be set to true to prevent the default painting.


void rtLookUpEdit_CustomDrawLine(object sender, DevExpress.XtraEditors.Popup.LookUpCustomDrawLineArgs e) {
    Pen p = new Pen(new SolidBrush(Color.Red));
    p.DashStyle = DashStyle.DashDot;
    e.Cache.Graphics.DrawLine(p,
        new Point(e.Bounds.X, e.Bounds.Y),
        new Point(e.Bounds.X, e.Bounds.Y + e.Bounds.Height)
        );
    e.Handled = true;
}

The figure below shows the result.

LookUpEdit_CustomDrawLine

See Also