5 Replies - 8603 Views - Last Post: 04 November 2009 - 09:29 AM Rate Topic: -----

#1 SingingBush   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 31
  • Joined: 07-May 08

resize pictureBox when Form is resized

Post icon  Posted 04 November 2009 - 06:54 AM

I have a program that has a 700x500px pictureBox when loaded, but i want it to resize when Form is stretched. Is there a way to do this? I'd be happy with just setting it to the size of the Form
Is This A Good Question/Topic? 0
  • +

Replies To: resize pictureBox when Form is resized

#2 Momerath   User is offline

  • D.I.C Lover
  • member icon

Reputation: 1021
  • View blog
  • Posts: 2,463
  • Joined: 04-October 09

Re: resize pictureBox when Form is resized

Posted 04 November 2009 - 07:12 AM

Sure, just code for the Resize or SizeChanged event.
Was This Post Helpful? 0
  • +
  • -

#3 Grapevine   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 55
  • Joined: 26-October 09

Re: resize pictureBox when Form is resized

Posted 04 November 2009 - 08:27 AM

If you dont mind the Picture box being the size of the form, can you just dock it? Then it should automatically resize with your form.....I believe.....
Was This Post Helpful? 0
  • +
  • -

#4 SingingBush   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 31
  • Joined: 07-May 08

Re: resize pictureBox when Form is resized

Posted 04 November 2009 - 08:43 AM

Ok, I've got the pictureBox resizing. My problem is that I am drawing a bitmap and setting it to be the picturebox background and if I maximise the window it tiles the image rather than stretching it.
Was This Post Helpful? 0
  • +
  • -

#5 Momerath   User is offline

  • D.I.C Lover
  • member icon

Reputation: 1021
  • View blog
  • Posts: 2,463
  • Joined: 04-October 09

Re: resize pictureBox when Form is resized

Posted 04 November 2009 - 08:49 AM

View PostGrapevine, on 4 Nov, 2009 - 07:27 AM, said:

If you dont mind the Picture box being the size of the form, can you just dock it? Then it should automatically resize with your form.....I believe.....

You can dock it to the 'center' of the form, and it will cover the entire form.
If you Anchor it to all sides, the edges of the image won't get any closer to the edge of the form, but it will resize.


View PostSingingBush, on 4 Nov, 2009 - 07:43 AM, said:

Ok, I've got the pictureBox resizing. My problem is that I am drawing a bitmap and setting it to be the picturebox background and if I maximise the window it tiles the image rather than stretching it.

This is why you need to react to the events so you can resize the image itself.
Was This Post Helpful? 0
  • +
  • -

#6 Grapevine   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 55
  • Joined: 26-October 09

Re: resize pictureBox when Form is resized

Posted 04 November 2009 - 09:29 AM

absolutely.....you definately should handle the resize event individually in that case.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1