SavePicture不能保存控件
用网上找的Capture函数又不能保存超过屏幕外围的图形求高手,怎么解决这个问题,我必须要保存到BMP图象

解决方案 »

  1.   

    给你提供2套方案
    1、假设picture1中有任意个控件,picture1.autosize=true
    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 Long
    Private Const SRCCOPY = &HCC0020
    '-----------------------------------------------------------------------------------------
    Pritave Sub Form_Load()
     '将picture2放在picture1内部
     picture2.visible=false
     pictue2.autosize=true  
     picture2.left=0
     picture2.top=0
     picture1.autosize=false
    end sub
    Pritave Sub Command1_Click()
    dim w,h as integer
     w=picture1.width
     h=picture1.height
     stretchblt picture2.hdc,0,0,w,h,picture1.hdc,0,0,w,h,SRCCOPY
     picture1.picture=loadpicture()
     picture2.visible=true
    end subPrivate Sub SavePic_Click()
     with commondialog1
          .dialogtitle="保存为..."
          .filter="位图文件(*.bmp)|*.bmp"
     end with
     commondialog1.showsave
     if commondialog1.filename <> "" then
        if err <> 32755 then
           savepicture picture2.image,savebmpname
        end if
     end if
    end sub
      

  2.   

    在picture1的右侧和下方分别加上Vscroll和Hscroll两个滚动条,来控制超过过picture1显示的内容
      

  3.   

    真难为 badboy168(坏小子) 了 ,虽然你可能没理解我的意思,但是我还是会给分给你的
      

  4.   

    将PictureBox中的图形与控件一起转换为BMP图可以参考:
    http://www.china-askpro.com/msg2/qa05.shtml//超过屏幕范围
    这样就没什么什么好办法了,发送消息,把屏幕外的东东移动到屏幕内,多次抓图,最后合并试试吧
      

  5.   

    如果是保存窗体上的控件还好一点,如果是piturebox中的东西,想把遮住的部分移到可见处就得花一番工夫的。
      

  6.   

    我来说吧:
    要保存PictureBox中的图像为BMP,一共有两个条件:1:PictureBox的AutoRedraw属性为True2: SavePicture后面要用PictureBox的Image属性,而不是Pictrue属性。