我有一个局限性比较大的方法,或许只能供你参考一下,以开拓思路。局限性:用这个方法,你必须保证那个窗体没有被其他窗体盖住。即TopMost型的。首先得到桌面DC:
    Dim DesktopDC As Long
    DesktopDC = GetDC(GetDesktopWindow())然后存图:
    BitBlt(PictureBoxToSaveWindow.hDC,0,0,......)
    这时,整个Windows桌面就已经在那个PictureBox里了,你当然可以知
    道自己窗体的屏幕位置,那么从PictureBox里裁出窗体部分就行了。最后不要忘记释放桌面DC:
    ReleaseDC(DesktopDC)说明:上面写的例子代码所使用的变量、控件和API均省略了声明。

解决方案 »

  1.   

    装了以后还有保存
    用SAVEPICTURE
      

  2.   

    同意agedboy
    Private Sub Command1_Click()
    Dim wMe As Long
    Dim hMe As Long
    Dim w As Long
    Dim h As Long
    Picture1.Cls
    wMe = Me.Width \ Screen.TwipsPerPixelX
    hMe = Me.Height \ Screen.TwipsPerPixelY
    Picture1.ScaleMode = vbPixels
    w = Picture1.ScaleWidth
    h = Picture1.ScaleHeight
    hdcScreen = GetDC(0)
    r = StretchBlt(Picture1.hdc, 0, 0, w, h, Me.hdc, 0, 0, wMe, hMe, vbSrcCopy)End Sub
      

  3.   

    忘了
    Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    Public 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