我用bitblt将一幅图复制到了一个picture控件里,我想用savepicture保存,
但是如果我用savepicture picReal.image, filename保存下来的是一幅空图像
用savepicture picReal.picture, filename运行时出错,提示RuntimeError'380'
Invalid Property Value,请问这是怎么回事?
另外,不知道有没有什么API之类的可以直接保存成JPG之类的格式?
分数不是问题

解决方案 »

  1.   

    不用API,直接 savePicture picReal.picture,fileName就行了fileName="aaa.bmp"保存jpg需要用控件实现.具体搜一下.
      

  2.   

    savepicture 只支持BMP、元图象 和 ICO格式
      

  3.   

    楼上的,不行阿,我的picture里的图像是用bitblt复制的,用savePicture picReal.picture,fileName会出错的,我上边已经写得很详细了,提示RuntimeError'380'
    Invalid Property Value
      

  4.   

    说此时的picture属性为空,也就是说并没有一个IPictureDisp对象与picture相对应,所以肯定会出错的,难道必须用API么?
      

  5.   

    将PictureBox的AutoRedraw属性设为True
      

  6.   

    Set picReal.Picture=picReal.Image
    SavePicture picReal.Picture,FileName
      

  7.   

    那样的话,bitblt不就什么都没有了么?Form会在必要的时候自动重画,而VB并不知道我已经用Bitblt更新了图像,VB重画的结果就是没有Bitblt之前的图像
      

  8.   

    将PictureBox的AutoRedraw属性设为True
    另外需要注意的就是PictureBox的ScaleMode属性要为3然后,用savepicture picturebox.image,filename保存如果想保存成jpg文件的话,就用第3方控件吧
      

  9.   

    不行阿,Rick110AAA(海牛猪猪) 
    Picture和Image是不一样的,不能Set的,错误同上边的提示
      

  10.   

    '算了,我给你写一个吧
    '两个picturebox,一个按钮,首先为picture1载入一幅图象
    Option Explicit
    Private 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()
        Dim w As Long
        Dim h As Long
        w = Me.Picture1.ScaleWidth
        h = Me.Picture1.ScaleHeight
        BitBlt Picture2.hDC, 0, 0, w, h, Picture1.hDC, 0, 0, vbSrcCopy
        Picture2.Refresh
        SavePicture Picture2.Image, "d:\mydebug.bmp"
    End SubPrivate Sub Form_Load()
        Me.Picture1.ScaleMode = 3
        Me.Picture2.ScaleMode = 3
        Me.Picture2.AutoRedraw = True
        Me.Picture2.Width = Me.Picture1.Width
        Me.Picture2.Height = Me.Picture1.Height
    End Sub
      

  11.   

    在保存之前增加一句:
    picReal.picture=picReal.image
    然后用
    savepicture picreal,Filename就可以了。当然picreal需要设置成autoredraw=true.