private void button3_Click(object sender, EventArgs e) { label2.Text = "..."; Task.Delay(0).ContinueWith((t) => { VirtualMouse vm = new VirtualMouse(); int kk = 0; Int32.TryParse(textBox2.Text, out kk); for (int i = 0; i < 5; i++) { label2.Text = i.ToString(); int y = 0, w = 500, h = 400; Int32.TryParse(textBox1.Text, out y); ScreenProcessor sp = new ScreenProcessor(0, y, w, 400); Bitmap b = sp.Get(); for (int yy = 100; yy < 102; yy++) { for (int x = 0; x < w; x++) { label2.Text = i.ToString() + ">>" + x.ToString(); if (b.GetPixel(x, yy).R < kk) { b.SetPixel(x, yy, Color.Red); } } } pictureBox1.Image = b; vm.LClick(ml.X, ml.Y); vm.LClick(ml.X, ml.Y); Thread.Sleep(250); } label2.Text = "cool beans"; }); }