private void pictureBox1_Paint(object sender, PaintEventArgs e) { var g = e.Graphics; g.Clear(Color.Black); g.SmoothingMode = SmoothingMode.AntiAlias; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.CompositingQuality = CompositingQuality.HighQuality; List <PointF> P = new List <PointF>(pictureBox1.Width); List <PointF> P2 = new List <PointF>(pictureBox1.Width); List <PointF> P3 = new List <PointF>(pictureBox1.Width); List <PointF> P4 = new List <PointF>(pictureBox1.Width); List <PointF> P5 = new List <PointF>(pictureBox1.Width); for (int i = 0; i < pictureBox1.Width; i++) { int p1 = (i + pos + 4000 - pictureBox1.Width) % 4000; P.Add(new PointF(i, ScaleVal(values[p1]))); P5.Add(new PointF(i, ScaleVal(valuesref[p1]))); P2.Add(new PointF(i, ScaleVal(linvalues[p1]))); P3.Add(new PointF(i, (pictureBox1.Height / 2) + ScaleVal(values2[i]))); P4.Add(new PointF(i, (pictureBox1.Height / 2) + ScaleVal(linvalues2[i]))); } g.DrawLines(new Pen(Color.Blue, 1.0f), P5.ToArray()); g.DrawLines(new Pen(Color.Green, 1.0f), P2.ToArray()); g.DrawLines(new Pen(Color.Yellow, 1.0f), P.ToArray()); g.DrawLines(new Pen(Color.Green, 1.0f), P4.ToArray()); g.DrawLines(new Pen(Color.Yellow, 1.0f), P3.ToArray()); g.DrawLine(new Pen(Color.BlueViolet), new PointF(0, ScaleVal(0.5)), new PointF(pictureBox1.Width - 1, ScaleVal(0.5))); g.DrawLine(new Pen(Color.Lime), new PointF(0, ScaleVal(0.95)), new PointF(pictureBox1.Width - 1, ScaleVal(0.95))); g.DrawLine(new Pen(Color.Lime), new PointF(0, ScaleVal(0.05)), new PointF(pictureBox1.Width - 1, ScaleVal(0.05))); g.DrawLine(new Pen(Color.BlueViolet), new PointF(0, (pictureBox1.Height / 2) + ScaleVal(0.5)), new PointF(pictureBox1.Width - 1, (pictureBox1.Height / 2) + ScaleVal(0.5))); for (int i = 0; i < 2; i++) { int B = TestFrameLoader.GetLFOGate(i); if (B > 0) { B = 255; } var C = Color.FromArgb(B, B, 0); Rectangle R = new Rectangle(); R.Width = 10; R.Height = 10; R.X = pictureBox1.Width - 12 - i * 12; R.Y = 2; g.FillRectangle(new SolidBrush(C), R); g.DrawRectangle(new Pen(Color.White, 1), R); } for (int i = 0; i < 18; i++) { int B = Math.Min(255, TestFrameLoader.GetLFOLed(i)); var C = Color.FromArgb(B, B, 0); Rectangle R = new Rectangle(); R.Width = 10; R.Height = 10; R.X = 2 + i * 12; R.Y = 2; g.FillRectangle(new SolidBrush(C), R); g.DrawRectangle(new Pen(Color.White, 1), R); } }