trichview.com

trichview.support




Re: inserting graphs from the clipboard


Return to index


Author

Message

Sergey Tkachenko

Posted: 02/21/2005 20:23:08


There are two main groups of methods for adding items in RichViewEdit:

1) Methods like AddNL (all Add*** methods). They:

  - add new items to the end of the document

  - do not format document (you must call rve.Format before displaying)

  - do not require formatted document before their call

2) Methods like PasteBitmap (all Insert*** and Paste*** methods). They:

  - add new items at the position of caret

  - format the changed part of the document themselves

  - require formatted document before their call.


Do you call Format before calling PasteBitmap? If yes - the bitmap will be

inserted at the beginning, because Format resets the caret position to the

beginning of the document. If not - the results are unpredictable.

It's highly recommended to use only methods of the group (1) when generating

new documents.


It's better to use this code:


uses Clipbrd;


var bmp: TBitmap;

chart.CopyToClipboardBitmap;

bmp := TBitmap.Create;

bmp.Assign(Clipboard);

rv.AddPictureEx('', bmp, 0, rvvaBaseline);


(or, even better, use a temporal file instead of the Clipboard, because the

Clipboard can contain data useful for the user)





Powered by ABC Amber Outlook Express Converter