 |  |  | Home Search What's New Index Books Links Q & A Newsletter Banners Feedback Tip Jar |  |  |  | | |  | | | | MSDN Visual Basic Community | | |  | | |  | | | | | | | | | Title | Stretch a PictureBox image to fit the control | | Description | This example shows how to stretch a PictureBox image to fit the control in Visual Basic 6. | | Keywords | stretch, image, resize | | Categories | Graphics, Controls | | | Thanks to Gamal Ahmed. The picStretch subroutine copies a PictureBox's image onto itself, scaling it to fit the control. Note that the scale factor is specific to this example. (This actually isn't a terribly general technique but the animation used by the program is pretty cool.) | | Sub picStrech() 'Picture1.Picture = Image1(1).Picture Picture1.ScaleMode = 3 Picture1.AutoRedraw = True Picture1.PaintPicture Picture1.Picture, _ 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, _ 0, 0, _ Picture1.Picture.Width / 26.46, _ Picture1.Picture.Height / 26.46 Picture1.Picture = Picture1.Image End Sub | | |