|
-
September 24th, 2001, 05:28 AM
#1
stretch image
How to stretch a image in VB?
-
September 24th, 2001, 06:57 AM
#2
Re: stretch image
If you're lloking for a visual effect, you can use imagebox and set the stretch property to true.
If you're looking for a permanet zoom effect (= rewriting the image file as bigger or smaller), then wait for Shree help or have a search (look at Forum Index|FAq|Profile|...|Search|...) for "resize" or "zoom" or "stretch"
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
September 24th, 2001, 07:08 AM
#3
Re: stretch image
In reply to:
wait for Shree help
Nice tip, he's the man
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
September 24th, 2001, 07:23 AM
#4
Re: stretch image
Unless your image is a metafile, the picture box doesn't allow stretching.
You can use the Image control which has a stretch property, or use two pictureboxes.
Here's How to stretch an image:
Dim ViewLft as Integer, ViewTop as Integer
Dim ViewWid as Integer, ViewHgt as Integer
Dim Zoom as Single
private Sub ComputeDim()
ViewWid = picView.Width / Zoom
ViewHgt = picView.Height / Zoom
If ViewWid > picImage.Width then ViewWid = picImage.Width
If ViewHgt > picImage.Height then ViewHgt = picImage.Height
End Sub
private Sub ShowImage()
picView.Cls
picView.PaintPicture picImage.Image, 0, 0, ViewWid * Zoom, ViewHgt * Zoom, ViewLft, ViewTop, ViewWid, ViewHgt
End Sub
private Sub Form_Load()
ViewLft = 0
ViewTop = 0
Zoom = 1
ComputeDim
ShowImage
End Sub
private Sub picView_MouseDown(Button as Integer, Shift as Integer, X as Single, Y as Single)
If Button = vbLeftButton then
Zoom = Zoom + 0.5
else
Zoom = Zoom - 0.5
End If
If Zoom < 0.5 then Zoom = 0.5
ComputeDim
ShowImage
End Sub
Iouri Boutchkine
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|