C # to achieve a similar QQ screen capture program

Source: Internet
Author: User
Tags bool

Because I recently wanted to write a program similar to Remote Desktop monitoring, screen capture is used in this program. To achieve the program's part of the function, made a small demo. The program is very simple, the technology used is not much, can only achieve similar QQ screenshot function (although the method is very stupid)

The program flow is as follows:

1. Intercept the entire screen and save

2. Open a new Full-screen window, the saved screen as the background

3. Drag the mouse to change the scope of interception, right key cancellation

4. Double click Intercept, save on Pasteboard, full screen window closed

Okay, here's the Code section.

First create a new project Screencutter (VS2005), change the form name to MainForm, and then create a new form screenbody.

Add a button btncutter to Screencutter and add a button event:

private void btnCutter_Click(object sender, EventArgs e)
    {
      Image img = new Bitmap(Screen.AllScreens[0].Bounds.Width, Screen.AllScreens[0].Bounds.Height);
      Graphics g = Graphics.FromImage(img);
      g.CopyFromScreen(new Point(0, 0), new Point(0, 0), Screen.AllScreens[0].Bounds.Size);
      ScreenBody body = new ScreenBody();
      body.BackgroundImage = img;
      body.Show();
    }

Screen.allscreens[0] is the first to get all the current device Windows, I have only one monitor here, of course I am the first one.

Use the graphics CopyFromScreen function to get the current screen.

OK, now press the button and the Full screen window will come out.

The Full screen window screenbody, first set the form FormBorderStyle to none, and then declare the following variables

private Graphics MainPainter; //主画笔
private Pen pen;        //就是笔咯
private bool isDowned;     //判断鼠标是否按下
private bool RectReady;     //矩形是否绘制完成
private Image baseImage;    //基本图形(原来的画面)
private Rectangle Rect;    //就是要保存的矩形
private Point downPoint;    //鼠标按下的点
int tmpx;
int tmpy;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.