Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7868845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:07:46+00:00 2026-06-03T01:07:46+00:00

I have 2 Panel objects on a form beside each other. When I scroll

  • 0

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();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:07:48+00:00Added an answer on June 3, 2026 at 1:07 am

    I agree with scottm, but adding something that makes a difference:

    private void ScorePanel_Scroll(object sender, ScrollEventArgs e)
    {
        var senderPanel = sender as Panel;
    
        if (senderPanel == null)
        {
            // Might want to print to debug or mbox something, because this shouldn't happen.
            return;
        }
    
        var otherPanel = senderPanel == Panel1 ? Panel2 : Panel1;
    
        otherPanel.VerticalScroll.Value = senderPanel.VerticalScroll.Value;
    }
    

    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:

    Panel1.Scroll += ScorePanel_Scroll;
    Panel2.Scroll += ScorePanel_Scroll;
    

    This would probably be best done in the ctor of the form which contains the panels.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a panel (A), which contains 3 other panels (AA, AB, AC). Each
I have a panel which displays Form objects. When the Close() method is called
I have panel that is using group layout to organize some label. I want
I have Panel with a BottomToolbar . I want to add and remove dynamically
I have a Form that has a panel with some textBoxes and checkBox that
There's is something I don't get with ASP objects. I have a button in
I have a nested form with 3 related models. I want all the fields
Learning .NET: I have a form with a split container, I want to load
In a form I have a label, but the label text exceed the panel
I have a form that uses wxpython, one of the objects on the form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.