How do I save a screen capture in memory and use Ctrl+P to paste it on other application (e.g Outlook)

StackOverflow https://stackoverflow.com/questions/22396660

  •  14-06-2023
  •  | 
  •  

Question

I am writing a small tool such that I can click a button and it will capture the screen as an image:

Graphics myGraphics = this.CreateGraphics();
Size s = this.Size;
m_memoryImage = new Bitmap(s.Width, s.Height, myGraphics);
Graphics memoryGraphics = Graphics.FromImage(m_memoryImage);
memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);

But then I would like to paste that screen on another application such as outlook when I press Ctrl+P, just wonder how can I make it happen?

Était-ce utile?

La solution

Clipboard.SetImage(m_memoryImage);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top