trichview.com

trichview.support




How to insert gif


Return to index


Author

Message

Allen

Posted: 02/11/2003 20:49:47


Hi,

From your editor codes, how do I modify the following codes to insert a GIF

image?


{ Insert|Picture... ---------------------------------------------------}

procedure TForm1.mitPictureClick(Sender: TObject);

var gr: TGraphic;

    pic: TPicture;

begin

  OpenDialog1.Title := 'Inserting Image';

  {$IFDEF RICHVIEWDEF3}

  OpenDialog1.Filter := 'Graphics(*.bmp;*.wmf;*.emf;*.ico;*.jpg)|*.bmp;*.wmf;*.emf;*.ico;*.jpg|All(*.*)|*.*';

  {$ELSE}

  OpenDialog1.Filter := 'Graphics(*.bmp;*.wmf;*.emf;*.ico)|*.bmp;*.wmf;*.emf;*.ico|All(*.*)|*.*';

  {$ENDIF}

  if OpenDialog1.Execute then

    try

      pic := TPicture.Create;

      try

        pic.LoadFromFile(OpenDialog1.FileName);

        gr := RV_CreateGraphics(TGraphicClass(pic.Graphic.ClassType));

        gr.Assign(pic.Graphic);

      finally

        pic.Free;

      end;

      if gr<>nil then

        RichViewEdit1.InsertPicture('',gr,rvvaBaseLine);

    except

      Application.MessageBox(PChar('Cannot read picture from file '+OpenDialog1.FileName),

'Error',

        MB_OK or MB_ICONSTOP);

    end;

end;


=====================================

As a new member, I would appreciate hints and help.


Thanks.





Powered by ABC Amber Outlook Express Converter