Added drawing of the hints
This commit is contained in:
+45
-4
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -13,20 +14,28 @@ namespace NonoGramme
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
const int UI_BORDER = 30;
|
||||
|
||||
string selectedFolder;
|
||||
string selectedNonoGram;
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
nonogramme1.NewGame(new Size(5,5));
|
||||
NewGame();
|
||||
}
|
||||
private void NewGame()
|
||||
{
|
||||
nonogramme1.NewRandomGame(new Size(5, 5));
|
||||
nonogramme1.Refresh();
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
ScaleUi();
|
||||
//ScaleUi();
|
||||
}
|
||||
|
||||
private void Form1_Resize(object sender, EventArgs e)
|
||||
{
|
||||
ScaleUi();
|
||||
//ScaleUi();
|
||||
}
|
||||
private void ScaleUi()
|
||||
{
|
||||
@@ -38,8 +47,40 @@ namespace NonoGramme
|
||||
{
|
||||
nonogramme1.Size = new Size(ClientSize.Width - UI_BORDER, ClientSize.Width);
|
||||
}
|
||||
|
||||
nonogramme1.Refresh();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog dialog = new FolderBrowserDialog();
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
selectedFolder = dialog.SelectedPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Ooops... Could not retrieve folder informations :(");
|
||||
}
|
||||
|
||||
if (Directory.Exists(selectedFolder))
|
||||
{
|
||||
string[] nonFiles = Directory.GetFiles(selectedFolder, "*.non");
|
||||
|
||||
foreach (string file in nonFiles)
|
||||
{
|
||||
lsbFiles.Items.Add(Path.GetFileName(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void lsbFiles_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string selectedFile = selectedFolder + "\\" + lsbFiles.Items[lsbFiles.SelectedIndex];
|
||||
if (Directory.Exists(selectedFolder) && File.Exists(selectedFile))
|
||||
{
|
||||
selectedNonoGram = selectedFile;
|
||||
nonogramme1.LoadNewGame(selectedNonoGram);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user