by manikantan (12 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 25th October 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Explains Image Stretching By Visual Basic
Still images can be Stretched to any extent in Visual Basic using the Tools in it.One such is the
paintpicture method of the picture box.
Painpicture takes ten Arguments for its operation.They are
1)Picture Name
2)Destination X
3)Destination Y
4)Destination Width
5)Destination Height
6)Source X
7)Source Y
8)Source Width
9)Source Height
10)Operation code to operate upon the Data being Copied.
Given Below is the code for Strecthing the Images in XY-Axis.Befor using the code set the Scalemode
of both the Picture box to Pixel.Scalemode is a property which Defines the Unit of Measurement on a picturebox
' code developed by Manikantan
' 3rd Agenda
' Site: www.3rdagenda.com
' The Piece of code Explains how to Produce Effects on Still Images
' to Do ..Place Two picture boxes in the form
' name them as pct_src and pct_dest
' Place a picture in the pct_src
' Have Two Command Buttons
' Name them as cmd_horiz and cmd_vert
' cmd_horiz has the code to stretch the image in the X axis
' cmd_vert has the code to stretch the image in the Y axis
Private Sub cmd_horiz_Click()
For i = 1 To pct_src.ScaleWidth
pct_dest.PaintPicture pct_src.Picture, 0, 0, pct_dest.ScaleWidth, pct_dest.ScaleHeight, 0, 0, i, pct_src.ScaleHeight, vbSrcCopy
Next i
End Sub
Private Sub cmd_vert_Click()
For i = 1 To pct_src.ScaleHeight
pct_dest.PaintPicture pct_src.Picture, 0, 0, pct_dest.ScaleWidth, pct_dest.ScaleHeight, 0, 0, pct_src.ScaleWidth, i, vbSrcCopy
Next i
End Sub
Article By ...
Manikantan
Mail: manikantan@3rdagenda