'以下代码仅供参考
'将picture1中的图片缩放为picture2的宽度和高度后,保存为文件 d:\001.bmp
option explicit
private declare function stretchblt lib "gdi32" (byval hdc as long, byval x as long, byval y as long, byval nwidth as long, byval nheight as long, byval hsrcdc as long, byval xsrc as long, byval ysrc as long, byval nsrcwidth as long, byval nsrcheight as long, byval dwrop as long) as long
private declare function setstretchbltmode lib "gdi32" (byval hdc as long, byval nstretchmode as long) as long
private const halftone = 4
private const srccopy = &hcc0020 ' (dword) dest = source
private sub command1_click()
dim rtn as long
dim hdc1 as long, hdc2 as long
hdc1 = picture1.hdc
hdc2 = picture2.hdc
call setstretchbltmode(hdc2, halftone)
rtn = stretchblt(hdc2, 0, 0, picture2.scalewidth, picture2.scaleheight, hdc1, 0, 0, picture1.scalewidth, picture1.scaleheight, srccopy)
savepicture picture2.image, "d:\001.bmp"
end sub
private sub form_load()
me.scalemode = 3
picture2.autoredraw = true
picture1.picture = loadpicture("f:\资料\my pictures\001.bmp")
end sub