public UIPanelCollection(UIPanelSize size)
 {
     if (size.X < 0 || size.Y < 0)
     {
         throw new IndexOutOfRangeException();
     }
     Size          = new UIPanelSize(size.X, size.Y);
     ElementsArray = new UIPanel <T> [Size.X, Size.Y];
 }
 public UIPanelCollection(int x, int y)
 {
     if (x < 0 || y < 0)
     {
         throw new IndexOutOfRangeException();
     }
     Size          = new UIPanelSize(x, y);
     ElementsArray = new UIPanel <T> [Size.X, Size.Y];
 }
 public UIPanel <T> this[UIPanelSize coors]
 {
     get
     {
         if (coors.X < 0 || coors.Y < 0 || coors.X > Size.X || coors.Y > Size.Y)
         {
             throw new IndexOutOfRangeException();
         }
         return(ElementsArray[coors.X, coors.Y]);
     }
     set
     {
         if (coors.X < 0 || coors.Y < 0 || coors.X > Size.X || coors.Y > Size.Y)
         {
             throw new IndexOutOfRangeException();
         }
         ElementsArray[coors.X, coors.Y] = value;
     }
 }