I am trying to copy both an image from a file and text from a file to the clipboard. My intention is to open a text document or Outlook email and paste both text and image into one standard paste command (e.g. CTRL-V). I can do both separately easily enough, but doing them as in one operation does not seem to work.
This is how these two work for me as separate operations (only corresponding lines of code, of course, with disabling try / catch, etc.):
Add image to clipboard:
...
Bitmap imageToAdd = new Bitmap(imageFilePath);
Clipboard.SetImage(imageToAdd);
...
Add text to clipboard:
...
StreamReader rdr = new StreamReader(textFilePath);
string text = rdr.ReadToEnd();
Clipboard.SetText(text);
...
I use the framework of C # and .net 2.0 and focus on Windows XP (and probably Vista in the near future).
TIA