Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Resizing an image in a picture box

Status
Not open for further replies.

dedo8816

Programmer
Oct 25, 2006
94
GB
Hi,

How would i go about automatically resizing an image in a picture box on a form.
My program is a search and display type program, someone enters a serial number, presses enter, all the details populate the fields linked to a database.
Earlier today i asked the question how to populate a picture box on a form from the search criteria, now the images are way too big, is it possible to resize the image into a set picture box dimension, possibly even allow the user to click the picture to enlarge it to its original size (maybe press esc to resize and move on).

Hope this is an easy question to answer, thanks in advance

D
 
Never mind, for all those looking at this with the same question, i just used an image control instead of picture. In the properties there is a setting called stretch (true/false)

No resizing code needed, just select true and what ever size the image control is set to the image will resize and fit.

Cheers for all those gearing up to help me, much appreciated!

D
 
enlarging when clicking is easy with an imagebox
Dim OrigW,OrigH
Sub Load
OrigW=1000
OrigH=700


end sub

Sub Image1_Mousedown(....
Image1.Move Image1.left,Image1.top,9600,7200
end sub

Sub Image1_MouseUp(....
Image1.Move Image1.left,Image1.top,OrigW,OrigH
end sub

If the images are past mid screen night want to realign their left and top as well

If Image1.left > Form1.Width/2 then etc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top