I have 2 Panel objects on a form beside each other.
When I scroll the 1st Panel I want the other to Scroll exactly the same amount.
Something like this.
private void Panel1_Scroll(object sender, ScrollEventArgs e)
{
Panel2.ScrollPosition() = Panel1.ScrollPosition();
}
I agree with scottm, but adding something that makes a difference:
The other way, you would always update Panel1 to the scroll offset of Panel2, so if you scrolled Panel2, it would actually not scroll anything.
Now that you have this method, you should subscribe with both panels to it, like so:
This would probably be best done in the ctor of the form which contains the panels.