You cannot directly do it, because columns of the
DataGridView
are not controls. You can try to achieve desired effect by modifying the property
Cursor
of this control, depending on the current location of the mouse withing the control, using columns widths to calculate the location of each columns. You can handle the change in mouse location by handling the event
MouseMove
of the control.
Please see:
http://msdn.microsoft.com/en-us/library/vstudio/system.windows.forms.control.cursor[
^],
http://msdn.microsoft.com/en-us/library/vstudio/system.windows.forms.control.mousemove[
^].
Another, perhaps simpler and more efficient approach would be handling the events
CellMouseEnter
and
CellMouseLeave
. This way, you can capture moving your mouse cursor from cell to cell and, analyzing the values of the cell property
DataGridViewCell.ColumnIndex
for "previous" and "current" cell, you can figure out if you are leaving or entering the column in question. When such event of crossing of the column boundary is captured, you can again use the property
DataGridView.Cursor
to change the cursor appearance.
http://msdn.microsoft.com/en-us/library/vstudio/system.windows.forms.datagridview.cellmouseenter[
^],
http://msdn.microsoft.com/en-us/library/vstudio/system.windows.forms.datagridview.cellmouseleave[
^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.columnindex(v=vs.110).aspx[
^].
I think those instructions are quite clear, you just have to implement them.
—SA