求助:关于BitBlt将窗体一定区域截取下来,并存成BMP图片的问题?
请问:
Option Explicit
Private Declare Function BitBlt Lib "gdi32.dll" (ByVal hDestDC 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 dwRop As Long) As Long
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Private Const SRCCOPY As Long = &HCC0020
Private Sub open1_Click()
Dim hDc1 As Long, hDC2 As Long
Dim W As Long, H As Long, i As Long
Picture2.Width = 13335
Picture2.Height = 5655
Picture2.Visible = True
Picture2.AutoRedraw = False
Picture2.ScaleMode = 3
Picture2.Cls
On Error GoTo Lhandle
hDc1 = Form1.hDC
hDC2 = Picture2.hDC
BitBlt hDC2, 0, 0, 900, 370, hDc1, 160, 0, SRCCOPY
Lhandle:
CommonDialog1.DialogTitle = "打开采样数据文件"
CommonDialog1.Filter = "*.bmp"
CommonDialog1.InitDir = "C:"
CommonDialog1.Action = 2
SavePicture Picture2.Picture, CommonDialog1.FileName
End Sub
这是我的代码,为什么总提示出错?
提示"SavePicture Picture2.Picture, CommonDialog1.FileName"出错!
[解决办法]
发育成: SavePicture Picture2.image, CommonDialog1.FileName
[解决办法]
一、Picture2.AutoRedraw = False改成Picture2.AutoRedraw = True。
二、SavePicture Picture2.Picture, CommonDialog1.FileName改成SavePicture Picture2.Image, CommonDialog1.FileName