Files
Sharpy_Picross/NonoGramme/Nonogramme.cs
T

35 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.Windows.Forms;
namespace NonoGramme
{
internal class Nonogramme : PictureBox
{
const int DEFAULT_GRID_SIZE = 5;
const int DEFAULT_UI_RATIO = 20;
private Size _gridSize;
private Grid _gameGrid;
public Size GridSize { get => _gridSize; set => _gridSize = value; }
internal Grid GameGrid { get => _gameGrid; set => _gameGrid = value; }
public Nonogramme()
{
GameGrid = new Grid(new Size(DEFAULT_GRID_SIZE,DEFAULT_GRID_SIZE));
}
public void NewGame(Size gridSize)
{
GameGrid = new Grid(gridSize);
}
public override void Refresh()
{
base.Refresh();
Bitmap bmp = new Bitmap(Width, Height);
this.Image = GameGrid.Draw(bmp, new Point((Width / 100) * DEFAULT_UI_RATIO, (Height / 100) * DEFAULT_UI_RATIO));
}
}
}