private void RefreshDimensions() { bmpRaw = new Bitmap((int)Math.Round((int)NumBoxScale.Value * RATIO), (int)NumBoxScale.Value, System.Drawing.Imaging.PixelFormat.Format24bppRgb); bmpProc = new Bitmap((int)Math.Round((int)NumBoxScale.Value * RATIO), (int)NumBoxScale.Value, System.Drawing.Imaging.PixelFormat.Format1bppIndexed); bounds = new Rectangle((int)NumBoxX.Value, (int)NumBoxY.Value, (int)Math.Round((int)NumBoxScale.Value * RATIO), (int)NumBoxScale.Value); screenToBMP(); ImgRaw.Refresh(); ImgProc.Refresh(); }
private void MainLoop(object sender, DoWorkEventArgs e) { while (!(sender as BackgroundWorker).CancellationPending) { screenToBMP(); if (processBmp()) { Invoke(new Action(() => { StatusStrip.BackColor = System.Drawing.Color.FromArgb(255, 180, 0, 0); StatusLabel.Text = (int.Parse(StatusLabel.Text) + 1).ToString(); })); UpdateLights(); Invoke(new Action(() => StatusStrip.BackColor = System.Drawing.Color.FromArgb(255, 48, 48, 48))); } Invoke(new Action(() => { ImgRaw.Refresh(); ImgProc.Refresh(); })); } }