align="justify">. Фролов А.В. Фролов Г.В.- Мова С #.
. Культін Н.Б. Microsoft Visual C # в задачах і прикладах.
ДОДАТОК
Лістинг програми
using System;
using System.Collections.Generic;System.ComponentModel;System.Data;System.Drawing;System.Linq;System.Text;System.Windows.Forms;FormsApplication {partial class Form1: Form {radius; xpos, ypos, xVel, yVel, friction, braking; rand; framerate; viewport; brush; background; Form1 () {();=20;=new Random ();=rand. Next (radius, (this.Width - radius));=rand.Next (radius, (this.Height - radius));
//Velocity of the circle=0;=0; =. 99; =. 7;=new Timer () ;. Interval=33;// 30 frame/second.Tick +=new EventHandler (this.render) ;. Start ();=this.CreateGraphics ();=new SolidBrush (Color.Blue);=BackColor;
} void render (object sender, EventArgs e) {
//Clear all.Clear (background);
//Processing +=xVel; +=yVel; (xpos lt; radius) {= radius; *=-braking;
} else if (xpos gt; (this.Width - radius)) {= this.Width - radius; *=-braking;
} (ypos lt; radius) {= radius; *=-braking;
} else if (ypos gt; (this.Height - radius - 30)) {= this.Height - radius - 30; *=-braking;
} *=friction; *=friction; ((int) (xVel + yVel) == 0) {= yVel=0; .Stop ();
}
//Render.FillEllipse (brush, (Convert.ToInt32 (xpos) - radius), (Convert.ToInt32 (ypos) - radius), (radius + radius), (radius + radius)) ;
} override void OnClick (EventArgs e) {.OnClick (e); mousePoint=PointToClient (MousePosition);=force (xpos, mousePoint.X, .14, .85, xVel);=force (ypos, mousePoint.Y, .14, .85, yVel) ;. Start ();
} double force (double orig, int dest, double springConst, double damp, double vel) {+=-springConst * (orig - (double) dest); vel *=damp;
}
}
}