/// <summary> /// 生成按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { int AllStar = 200; Random rd = new Random(DateTime.Now.Second); Bitmap pic1 = (Bitmap)pictureBox1.Image; bmpWidth = pic1.Width; bmpHigth = pic1.Height; for (int i = 0; i < AllStar; i++) { //W:1519 H:657 int roil = rd.Next(1, 10); int localx = rd.Next(pic1.Width - 10); int localy = rd.Next(pic1.Height - 10); int direct = rd.Next(0, 360); roillist.Add(roil); localxlist.Add(localx); localylist.Add(localy); EarthInfo eif = new EarthInfo(roil, localx, localy, i, direct); g_listEarth.Add(eif); } this.pictureBox1.Invalidate(); //get all earth EarthCacl.calcAllEarthDiss(ref g_listEarth); }
private void timer1_Tick(object sender, EventArgs e) { //combine earth EarthCacl.combineEarth(ref g_listEarth); //repoint this.pictureBox1.Invalidate(); //clac next point local EarthCacl.calcEarthExec(ref g_listEarth); //get disconect data EarthCacl.calcAllEarthDiss(ref g_listEarth); //get earth direct //F = G*M*m/R2 //V = V0 + at; //direct = clacCount++; richTextBox1.AppendText(clacCount.ToString() + "\r\n"); }