Embedding an image in an RTF control

J

Jason Sobell

I'm trying to embed an image in an RTF control, but the only working method
I can find is to do so via the clipboard and use myRTF.paste().
The problem here is that it obviously destroys the existing clipboard
contents.
Does anyone know if there is a way to call the RTF control directly (such
as via API calls) and pass it the object to be inserted, or does anyone
have any other suggestions?

Cheers,
Jason
 
H

Herfried K. Wagner [MVP]

Hello,

Jason Sobell said:
I'm trying to embed an image in an RTF control, but the only working method
I can find is to do so via the clipboard and use myRTF.paste().
The problem here is that it obviously destroys the existing clipboard
contents.
Does anyone know if there is a way to call the RTF control directly (such
as via API calls) and pass it the object to be inserted, or does anyone
have any other suggestions?

You can try to save the clipboard content, then insert the image and restore
the clipboard content.

Regards,
Herfried K. Wagner
 
J

Jason Sobell

Hello,



You can try to save the clipboard content, then insert the image and restore
the clipboard content.

Regards,
Herfried K. Wagner

Have you tried doing this? There is no clone methods, so it would probably
involve iterating through the data types etc. Very messy and possibly very
memory intensive because you have no idea what is in the clipboard.
Also, I'm not sure if it's even possible given that the clipboard contents
belong to the application that generated them so that the clipboard can be
cleared when the app exits, so it's not a very good solution.

Any other suggestions? Has anyone tried talking to the RTF control through
API calls?

Cheers,
Jason
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top