trichview.com

trichview.support




Re: OnsavecomponenttoFile event


Return to index


Author

Message

shmp

Posted: 02/21/2003 15:15:03


You cannot save TImage this way because TImage is not a component.


Henry

>

> Hello,

> I want to use the onsavecomponenttofile event to save a gif. How do I

change

> the following codes:

> ================================

> procedure TMyForm.MyRichViewSaveComponentToFile(Sender: TRichView;

>                     Path: String; SaveMe: TPersistent;

>                     SaveFormat: TRVSaveFormat;

>                     var OutStr: String);

> var bmp: TBitmap;

>     ImageFileName: String;

> begin

>  rvsfHTML:

>      begin

>        if SaveMe is TButton then

>          OutStr := '<FORM><INPUT type="button"' +

>                    'value="' + TButton(SaveMe).Caption +

>                    '" onClick="alert(''Test'')"></FORM>';

>        else if SaveMe is TImage then begin

>          bmp         := TBitmap.Create;

>          bmp.Height  := TImage(SaveMe).Height;

>          bmp.Width   := TImage(SaveMe).Width;

>          bmp.Canvas.Draw(0,0, TImage(SaveMe).Picture.Bitmap);

>          ImageFileName := MyRichView.SavePicture(SaveFormat,Path,bmp);

>          OutStr      := '<IMG src="'+ImageFileName+'" alt='+

>                           TImage(SaveMe).Hint+'>';

>          bmp.Free;

>        end;

>      end;

>  end;

> end;

> ================================

>

> Thanks for your coaching.

>

>





Powered by ABC Amber Outlook Express Converter