diff --git a/view/Controls/MapView.cs b/view/Controls/MapView.cs index 71fbd8b707485fef1ed47f2d9b591344bd45f542..a28db89e69f8a592ce8036776c9a96c2bdab5137 100644 --- a/view/Controls/MapView.cs +++ b/view/Controls/MapView.cs @@ -1,4 +1,7 @@ -using System.Windows.Forms; +using System.ComponentModel; +using System.Drawing.Design; +using System.Windows.Forms; +using System.Windows.Forms.Design; namespace Wanderer.view.Controls { @@ -6,19 +9,27 @@ namespace Wanderer.view.Controls { private TileView[,] tileViews; - public MapView(Map map) + [Category("Model")] + [Browsable(true)] + [Description("La map correspondante.")] + [Editor(typeof(WindowsFormsComponentEditor), typeof(UITypeEditor))] + public Map Model { + set { + ColumnCount = value.Tiles.GetLength(0); + RowCount = value.Tiles.GetLength(1); + + for (int i = 0; i < ColumnCount; ++i) + for (int j = 0; j < RowCount; ++j) + { + tileViews[i, j] = new TileView(value.Tiles[i, j]); + Controls.Add(tileViews[i, j], i, j); + } + } + } + + public MapView() { InitializeComponent(); - - ColumnCount = map.Tiles.GetLength(0); - RowCount = map.Tiles.GetLength(1); - - for (int i = 0; i < ColumnCount; ++i) - for (int j = 0; j < RowCount; ++j) - { - tileViews[i, j] = new TileView(map.Tiles[i, j]); - Controls.Add(tileViews[i, j], i, j); - } } } } \ No newline at end of file