fastreport里使用frxpictureview对象,且datafield属性与blobtype属性也设置成btjpg,但是却出现了jpeg error #52的错误。我在程序中使用了richedit字段将内容传递到sql2000数据库中,但是如果image字段中有内容时就出现了这种错误,为什么呢?请大家明示!

解决方案 »

  1.   

    看了很多的相关文章,但是自己水平实在有限,搞不明白了。
    现在根据我找到的文章,有以下几种方式:
    查看修改fr.inc
    //------------------- JPEG images -----------------------------------
    // JPEG images - only available in Delphi 3 and above. Adds approximately
    // 100Kb to your EXE.
    // If you want to show jpeg images in "Picture" object, uncomment
    // the following line:
    {$DEFINE JPEG}
    这是原来的格式,不用改动。就是改动成
    //------------------- JPEG images -----------------------------------
    // JPEG images - only available in Delphi 3 and above. Adds approximately
    // 100Kb to your EXE.
    // If you want to show jpeg images in "Picture" object, uncomment
    // the following line:
    //{$DEFINE JPEG}
    这种方式也是不好用的。
    第二种方式:
    修改fr_class.pas
    在下面的位置
    interface{$I FR.inc}
    加入
    {$DEFINE JPEG}
    且在constructor TfrPictureView.Create;
    begin
      inherited Create;
      Typ := gtPicture;
      Picture := TPicture.Create;
      Flags := flStretched + flPictRatio;
      BaseName := 'Picture';
      frConsts['btBMP'] := 0; frConsts['btJPG'] := 1;
      frConsts['btICO'] := 2; frConsts['btWMF'] := 3;
      frConsts['btjpeg'] := 4;//这一行是我加入的
    end;
    加入了frConsts['btjpeg'] := 4;
    且在
    procedure TfrPictureView.DefineProperties;
    begin
      inherited DefineProperties;
      AddProperty('Picture', [frdtHasEditor], frPictureEditor);
      AddProperty('Stretched', [frdtBoolean], nil);
      AddProperty('Center', [frdtBoolean], nil);
      AddProperty('KeepAspect', [frdtBoolean], nil);
      AddProperty('DataField', [frdtOneObject, frdtHasEditor, frdtString], frFieldEditor);
      AddEnumProperty('BlobType', 'btBMP;btJPG;btICO;btWMF;btJPEG', [0,1,2,3,4]);
      //上面的一行经过了修改
      //以前是这样的AddEnumProperty('BlobType', 'btBMP;btJPG;btICO;btWMF:', [0,1,2,3]);
    end;
    中做了修改,现在在frPictureView中已经有了btjpeg这种格式了,但是仍然存在错误
    an error occured during calulating [Query1."pic"]
    report: frRprt1
    Object: picture1
    access violation at address 004f8ec1 in module "Main.Exe". Read of address 00000000
    请问,是不是我的做法就是不正确的,大家有什么好办法吗?
      

  2.   

    还有这种方法:
    打印方法是将数据库里的图片存放在一个image对象中,然后在fastreport里使用frxpictureview对象,将image内容赋予frxpictureview对象即可,赋值方法是:tfrxpictureview(frxreport1.FindObject('picture1')).Picture.Assign(image1.Picture.Graphic);
    这段放在哪呢?
      

  3.   

    找遍网上好多的贴子,可能是问题太简单了,没有一个详细的描述,也是本人过于愚笨,费了好长时间我找到了原因。
    用richedit保存的在sql图片数据不能打印。如果改成了image显示以后,通过以下方法就可以打印了。
    在fastreport的souce文件夹中有一个fr.inc的文件   
      里面有一段时关于定义jpeg的,把{$DEFINE   JPEG}这一句,去掉前面的\\,重新编译fr6.dpk(我用的delphi6.0)。
    并且修改fr_report中的BlobType类型为jpg,然后就可以输出了。
    由于此问题太简单了,没有人来回答。
      

  4.   

    我这也出现了这个问题
    我的怎么没有source文件夹呢?是因为我还没有买正版?
    yydy#hotmail.com 
    帮我看看 谢谢