title: How do I copy a chart image to the clipboard using C#2010?
body: <p>I am learning C# as I write a program which interfaces with a spectrometer.  I have figured out how to get a spectrum from the spectrometer and plot it on an MS chart.</p>
  
  <p>How do I copy the image of the chart into the clipboard so that it can be pasted into other programs?</p>
  
  <p>I'm using Visual Studio C# 2010.</p>
  
  <p>I have found the chart.SaveImage method, but I would really rather copy the image to the clipboard rather than having to save it to disk.  I have not found a chart.CopyPicture method.</p>
  
  <p>I also figured out how to copy the raw data to clipboard as a string, which can then be pasted into an Excel worksheet and plotted, but I would rather just copy the image itself.</p>
  
  <hr>
  
  <p>Additonal data:</p>
  
  <p>I am able to copy the image to the clipboard using the following code:</p>
  
  <pre><code>spectrumChart2.SaveImage("Image.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
  Image img = Image.FromFile("Image.jpg");
  System.Windows.Forms.Clipboard.SetImage(img);
  </code></pre>
  
  <p>Surely there is way to get the image directly Clipboard without saving and retrieving it from a disk file first.  Please, please let me know how this is done (before one of my coworkers finds this kludge)!</p>