Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Form1_Resize(object sender, EventArgs e)
- {
- int new_form_height = 0;
- int new_form_width = 0;
- if(this.WindowState == FormWindowState.Maximized)
- {
- new_form_height = this.Height - old_form_height;
- new_form_width = this.Width - old_form_width;
- pictureBox1.Width += new_form_width;
- pictureBox1.Height += new_form_height;
- int x = panel1.Location.X;
- int y = panel1.Location.Y;
- panel1.SetBounds(x + new_form_width / 2, y + new_form_height, panel1.Width, panel1.Height);
- old_form_width = new_form_width;
- old_form_height = new_form_height;
- }
- else
- {
- pictureBox1.Width -= old_form_width;
- pictureBox1.Height -= old_form_height;
- int x = panel1.Location.X;
- int y = panel1.Location.Y;
- panel1.SetBounds(x - old_form_width / 2, y - old_form_height, panel1.Width, panel1.Height);
- old_form_width = this.Width;
- old_form_height = this.Height;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement