Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stretching a .jpg in a PictureBox control

Status
Not open for further replies.

MelissaEvans

Programmer
Mar 8, 2001
39
US
Something's goofy with my computer, and whenever I alter the size of an Image control (with the stretch property set to true), it disappears. We've come to the realization that it's some obscure oddity on my machine only. This wouldn't bother us too much, except we fear that our customers will have the same oddity, so we've changed to a PictureBox control. I found some code that will "stretch" the picture to the size of the control (since it doesn't have a stretch property) like this:
Code:
 picture1.PaintPicture picture1.Picture, 0, 0, picture1.ScaleWidth, picture1.ScaleHeight

Unfortunately, this doesn't seem to resize the picture to the PictureBox control.

I noticed in the language reference, it says:
PaintPicture Method: Draws the contents of a graphics file (.bmp, .wmf, .emf, .ico, or .dib) on a Form, PictureBox...
My files are .jpg's... anyone know of another solution?
This is getting irritating.... *sigh*
~Melissa
 
Found the answer...
In case anyone else runs into this - yes the picture box will do .jpgs; you just have to have the AutoReDraw property set to true (its default is false).
~Melissa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top