I am trying to highlight the row and column which the mouse is on. Essentially this means to change the background color of all the appropriate cells. Currently I am trying to do this in the MouseMove event. However, this is causing slow performance.
I was suggested to use WPF for better performance, however I do not wish to go that route. What are some ways in which I can improve performance within C#?
Try the
CellMouseEnterevent; it fires only once each time the mouse moves over a new cell, unlikeMouseMove, and it doesn’t require clicking on the cell to fire the event. You should probably handle theCellMouseEnter(for highlighting the new cell),CellMouseLeave(for un-highlighting the old cell) and possibly theLeaveevent of the entire DGV (to make sure all cells are unhighlighted).