-
OK fellers, here's an easy question for you. I'm writing a little app at the moment, a small part of which requires the user to load a graphic. However, I would like them to be able to preview the graphic before loading it into the application, by displaying what is effectively a little preview thumbnail. I suspect it may be along the lines of loading the image when they select it and then resizing it and displaying it into a small image box. Is there an easy way, perhaps using BITBLT or whatever, to resize such an image? My worry is that there is NOT an easy way. I'm not too familiar with BITBLT, though I have used it briefly before, so if anybody does provide me with some code, comments would be massively appreciated. Thanks in advance!
SamDV
-
<?>
just load it into a smaller size image control
-
<?>
you have to set the stretch property of the image control to true
-
BltBlt cannot resize images. The API method for that is StretchBlt. In this example, I will use PaintPicture because it's the easiest.
Put this in a form with a CommonDialog, PictureBox and CommandButton
Code:
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Picture1.PaintPicture LoadPicture(CommonDialog1.filename), _
0, 0, Picture1.Width, Picture1.Height
End Sub
Please note that for simplicity sake, I did not include any Error Handling.
-
I'm happy :D
Cheers guys. I'll come up with a harder one some time...
;)