public class fulg { Graphics zona_des; public System.Drawing.Pen creion_a, creion_st; public int pozX, pozY, vX, vY, accX, accY, raza, w, h; public void desenez() { zona_des.DrawEllipse(creion_a, pozX, pozY, raza, raza); //zona_des.DrawLine(creion_a, pozX, pozY, pozX + vX, pozY+raza); } public void sterg() { zona_des.DrawEllipse(creion_st, pozX, pozY, raza, raza); //zona_des.DrawLine(creion_st, pozX, pozY, pozX + vX, pozY + raza); } public void deplasez() { pozX += vX; pozY += vY; if ((pozX > w - raza) || (pozX < 0)) { pozX = 0; } if ((pozY > h - raza) || (pozY < 0)) { pozY = 0; Random nrr = new System.Random(pozX); pozX = nrr.Next(w); } } public fulg(Graphics des, int r, int lung, int lat) { zona_des = des; creion_a = new System.Drawing.Pen(System.Drawing.Color.Blue); creion_st = new System.Drawing.Pen(System.Drawing.Color.White); System.Random nr = new System.Random(r); w = lung; h = lat; pozX = nr.Next(lung); pozY = nr.Next(lat); vX = 5; raza = 7 + nr.Next(4); vY = 5+nr.Next(raza); } }