123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- 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);
- }
- }
- }
|