private void ImageSearch(FindBitmapWorker.ImageSearchDetails details) { lock (PlotDetailsLOCK) { detailsWaiting.Add(details); } }
private void plotValue(FindBitmapWorker.ImageSearchDetails details) { if (pictureBox1.InvokeRequired) { pictureBox1.Invoke(new MethodInvoker(() => { plotValue(details); })); } else { if (!counts.ContainsKey(details.type)) counts.Add(details.type, 0); using (Graphics g = Graphics.FromHwnd(pictureBox1.Handle)) { SolidBrush brush = new SolidBrush(Color.White); if (details.type.Equals(FindBitmapWorker.ImageSearchDetailsType.MatchCertainty)) g.FillRectangle(brush, new Rectangle(counts[details.type] - 1, 0, 5, pictureBox1.Height)); brush.Color = GetColor(details); g.FillRectangle(brush, new Rectangle(counts[details.type] - 1, pictureBox1.Height - GetAdjustedValue(details.currentValue) - 1, 2, 2)); brush.Color = Color.Red; g.FillRectangle(brush, new Rectangle(counts[details.type] - 1, pictureBox1.Height - GetAdjustedValue(details.thresholdValue), 1, 1)); } counts[details.type]++; if (counts[details.type] > pictureBox1.Width) { counts[details.type] = 0; } } }
private Color GetColor(FindBitmapWorker.ImageSearchDetails details) { switch (details.type) { case FindBitmapWorker.ImageSearchDetailsType.CertaintyDelta: return Color.Orange; case FindBitmapWorker.ImageSearchDetailsType.MatchCertainty: return Color.LimeGreen; default: return Color.Blue; } }