DataGrid & ScrollBars

A

Angel Montesinos

I want to know when the scrollbars are moving.

I intend to use the protected propoerties VertScrollBar and HorizScrollBar
but these is not present in .NET CF.

Any sugerence?
 
P

Paul G. Tobey [eMVP]

I do this in an RDA sample that uses a DataGrid (ResultGrid is a DataGrid
instance; UpdateForm_ValueChanged is a handler declared in the form holding
the DataGrid):

-----

foreach ( Control c in ResultGrid.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(UpdateForm_ValueChanged);

attachedToScrollBars = true;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top