Skip to content

The examples uses DirectX-compatible APIs to draw a thick border around a grid cell under the mouse pointer.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/winforms-grid-draw-thick-cell-border-directx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Data Grid - Draw a thick border under a data cell (PaintEx event)

This example shows how to draw a thick border around a grid cell under the mouse pointer:

WinForms Data Grid - Draw thick cell borders by handling the PaintX event

The example handles the grid's PaintEx event to draw a border. The PaintEx event allows you to use DirectX-compatible APIs (e.Cache):

private void GridControl_PaintEx(object sender, DevExpress.XtraGrid.PaintExEventArgs e) {
    DrawHotTrackedCell(e.Cache);
}

private void DrawHotTrackedCell(GraphicsCache cache) {
    Rectangle bounds = GetCellBounds(HotTrackedCell);
    cache.DrawRectangle(new Pen(Brushes.Black, _BorderWidth), bounds);
}

Files to Review

Documentation