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
  •  | 
  •  

Domanda

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?

È stato utile?

Soluzione

Clipboard.SetImage(m_memoryImage);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top