你的第一个代码也不能成功,正确的代码应该是:Private Sub Command1_Click()
Dim hscreendc As Long
Dim sx, sy As Integer
Me.Hide
DoEvents
frmpiccopy.Piccopy.AutoRedraw = True hscreendc = GetDC(0)
sx = Screen.Width \ Screen.TwipsPerPixelX
sy = Screen.Height \ Screen.TwipsPerPixelY
BitBlt frmpiccopy.Piccopy.hdc, 0, 0, sx, sy, hscreendc, 0, 0, vbSrcCopy
ReleaseDC 0, hscreendc
frmpiccopy.Piccopy.Refresh
frmpiccopy.Piccopy.AutoRedraw = False
frmpiccopy.Show
End Sub
Dim hscreendc As Long
Dim sx, sy As Integer
Me.Hide
DoEvents
frmpiccopy.Piccopy.AutoRedraw = True hscreendc = GetDC(0)
sx = Screen.Width \ Screen.TwipsPerPixelX
sy = Screen.Height \ Screen.TwipsPerPixelY
BitBlt frmpiccopy.Piccopy.hdc, 0, 0, sx, sy, hscreendc, 0, 0, vbSrcCopy
ReleaseDC 0, hscreendc
frmpiccopy.Piccopy.Refresh
frmpiccopy.Piccopy.AutoRedraw = False
frmpiccopy.Show
End Sub
在frmpiccopy.Show之前。frmpiccopy根本就没加载,怪就怪在这里,用getdc的不到他的hdc
而直接写在bitblt中就成了,怪!