lamckh
September 24th, 2001, 05:28 AM
How to stretch a image in VB?
|
Click to See Complete Forum and Search --> : stretch image lamckh September 24th, 2001, 05:28 AM How to stretch a image in VB? Cimperiali September 24th, 2001, 06:57 AM 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 Cakkie September 24th, 2001, 07:08 AM In reply to: wait for Shree help Nice tip, he's the man Tom Cannaerts slisse@planetinternet.be 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 Iouri September 24th, 2001, 07:23 AM 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 iouri@hotsheet.com codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |