首页 > 代码库 > RichView中插入Gig

RichView中插入Gig

以下是封装的一个函数:

procedure RichViewAddPicture(RichEdit: TRichViewEdit; const TagStr: string;
  Stream: TMemoryStream; IsGif: Boolean);
var
  LGraphic: TGraphic;
begin
  if IsGif then
  begin
    LGraphic := TGIFImage.Create;
  end else
  begin
    LGraphic := TBitmap.Create;
  end;

  Stream.Position := 0;
  LGraphic.LoadFromStream(Stream);
  RichEdit.InsertPicture(TagStr, LGraphic, rvvaBaseline);
end;

用这个增加图片后,Gif图片是静止不动的,还有两个地方需要设置

1. RichViewEdit的AnimationMode 必须设置成 rvaniOnFormat

2. 在RichViewEdit所在的Pas文件中,加入RVGifAnimate2007单元引用

RichView中插入Gig