private void mBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = e.Argument as BackgroundWorker; PixelInfo info = new PixelInfo(); while (true) { if (Locked == false) { Point mp = Control.MousePosition; info.Image = PixelSearch.CaptureScreenRegion(new Rectangle(mp.X, mp.Y, CaptureSize.Width, CaptureSize.Height)); info.Position = mp; info.Color = info.Image.GetPixel(CaptureSize.Width / 2, CaptureSize.Height / 2); worker.ReportProgress(0, info); } System.Threading.Thread.Sleep(10); } }
public static Point Search(Rectangle rect, Color PixelColor, Color Shade_Variation, ref Image Img) { return(PixelSearch.Search(rect, PixelColor.ToArgb(), Shade_Variation.ToArgb(), ref Img)); }