private void button1_Click(object sender, EventArgs e) { type = 1; timer1.Enabled = false; button2.Text = "Play"; x0 = y0 = x1 = y1 = 0; textBox1.Text = ""; textBox2.Text = ""; button1.Enabled = false; MouseHook.Start(); }
private void mouse_click(object sender, EventArgs e) { if (type == 1) { type = 2; } else { type = 0; button1.Enabled = true; Bitmap bmp = new Bitmap(x1 - x0 + 1, y1 - y0 + 1); Graphics gr = Graphics.FromImage(bmp); gr.CopyFromScreen(x0, y0, 0, 0, bmp.Size); pictureBox1.Image = ResizeBitmap(bmp, 192, 96); MouseHook.stop(); } }