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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:24:40+00:00 2026-05-13T09:24:40+00:00

I have a project in C#, WindowsForms and I created a panel that contains

  • 0

I have a project in C#, WindowsForms and I created a panel that contains a pictureBox that is much bigger than his parent.

I turned panel.AutoScroll to true and what I want to do is dragging this pictureBox in panel instead of catching a scroll and moving it.

I.e. when I grab an image and move cursor to left and down I would like to get the same behavior as I will do it with panel‘s scrolls.

How to do it ?

  • 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-13T09:24:40+00:00Added an answer on May 13, 2026 at 9:24 am

    Ok, I got it. 😉 If anyone else has the same problem, here is solution:

        protected Point clickPosition;
        protected Point scrollPosition; 
    
        private void pictureBox_MouseDown(object sender, MouseEventArgs e)
        {
            this.clickPosition.X = e.X;
            this.clickPosition.Y = e.Y;
        }
    
        private void pictureBox_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                scrollPosition.X = scrollPosition.X + clickPosition.X - e.X;
                scrollPosition.Y = scrollPosition.Y + clickPosition.Y - e.Y;
                this.panel.AutoScrollPosition = scrollPosition;
            }
        }  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my windows forms project I have a parent form that is creates other
I have a class library that I created using the Class Library project template.
i have a winforms project, and i created a class on assembly A that
I have created a custom control that inherits System.Windows.Forms.Panel, and adds a few extra
I have a library project that I created and have used in about three
I have a Windows Forms project in Visual Studio that reads configuration files from
I'm looking at code that is new-to-me. I have c++ code in a project
I have created a simple windows forms visual studio 2010 project in windows 7
I have a project which contains all custom controls and images; we'll call it
I have created a setup project with VS2008 for a .NET Windows Forms application

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.