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

  • Home
  • SEARCH
  • 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 6014619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:43:05+00:00 2026-05-23T02:43:05+00:00

Control.Location doesn’t take into account the slider position of the parent panel control and

  • 0

Control.Location doesn’t take into account the slider position of the parent panel control and returns the value like if there was no scrollbar. So how to obtain the real position of some control inside scrollable panel?
For example here I never get the real location of my button:

Button button;
        public Form1()
        {
            InitializeComponent();
            panel1.Height = 200;
            panel1.AutoScrollMinSize = new Size(0, 2000);
            button = new Button();
            panel1.Controls.Add(button);
            button.Top = 1500;
            button.Click += new EventHandler(button_Click);
        }

        void button_Click(object sender, EventArgs e)
        {
            MessageBox.Show(button.Location.Y.ToString());
        } 
  • 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-05-23T02:43:06+00:00Added an answer on May 23, 2026 at 2:43 am

    It does. If I put a panel inside a scrolling panel, the location position is changing as I scroll:

    Private Sub Panel1_Scroll(ByVal sender As Object, ByVal e As ScrollEventArgs) Handles Panel1.Scroll
      Me.Text = Panel2.Location.ToString
    End Sub
    

    Make sure you don’t have your control inside another panel that is getting scrolled, then the location property doesn’t change.

    Otherwise, look at the PointToScreen and PointToClient functions or adjust your values according to the AutoScrollPosition value of the scrolling parent.

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

Sidebar

Related Questions

Control Panel -> Security Center I really like the components/controls which are used to
Let's say I have a Control and its location is relative to its parent.
MouseWheel event doesn't fire when I' am using any control (ListBox, Panel, TextBox) with
I need to be able to get/set current location in Win 7 (Control Panel
The following script works to open Firefox's location/awesome bar from anywhere using control-l ,
Here is my try: @header(Content-type: text/html; charset=utf-8); @header(Location:/index.php); @header(Cache-Control: no-cache, must-revalidate); // HTTP/1.1 @header(Expires:
I have a machine control system in Python that currently looks roughly like this
How do I version control my map/reduce functions for CouchDB? I'd like to be
I've come across some old code <object id=foo classid=/location/bar.dll#ProjectName.ClassName viewastext></object> It doesn't currently work
I looked into javascript, and thought about using the client's clock, but it doesn't

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.