using System; using System.Windows.Forms; using System.Drawing; using System.Drawing.Drawing2D; using System.Threading; class Joonis8:Form{ int x=10, vx=3; bool veel=true; public Joonis8(){ Thread t=new Thread(new ThreadStart(liigu)); t.Start(); } protected override void OnPaint(PaintEventArgs e){ base.OnPaint(e); Graphics g=e.Graphics; g.DrawEllipse(new Pen(Color.Green), x, 50, 20, 20); } void liigu(){ while(veel){ x+=vx; if(x>this.Width && vx>0){vx=-vx;} if(x<0 && vx<0){vx=-vx;} this.Invalidate(); Thread.Sleep(70); } } public static void Main(string[] arg){ Application.Run(new Joonis8()); } }