Exemple #1
0
        public PuzzleForm()
        {
            solver = new Thread(solvePuzzle);

            buttonTimer           = new System.Timers.Timer();
            buttonTimer.Interval  = 1000;
            buttonTimer.AutoReset = true;
            buttonTimer.Elapsed  += UpdateButton;

            puzzleImage = Image.FromFile("background.jpg");
            Text        = "Slider Puzzle";

            MenuStrip         menu      = new MenuStrip();
            ToolStripMenuItem imgButton = new ToolStripMenuItem();

            imgButton.Text   = "Image";
            imgButton.Click += ChooseFile;
            menu.Items.Add(imgButton);

            ToolStripMenuItem sizeButton = new ToolStripMenuItem();

            sizeButton.Text   = "Settings";
            sizeButton.Click += ShowSettings;
            menu.Items.Add(sizeButton);

            ToolStripMenuItem shuffleButton = new ToolStripMenuItem();

            shuffleButton.Text   = "Shuffle";
            shuffleButton.Click += ShuffleClick;
            menu.Items.Add(shuffleButton);

            ToolStripMenuItem aboutButton = new ToolStripMenuItem();

            aboutButton.Text   = "About";
            aboutButton.Click += AboutClick;
            menu.Items.Add(aboutButton);

            solveButton           = new ToolStripMenuItem();
            solveButton.Text      = "Solve";
            solveButton.Click    += Solve;
            solveButton.Alignment = ToolStripItemAlignment.Right;
            menu.Items.Add(solveButton);

            menu.Dock = DockStyle.Top;
            Controls.Add(menu);

            open        = new OpenFileDialog();
            open.Filter = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png";

            settings = new ResizeForm(this);
            SetBackgroundImage();
        }
Exemple #2
0
        public PuzzleForm()
        {
            solver = new Thread(solvePuzzle);
            
            buttonTimer = new System.Timers.Timer();
            buttonTimer.Interval = 1000;
            buttonTimer.AutoReset = true;
            buttonTimer.Elapsed += UpdateButton;

            puzzleImage = Image.FromFile("background.jpg");
            Text = "Slider Puzzle";

            MenuStrip menu = new MenuStrip();
            ToolStripMenuItem imgButton = new ToolStripMenuItem();
            imgButton.Text = "Image";
            imgButton.Click += ChooseFile;
            menu.Items.Add(imgButton);

            ToolStripMenuItem sizeButton = new ToolStripMenuItem();
            sizeButton.Text = "Settings";
            sizeButton.Click += ShowSettings;
            menu.Items.Add(sizeButton);

            ToolStripMenuItem shuffleButton = new ToolStripMenuItem();
            shuffleButton.Text = "Shuffle";
            shuffleButton.Click += ShuffleClick;
            menu.Items.Add(shuffleButton);

            ToolStripMenuItem aboutButton = new ToolStripMenuItem();
            aboutButton.Text = "About";
            aboutButton.Click += AboutClick;
            menu.Items.Add(aboutButton);
            
            solveButton = new ToolStripMenuItem();
            solveButton.Text = "Solve";
            solveButton.Click += Solve;
            solveButton.Alignment = ToolStripItemAlignment.Right;
            menu.Items.Add(solveButton);

            menu.Dock = DockStyle.Top;
            Controls.Add(menu);

            open = new OpenFileDialog();
            open.Filter = "Image files (*.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.jpg; *.jpeg; *.jpe; *.jfif; *.png";

            settings = new ResizeForm(this);
            SetBackgroundImage();
        }