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 707433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:16:37+00:00 2026-05-14T04:16:37+00:00

I have a created a panel. This has autoscroll = true At the start

  • 0

I have a created a panel.
This has autoscroll = true

At the start i added 6 pictureboxes that are 256×256 with images.
I store the last picturebox location, so that i know where to put a new picturebox.

I also add a picturebox to the upper right of the panel(location(8744,8744)), so that the panel will stretch to 9000px.

Later on when i scroll around in the panel, i can push a button and add a picturebox to the panel. The problem is that when i set the location of the picturebox and add it to the panel, it comes out totally wrong, visually.

Code for adding more images.

private void addPictureBox(Point pixelCoordinates, Bitmap image)
{
        PictureBox pNewImage = new PictureBox();
        imagePanel.Controls.Add(pNewImage);

        pNewImage.Image      = image;
        pNewImage.Name       = "image_:" + pixelCoordinates.X + "_" + pixelCoordinates.Y;
        pNewImage.Location   = pixelCoordinates;
        pNewImage.Size       = new System.Drawing.Size(256, 256);
        pNewImage.Visible    = true;
        pNewImage.BackColor  = Color.White;

        imagePanel.Update();

}

If i debug and watches the panel, it says that the new picturebox has the location i set, but visually, it’s not.

I have noticed that this is what really happens:
The location of the picturebox is from where i have scrolled + location.X.

Anyone got an idea how i can fix this?

Thanks in advance.

  • 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-14T04:16:38+00:00Added an answer on May 14, 2026 at 4:16 am

    If the pictureboxes are being added after you have scrolled away from the coordinates 0,0 you may need to account for this by adding the scroll amount to pixelCoordinates. Try using imagePanel.VerticalScroll.Value and imagePanel.HorizontalScroll.Value in your calculations.

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

Sidebar

Related Questions

I have created a JLabel lab1. Added it to a panel and added mousemotionlistener
I have a button that is programatically created, it's content is a stack panel
I have a custom component that extends a panel. The panel has a top
I have created an application that has a toolbar, menubar and content area. I
I have created a program that has a JScrollPane . However, JScrollPane doesn't seem
I have created a simple custom panel using ContainerControl as my base. I've added
I have a panel with a form that has a drop down list with
I am quite new to Ext JS 4 and I have created a Panel
I am using ExtJS 4. I have created a tree panel as var treeStore
I have created a Dynamic View Panel custom control and want to add a

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.