Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace SCANCODE
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19. private Bitmap TakeScreenShot(Screen currentScreen)
  20. {
  21. Bitmap bmpScreenShot = new Bitmap(currentScreen.Bounds.Width,
  22. currentScreen.Bounds.Height,
  23. System.Drawing.Imaging.PixelFormat.Format32bppArgb);
  24.  
  25. Graphics gScreenShot = Graphics.FromImage(bmpScreenShot);
  26.  
  27. gScreenShot.CopyFromScreen(currentScreen.Bounds.X,
  28. currentScreen.Bounds.Y,
  29. 0, 0,
  30. currentScreen.Bounds.Size,
  31. CopyPixelOperation.SourceCopy);
  32. return bmpScreenShot;
  33. }
  34. private Bitmap bmp;
  35. private void Form1_KeyDown(object sender, KeyEventArgs e)
  36. {
  37. if (e.KeyData == Keys.L)
  38. {
  39. Image pr = TakeScreenShot(Screen.PrimaryScreen);
  40. bmp = new Bitmap(pr);
  41. bmp.Save("C:/Users/user/Downloads/1.bmp");
  42. Application.Exit();
  43. }
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement