2

Say if I have an image path C:\MyImages\MyImage.jpg how would I get this onto the clipboard using C#.

I know I would use the class System.Windows.Clipboard.SetImage(); but this takes a BitmapSource as the parameter. How would I get a BitmapSource object to feed into this method from the given path?

JKennedy
  • 18,150
  • 17
  • 114
  • 198
  • The question sited as a duplicate does not mentions how to put the image in the clipboard which is clearly part of the question. – David P May 04 '17 at 04:27

1 Answers1

2
BitmapSource bitmapSource = new BitmapImage(new Uri("C:\\MyImages\\MyImage.jpg"));
System.Windows.Clipboard.SetImage(bitmapSource);
Jason Portnoy
  • 757
  • 8
  • 23