The teacher assigned the project needs to compile software, just recently has been playing on the mobile phone sudoku, so you want to spend free time to write a PC on a single-machine version of the Sudoku mini-game, practice their own programming skills. There is no guarantee that every day there is time to spend on this small program, but will try to stick to it, every completion of a little things, will be the core code and the relevant information found out, is still in the grammar has not finished the stage, want to take this opportunity to record their growth ~
First, UI design
1. Use ComboBox control to select game difficulty;
2. Use the Label control to display the cumulative time of the game;
3. Nine background is a Label control that sets the background color;
4. Each grid is a Textbox control with its "Multiline" property set to "True" so that it can be adjusted to its height (refer to link); nine UI when start/pause/Resume/end Game The corresponding changes are as follows:
4.1 Start game: Nine Gongge show the topic;
4.2 Pause the game: Cover the topic with a separate drawn Label (hidelabel.visible = true;);
4.3 Continue the game: Hide the Label used to cover the topic;
4.4 End Game: Nine Gongge all Textbox emptied.
5. After clicking the "Start Game" button, the button text changes to "pause the game", then each time you click this button, the text will appear as "continue game" and "Pause the game", plus "Stop game" button.
Here you need to call the corresponding code in the Button_Click () event based on the different button text, Resharper the If ... Else If ... Else statement to replace the Switch statement, suddenly think of two kinds of statements which is an efficient problem, so on the StackOverflow to find such a discussion post, according to the content of the discussion, for judging conditions only three different values, whether using the IF statement or Switch The statement is completely no problem, haha.
Reference link: What are quicker, switch on string or ElseIf on type? (The discussion is very exciting)
The current game interface:
C # program Two-Sudoku mini-game (1. UI design)