datagrid scroll events

  • Thread starter Thread starter Jesse Aufiero
  • Start date Start date
J

Jesse Aufiero

Hello,

I need a way to detect when a user mouses up and down on a datagrid's
vertical scrollbar. However, the 'mouse down' and 'mouse up' events of the
datagrid do not fire when the scrollbar is clicked, and there are no
built-in 'scroll' events at all.

So how can this be accomplished?

Thanks!
 
Try this code

foreach ( Control c in dataGrid1.Controls )
{
Type t = c.GetType();
if ( typeof( System.Windows.Forms.HScrollBar ).IsAssignableFrom( t
) ||
typeof( System.Windows.Forms.VScrollBar ).IsAssignableFrom( t ) )
{
ScrollBar csb = (ScrollBar)c;
csb.ValueChanged +=new EventHandler(csb_ValueChanged);
}
}

Hope this helps,

Cheers,
Arun.
 
Back
Top