Skip to main content

WinExplorerView.CustomDrawItem Event

Allows you to manually repaint a WinExplorerView item.

Namespace: DevExpress.XtraGrid.Views.WinExplorer

Assembly: DevExpress.XtraGrid.v24.2.dll

Declaration

[DXCategory("CustomDraw")]
public event WinExplorerViewCustomDrawItemEventHandler CustomDrawItem

Event Data

The CustomDrawItem event's data class is DevExpress.XtraGrid.Views.WinExplorer.WinExplorerViewCustomDrawItemEventArgs.

Remarks

Handle the CustomDrawItem event and use its e.Graphics and e.Cache methods to re-paint individual WinExplorerView items.

The sample below illustrates how to draw a colored triangle in the top right corner of WinExplorerView items.

image

Color triangleColor = Color.DodgerBlue;
private void WinExplorerView1_CustomDrawItem(object sender, WinExplorerViewCustomDrawItemEventArgs e)
{
    List<Point> cornerTriangle = new List<Point>();
    int tempLength = 50;
    cornerTriangle.Add(new Point(e.Bounds.Width + e.Bounds.X - tempLength, e.Bounds.Y));
    cornerTriangle.Add(new Point(e.Bounds.Width + e.Bounds.X, e.Bounds.Y));
    cornerTriangle.Add(new Point(e.Bounds.Width + e.Bounds.X, tempLength + e.Bounds.Y));
    e.Draw();
    e.Cache.FillPolygon(cornerTriangle.ToArray(), triangleColor);
    e.Handled = true;
}
See Also