Click here to Skip to main content
14,920,432 members
Articles / Programming Languages / C#
Tip/Trick
Posted 29 Nov 2010

Tagged as

Stats

16.1K views
2 bookmarked

How to sync two panel scrolls

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
29 Nov 2010CPOL
C#
private void splitContainer1_Panel1_Scroll(object sender, ScrollEventArgs e)
{
    if (e.ScrollOrientation == ScrollOrientation.HorizontalScroll)
        splitContainer1.Panel2.HorizontalScroll.Value = e.NewValue;
    else if (e.ScrollOrientation == ScrollOrientation.VerticalScroll)
        splitContainer1.Panel2.VerticalScroll.Value = e.NewValue;
}
private void splitContainer1_Panel2_Scroll(object sender, ScrollEventArgs e)
{
    if (e.ScrollOrientation == ScrollOrientation.HorizontalScroll)
        splitContainer1.Panel1.HorizontalScroll.Value = e.NewValue;
    else if (e.ScrollOrientation == ScrollOrientation.VerticalScroll)
        splitContainer1.Panel1.VerticalScroll.Value = e.NewValue;
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author


Comments and Discussions

 
QuestionThis does not work Pin
joseph_korn8-Dec-15 12:30
Memberjoseph_korn8-Dec-15 12:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.