trichview.com

trichview.support




Re: A request to 'Shmp'


Return to index


Author

Message

shmp

Posted: 02/15/2003 20:21:33


I do recommend the use of RxAnimator instead of Anders's TGIFImage.


Here are the codes that can do the animation in RichViewEdit.


Include in USES the following :-

  RxAnimator, RxGIFCtrl


procedure TForm1.Button1Click(Sender: TObject);

var

  MyGif : TRxGIFAnimator;

begin

  OpenDialog1.Filter := 'GIF Images|*.Gif';

  if OpenDialog1.Execute then begin

    RichViewEdit1.Clear; //Optional

    MyGif := TRxGIFAnimator.Create(nil);

    try

      MyGif.Loop := True;

      MyGif.Transparent := True;

      MyGif.RxAnimate := True;

      MyGif.Image.LoadFromFile(OpenDialog1.FileName);

    except

      ShowMessage('Load GIF failed!');

      RichViewEdit1.Format; //This is necessary if the RichViewEdit1.Clear

is included above.

      MyGif.Free; //if loading has an error it is safe to destroy it but

must by-pass the lines below by the exit method.

      Exit;

    end;

    RichViewEdit1.AddControlEx('', MyGif, 0, rvvaBaseline); //It is

AddControl for Rx

    RichViewEdit1.Format;

  end;

end;


initialization

  RegisterClasses([TRxGIFAnimator]); //NOTE: This must be included.


This will really animate a GIF image. You can ofcourse do other things, like

center align and so on. Mr. Yenar has already showed how do it in his

posting here and these codes should make things extremely clear and easy.


>

> Hi,

> Can you send me a working demo/sample where I can insert animated GIF into

> the RichViewEdit. This I understand, calls for the technique which insert

> a component.

>

> Would appreciate if it uses the TGifImage from Anders Melanders but if you

> use others, please refer.

>

> Thanks.





Powered by ABC Amber Outlook Express Converter