Example #1
0
 //Event when the execution button is clicked
 private void execute_Click(object sender, EventArgs e)
 {
     if (Screen.PrimaryScreen.Bounds.Height != 1080 || Screen.PrimaryScreen.Bounds.Width != 1920)
     {//if the resolution is virtually or really wrong. close  program
         MessageBox.Show("Resolution has been changed. Resolution for your primary monitor must be 1920x1080 with resolution scale of 100%. Please change this before restarting the program", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
         Environment.Exit(0);
     }
     try
     {
         //get most up to date image
         LeftImage = new Bitmap(pBoxLeft.Image);
         //creates a new thread for  the drawing worker. this allows us to detect keyboard input  while form is unfocused.
         w = new DrawingWorker();
         //Creates a new bitmap for the right image
         Bitmap b = new Bitmap(RightImage);
         //Assigns the drawing workers bitmap to the new bitmap
         w.b = b;
         //Creates a new thread that has w start working
         t = new Thread(new ThreadStart(w.DoWork));
         //Sets the Form to the bottom right corner of the screen
         Rectangle workingArea = Screen.GetWorkingArea(this);
         Location = new Point(workingArea.Right - Size.Width,
                              workingArea.Bottom - Size.Height);
         //Starts the thread process
         t.Start();
     }
     catch (Exception)
     {
         //Throws this message if there isn't an image to execute
         MessageBox.Show("Oop!  There isn't an image to execute.  Please upload and grayscale your image.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #2
0
        public AutoScribe()
        {
            //Initializes the program
            InitializeComponent();

            //Sets the colors for the UI
            BackColor                 = Color.FromArgb(255, 217, 217, 217);
            menuStrip1.BackColor      = Color.FromArgb(255, 216, 246, 248);
            pBoxLeft.BackColor        = Color.FromArgb(255, 189, 214, 238);
            pBoxRight.BackColor       = Color.FromArgb(255, 189, 214, 238);
            btnExecute.BackColor      = Color.FromArgb(255, 255, 242, 204);
            menuHelp.BackColor        = Color.FromArgb(255, 255, 242, 204);
            menuExit.BackColor        = Color.FromArgb(255, 255, 242, 204);
            menuLoad.BackColor        = Color.FromArgb(255, 255, 242, 204);
            menuImageSearch.BackColor = Color.FromArgb(255, 255, 242, 204);
            trkThreshold.BackColor    = Color.FromArgb(255, 217, 217, 217);

            //Assigns a new drawing worker
            w = new DrawingWorker();
            //Registers a hotkey, that being the "Esc" key during the drawing process
            int     FirstHotkeyId  = 1;
            int     FirstHotKeyKey = (int)Keys.Escape;
            Boolean EscRegistered  = RegisterHotKey(
                this.Handle, FirstHotkeyId, 0x0000, FirstHotKeyKey
                );

            //Initializes the tooltips
            ToolTips();

            //Checks if the "Esc" key was registered successfully
            if (!EscRegistered)
            {//this error makes autoscribe horrible
                MessageBox.Show("Global Hotkey Esc couldn't be registered! meaning drawing tasks will not terminate manually. Closing Program");
                Application.Exit();
                Environment.Exit(0);
            }

            //Checks if the users resolution is 1080p
            if (Screen.PrimaryScreen.Bounds.Height != 1080 || Screen.PrimaryScreen.Bounds.Width != 1920)
            {//if the resolution is virtually or really wrong. close  program
                MessageBox.Show("Resolution for your primary monitor must be 1920x1080 with resolution scale of 100%. Please change this before restarting the program", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
                Environment.Exit(0);
            }
        }