November 26, 2014
Hot Topics:

Image Effects

  • November 19, 2002
  • By Developer.com Staff
  • Send Email »
  • More Articles »

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






Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Rocket Fuel