D
Dave Jackson
Hi All,
In my quest to have two windows scroll 'in sync', I've
turned to DataGrids which have accesible scroll bars. I've
created my own class that inherits from DataGrid, and
makes the scroll bars accesible:
public class MyDataGrid : System.Windows.Forms.DataGrid
{
public MyDataGrid()
{
InitializeComponent();
}
public ScrollBar HScrollBar
{
get
{
return HorizScrollBar;
}
}
}
Then, on my form I define a MyDataGrid, and add the
following to the Scroll event:
private void MyDataGrid1_Scroll(object sender,
System.EventArgs e)
{
MyDataGrid2.HScrollBar.Value =
MyDataGrid1.HScrollBar.Value;
}
This works great, the two Horizontal scroll bars move in
unison perfectly. The problem is that none of the text
inside the second MyDataGrid moves with the scroll bar, or
even moves at all. Is there anyway to force the data in
the MyDataGrid to move with the scroll bar? Otherwise
there isn't much point in scrolling =).
Thanks,
Dave
In my quest to have two windows scroll 'in sync', I've
turned to DataGrids which have accesible scroll bars. I've
created my own class that inherits from DataGrid, and
makes the scroll bars accesible:
public class MyDataGrid : System.Windows.Forms.DataGrid
{
public MyDataGrid()
{
InitializeComponent();
}
public ScrollBar HScrollBar
{
get
{
return HorizScrollBar;
}
}
}
Then, on my form I define a MyDataGrid, and add the
following to the Scroll event:
private void MyDataGrid1_Scroll(object sender,
System.EventArgs e)
{
MyDataGrid2.HScrollBar.Value =
MyDataGrid1.HScrollBar.Value;
}
This works great, the two Horizontal scroll bars move in
unison perfectly. The problem is that none of the text
inside the second MyDataGrid moves with the scroll bar, or
even moves at all. Is there anyway to force the data in
the MyDataGrid to move with the scroll bar? Otherwise
there isn't much point in scrolling =).
Thanks,
Dave