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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:07:27+00:00 2026-06-14T21:07:27+00:00

I have a multiple forms in my project. Form1 contains a pictureBox that displays

  • 0

I have a multiple forms in my project. Form1 contains a pictureBox that displays a jpeg. In Form2 I have a trackBar that I would like to control the zoom level of the image in Form1. To keep it simple I only need 2 or 3 zoom levels. I’ve set the pictureBox to public in the Designer view. However, when I try to reference the pictureBox in Form2 it says it doesn’t exist. Below is the code I’m using to call Form2 in Form1

Form2 dataWindow = new Form2();
dataWindow.ShowDialog();

So in short the two things I need help with is:

1) Changing the properties of pictureBox1 from a separate form.
2) Creating a simple Zoom Formula.

  • 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-14T21:07:28+00:00Added an answer on June 14, 2026 at 9:07 pm

    1) Pass a form1 reference into form2’s constructor:

    Form2 dataWindow = new Form2(this);
    dataWindow.Show();
    

    …

    private form1 as Form1;
    public Form2(Form1 frm1)
    {
      form1 = frm1;
    }
    

    Then in Form2s TrackBar_Scroll event reference the PictureBox via the private member variable form1: form1.PictureBox1.Property

    2) Magnify your pictures using a PictureBox so that you can zoom with the Mouse Wheel


    The better way is events:

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
    
        private void button1_Click(object sender, EventArgs e)
        {
            var form2 = new Form2();
            form2.TrackBarMoved += new Action<int>(ZoomPictureBox);
            form2.ShowDialog();
            form2.TrackBarMoved -= new Action<int>(ZoomPictureBox);
    
        }
    
        private void ZoomPictureBox(int zoomFactor)
        {
            pictureBox1.Width = 100 * zoomFactor;
            pictureBox1.Height = 100 * zoomFactor;
        }
    }
    
    
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
    
        public event Action<int> TrackBarMoved;
    
        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            TrackBarMoved(trackBar1.Value);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django project that, on one page, has multiple forms (in different
I have multiple ajax forms on page that cointain same elemets, I have jquery
I have a page with multiple forms that I submit via Ajax POSTs serially.
I have a fairly complex view that has multiple forms, lots of validations on
In my application I have many different JSP forms with multiple stages, that is
i'm trying to make a small project that uses multiple forms (dialogs) for different
I have an ASP.NET web forms project that I am trying to implement auto-tabbing
I have a project with multiple forms and when, for example, Form A opens
Currently I have a WPF project with a custom UserControl. This control contains a
Is there any way that i can make my project (with multiple forms using

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.