コード例 #1
0
        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);

            for (int i = 0; i < pictureBox1.Width; i++)
            {
                int p1 = (i + pos + 4000 - pictureBox1.Width) % 4000;
                P.Add(new PointF(i, ScaleVal(values[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.Green, 2.0f), P2.ToArray());
            g.DrawLines(new Pen(Color.Yellow, 2.0f), P.ToArray());
            g.DrawLines(new Pen(Color.Green, 2.0f), P4.ToArray());
            g.DrawLines(new Pen(Color.Yellow, 2.0f), P3.ToArray());

            for (int i = 0; i < 4; i++)
            {
                int B = TestFrameLoader.GetGate(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 < 13; i++)
            {
                int       B = TestFrameLoader.GetLed(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      = 14;
                g.FillRectangle(new SolidBrush(C), R);
                g.DrawRectangle(new Pen(Color.White, 1), R);
            }
            Pen EnvPen = new Pen(Color.FromArgb(200, 200, 200));

            g.DrawLine(EnvPen, 5 + 2 + 12 * 0, 12, 5 + 2 + 12 * 3, 2);
            g.DrawLine(EnvPen, 5 + 2 + 12 * 3, 2, 5 + 2 + 12 * 6, 7);
            g.DrawLine(EnvPen, 5 + 2 + 12 * 6, 7, 5 + 2 + 12 * 9, 7);
            g.DrawLine(EnvPen, 5 + 2 + 12 * 9, 7, 5 + 2 + 12 * 12, 12);
        }