Skip to content
Snippets Groups Projects
Commit e59bfce1 authored by Elias Leinenweber's avatar Elias Leinenweber
Browse files

Passé la map en propriété du contrôle

parent e1ca4666
Branches
Tags
No related merge requests found
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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment