急急急!大家伙帮帮忙!在线等待!
下面一段代码是将图片框中的图像缩放,但是在实际运行过程中,出现的现象是只有一部分放大,而其余部分则大小不变,请问各位高手错在哪里?小弟不太会用api函数,要整体放大该怎么办?
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 Sub Command1_Click()
n = Val(Text1.Text)
zoomwidth = n * BoxPic.ScaleWidth
zoomheight = n * BoxPic.ScaleHeight
SetStretchBltMode BoxPic.hdc, STRETCH_DELETESCANS
StretchBlt picture1.hdc, 0, 0, zoomwidth, zoomheight, picture1.hdc, 0, 0, BoxPic.ScaleWidth, BoxPic.ScaleHeight, SRCCOPY
End Sub