Advertisement
Guest User

Untitled

a guest
Apr 3rd, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1.  internal class Nodo
  2.     {
  3.         public Nodo(String lex, int dx, int dy)
  4.         {
  5.             X = dx;
  6.             Y = dy;
  7.             Nombre = lex;
  8.         }
  9.  
  10.         public void Painter(Graphics g)
  11.         {
  12.             g.DrawImage(Image, X - 15, Y - 15);
  13.  
  14.             var drawFont = new Font("Arial", 16);
  15.             var drawBrush = new SolidBrush(Color.Black);
  16.             g.DrawString("" + Nombre, drawFont, drawBrush, X - 20, Y - 20);
  17.         }
  18.  
  19.         public string Nombre { get; }
  20.  
  21.         public int X { get; private set; }
  22.  
  23.         public int Y { get; private set; }
  24.  
  25.         public void Transladar(int dx, int dy)
  26.         {
  27.             X += dx;
  28.             Y += dy;
  29.         }
  30.  
  31.         public Image Image { get; } //= Properties.Resources.esfera; //Descomentar
  32.  
  33.         public bool Haladopor(Point d) => Distance(d.X, d.Y) <= 15;
  34.  
  35.         public double Distance(int dx, int dy)
  36.         {
  37.             return Math.Sqrt((X - dx) * (X - dx) + (Y - dy) * (Y - dy));
  38.         }
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement