Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace SCANCODE
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private Bitmap TakeScreenShot(Screen currentScreen)
- {
- Bitmap bmpScreenShot = new Bitmap(currentScreen.Bounds.Width,
- currentScreen.Bounds.Height,
- System.Drawing.Imaging.PixelFormat.Format32bppArgb);
- Graphics gScreenShot = Graphics.FromImage(bmpScreenShot);
- gScreenShot.CopyFromScreen(currentScreen.Bounds.X,
- currentScreen.Bounds.Y,
- 0, 0,
- currentScreen.Bounds.Size,
- CopyPixelOperation.SourceCopy);
- return bmpScreenShot;
- }
- private Bitmap bmp;
- private void Form1_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyData == Keys.L)
- {
- Image pr = TakeScreenShot(Screen.PrimaryScreen);
- bmp = new Bitmap(pr);
- bmp.Save("C:/Users/user/Downloads/1.bmp");
- Application.Exit();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement