HowTo: Stretch A PictureBox Image To Fit The Control - VB Helper

Home Search What's New Index Books Links Q & A Newsletter Banners Feedback Tip Jar
C# Helper...
XML RSS Feed Follow VBHelper on Twitter
MSDN Visual Basic Community
TitleStretch a PictureBox image to fit the control
DescriptionThis example shows how to stretch a PictureBox image to fit the control in Visual Basic 6.
Keywordsstretch, image, resize
CategoriesGraphics, 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
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc. All rights reserved.
Updated

Từ khóa » Visual Basic Stretch Image