public BpmCalculator(Form1 form) { InitializeComponent(); formreference = form; fileDirectory = formreference.mp3Selector.FileName; int i = 0; foreach (var flux in form.song.Fluxes) { chart1.Series[0].Points.AddXY(++i, flux); } chart1.Width = form.song.Fluxes.Length; mover = new Thread(new ThreadStart(() => { while (true) { this.ThreadSafeCall(con => { BpmCalculator g = con as BpmCalculator; bool r = g.RightKey; bool l = g.LeftKey; if (l && !r) { g.chart1.Location = new Point(chart1.Location.X + 10, chart1.Location.Y); } if (r && !l) { g.chart1.Location = new Point(chart1.Location.X - 10, chart1.Location.Y); } }); Thread.Sleep(17); } })); mover.Start(); }
private void button1_Click(object sender, EventArgs e) { BpmCalculator Calc = new BpmCalculator(this); Calc.ShowDialog(); }