Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Collections.ObjectModel;
- namespace WindowsFormsApplication5
- {
- public partial class Form1 : Form
- {
- Plot plot1, plot2;
- public Form1()
- {
- InitializeComponent();
- }
- struct SinWave
- {
- private int harm;
- private double ampl;
- private double phase;
- public SinWave(int harm, double ampl, double phase)
- {
- this.harm = harm;
- this.ampl = ampl;
- this.phase = phase;
- }
- public int Harm { get { return harm; } }
- public double Ampl { get { return ampl; } }
- public double Phase { get { return phase; } }
- }
- struct Waveform
- {
- static IList<SinWave> MySin;
- string name;
- bool enable;
- /*
- public Waveform(int a)
- {
- MySin = new Collection<SinWave>();
- name = "";
- enable = false;
- }
- * */
- public Waveform(IList<SinWave> a)
- {
- name = "";
- enable = true;
- }
- }
- struct Plot
- {
- public int x1;
- public int y1;
- public int x2; //refactor?
- public int y2;
- public double phase;
- public double scaledamp;
- public double periods;
- public int gridx;
- public int gridy;
- }
- private void WaveGraph_Paint_1(object sender, PaintEventArgs e)
- {
- plot1.x1 = 0;
- plot1.x2 = WaveformGraph.Width - 1;
- plot1.y1 = 0;
- plot1.y2 = WaveformGraph.Height - 1;
- Graphics g = e.Graphics;
- g.DrawRectangle(new Pen(Color.Black), plot1.x1, plot1.y1, plot1.x2 - plot1.x1, plot1.y2 - plot1.y1);
- }
- private void SinGraph_Paint(object sender, PaintEventArgs e)
- {
- plot2.x1 = 0;
- plot2.x2 = WaveformGraph.Width - 1;
- plot2.y1 = 0;
- plot2.y2 = WaveformGraph.Height - 1;
- Graphics g = e.Graphics;
- g.DrawRectangle(new Pen(Color.Black), plot2.x1, plot2.y1, plot2.x2 - plot2.x1, plot2.y2 - plot2.y1);
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- //Waveform Arbitrary;
- //Waveform Square;
- //Waveform Triangle;
- //Waveform Sawtoothleft;
- //Waveform Sawtoothright;
- /*
- IList<SinWave> Arbitrary = new Collection<SinWave>
- (new[] {
- new SinWave (1, 0, 0),
- new SinWave (2, 0, 0),
- new SinWave (3, 0, 0),
- new SinWave (4, 0, 0),
- new SinWave (5, 0, 0),
- new SinWave (6, 0, 0),
- new SinWave (7, 0, 0),
- new SinWave (8, 0, 0),
- new SinWave (9, 0, 0),
- new SinWave (10, 0, 0),
- //bool enable;
- //public Waveform(int a)
- });
- * */
- Waveform Arbitrary = new Waveform
- (new[] {
- new SinWave (1, 0, 0),
- new SinWave (2, 0, 0),
- new SinWave (3, 0, 0),
- new SinWave (4, 0, 0),
- new SinWave (5, 0, 0),
- new SinWave (6, 0, 0),
- new SinWave (7, 0, 0),
- new SinWave (8, 0, 0),
- new SinWave (9, 0, 0),
- new SinWave (10, 0, 0),
- //bool enable;
- //public Waveform(int a)
- });
- Arbitrary.name = "Arbitrary";
- }
- }
- }
Add Comment
Please, Sign In to add comment