Option ExplicitPrivate Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
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 LongFunction SetImage(objPicture As PictureBox)
Dim wScreen As Long
Dim hScreen As Long
Dim hdcScreen As Long
Dim r As Long
Dim w As Long
Dim h As Long
objPicture.Width = 8000
objPicture.Height = 6000
objPicture.Cls
wScreen = Screen.Width \ Screen.TwipsPerPixelX
hScreen = Screen.Height \ Screen.TwipsPerPixelYobjPicture.ScaleMode = vbPixels
w = objPicture.ScaleWidth
h = objPicture.ScaleHeight
hdcScreen = GetDC(0)
r = StretchBlt(objPicture.hdc, 0, 0, w, h, hdcScreen, 0, 0, wScreen, hScreen, vbSrcCopy)
SavePicture objPicture.Image, App.Path & "\1.bmp"
End Function这是一段拷屏的代码为什么保存后的图片文件是“objPicture”的背景色?
我把倒数第二行更改为“SavePicture objPicture.Picture, App.Path & "\1.bmp"”后报错:“无效属性值”。
诸位大仙,我在这里给你们上供了,显显灵吧,我都郁闷一天了。谢谢!!