I would like to automatically save an image to file after I click "printscreen" but I don't know what I'm doing wrong.
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.PrintScreen)
{
Image screenshot = Clipboard.GetImage();
screenshot.Save("c:\\Users\\Default\\Pictures\\screenshot.jpg");
}
}
The code doesn't contain any errors, it simply does not work as expected.