Ejemplo n.º 1
0
        private void AddWaveForm(String name, WaveForm w)
        {
            Label title = new Label();
            title.Text = name;
            title.Location = new Point(5, count * height + 35);
            this.Controls.Add(title);

            WaveFormPanel wave = new WaveFormPanel();
            this.Controls.Add(wave);
            wave.BackColor = Color.White;
            wave.Anchor = (AnchorStyles)(AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top);
            wave.Height = 22;
            wave.Width = this.Width - 125;
            wave.Location = new Point(120, count * height + 30);
            wave.WaveForm = w;
            wave.Paint += DrawWaveForm;
            count++;
        }
Ejemplo n.º 2
0
        public static void Draw(WaveForm w, Graphics gr)
        {
            int x = 0;
            Signal? prev = null;
            for (int i = 0; i < Simulator.Instance.Duration(); ++i)
            {
                Signal? s = w.Get(i);
                if (s.HasValue)
                {
                    if (prev != Signal.UNDEF && prev.HasValue && prev != s)
                        gr.DrawLine(pen, x, 20, x, 3);
                    prev = s;
                }
                else
                    s = prev;

                switch (s)
                {
                    case Signal.LOW:
                        gr.DrawLine(pen, x, 20, x + pixPerTick, 20);
                        break;
                    case Signal.HIGH:
                        gr.DrawLine(pen, x, 3, x + pixPerTick, 3);
                        break;
                    case Signal.UNDEF:
                        break;
                }
                x += pixPerTick;
            }
        }