Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

WinExplorerView.CustomDrawItem Event

Allows you to manually repaint a WinExplorerView item.

Namespace: DevExpress.XtraGrid.Views.WinExplorer

Assembly: DevExpress.XtraGrid.v24.2.dll

NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation

#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