0

When the program is in the foreground it works, however if it's in background it isn'T working. Help please!

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Control && e.KeyCode.ToString() == "A")
    {
        Bitmap bm = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
        Graphics g = Graphics.FromImage(bm);
        g.CopyFromScreen(0, 0, 0, 0, bm.Size);
        pictureBox1.Image = bm;
    }
}
iehrlich
  • 3,572
  • 4
  • 34
  • 43
c1pher
  • 19
  • 1
  • 2
    Also note that people will be upset if you globally take over Ctrl+A ( select all ). But I'm guessing this is a personal project ... :) – Derek Jul 20 '17 at 13:49
  • 1
    @Derek - I'd imagine people would get upset for any common shortcut :) – Broots Waymb Jul 20 '17 at 13:50
  • 1
    That is why you should definitely use Ctrl+Shift+LWin+tilde – Derek Jul 20 '17 at 13:53
  • Hi and welcome to Stack Overflow, please take a time to go through the [welcome tour](https://stackoverflow.com/tour) to know your way around here (and also to earn your first badge), read how to create a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and also check [How to Ask Good Questions](https://stackoverflow.com/help/how-to-ask) so you increase your chances to get feedback and useful answers. – DarkCygnus Jul 20 '17 at 15:52

0 Answers0