Option ExplicitPrivate Declare Function BitBlt Lib "gdi32" (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 LongPrivate Sub Command1_Click() '从屏幕上截图 picCopy.Width = Width picCopy.Height = Height - 300 BitBlt picCopy.hDC, 0, 0, Width - 1, Height - 300, Me.hDC, 0, 0, &HCC0020 SavePicture picCopy.Image, "c:\aa.bmp" End SubPrivate Sub Form_Load() '在窗口中加一个PICTUREBOX控件 picCopy.Visible = False picCopy.AutoRedraw = True End Sub
'从屏幕上截图
picCopy.Width = Width
picCopy.Height = Height - 300 BitBlt picCopy.hDC, 0, 0, Width - 1, Height - 300, Me.hDC, 0, 0, &HCC0020
SavePicture picCopy.Image, "c:\aa.bmp"
End SubPrivate Sub Form_Load()
'在窗口中加一个PICTUREBOX控件
picCopy.Visible = False
picCopy.AutoRedraw = True
End Sub