BattleShip.Cendre.OnPaint C# (CSharp) Метод

OnPaint() публичный Метод

public OnPaint ( PaintEventArgs ep ) : void
ep PaintEventArgs
Результат void
        public void OnPaint(PaintEventArgs ep)
        {
            if (this._watch.ElapsedMilliseconds <= this.speed)
            {
                // Calcul du X en fonction du temps
                double factor = Convert.ToDouble(this._watch.ElapsedMilliseconds) / Convert.ToDouble(this.speed);

                int x = this._from_x + Convert.ToInt32((this._to_x - this._from_x) * factor);

                // Même calcul pour le Y
                int y = this._from_y + Convert.ToInt32(Math.Abs(this._to_y - this._from_y) * factor);

                // Déplacement du cendre
                this.Location = new System.Drawing.Point(x, y);
            }
            ep.Graphics.DrawImage(this.img, this.Location);
        }
    }