using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Windows.Input; using WindowsInput; using System.Windows; namespace MouseClicker { public partial class FormMain : Form { public int AorBorEnd = 3; public FormMain() { InitializeComponent(); FlipImageAndWait(4); } void FlipImageAndWait(int AorBorEnd) { Image originalImage = pictureBox3.Image; if (AorBorEnd == 1) { originalImage.RotateFlip(RotateFlipType.Rotate270FlipNone); pictureBox3.Image = originalImage; pictureBox3.Refresh(); button2.Enabled = false; //button1.Enabled = false; //timer1.Enabled = true; } if (AorBorEnd == 2) { originalImage.RotateFlip(RotateFlipType.Rotate90FlipNone); pictureBox3.Image = originalImage; pictureBox3.Refresh(); //button2.Enabled = false; button1.Enabled = false; //timer2.Enabled = true; } if (AorBorEnd == 3) { originalImage.RotateFlip(RotateFlipType.Rotate90FlipNone); pictureBox3.Image = originalImage; pictureBox3.Refresh(); } if (AorBorEnd == 4) { originalImage.RotateFlip(RotateFlipType.Rotate270FlipNone); pictureBox3.Image = originalImage; pictureBox3.Refresh(); } } private void timer1_Tick(object sender, EventArgs e) { timer1.Enabled = false; button2.Enabled = true; button1.Enabled = true; button2.FillColor = Color.SeaGreen; button1.FillColor = Color.SeaGreen; FlipImageAndWait(3); } private void timer2_Tick(object sender, EventArgs e) { timer2.Enabled = false; button2.Enabled = true; button1.Enabled = true; button2.FillColor = Color.SeaGreen; button1.FillColor = Color.SeaGreen; FlipImageAndWait(4); } private void button1_Click(object sender, EventArgs e) { if (AorBorEnd == 3) { AorBorEnd = 1; FlipImageAndWait(1); button1.FillColor = Color.Coral; } } private void button2_Click(object sender, EventArgs e) { if (AorBorEnd == 3) { AorBorEnd = 2; FlipImageAndWait(2); button2.FillColor = Color.Coral; } } protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { // Проверка нажатия клавиши Esc if (keyData == Keys.Escape) { if (keyData == Keys.Escape && AorBorEnd == 1) { timer1.Enabled = true; } if (keyData == Keys.Escape && AorBorEnd == 2) { timer2.Enabled = true; } AorBorEnd = 3; return true; // Обработка события завершена } return base.ProcessCmdKey(ref msg, keyData); } } }