示例#1
0
 public Form2(List<string> wordList, string puzzleTitle, int difficultyIndex, int height, int width, Form1 form)
 {
     InitializeComponent();
     firstForm = form;
     Title = puzzleTitle;
     WordList = wordList;
     puzzleHeight = height;
     puzzleWidth = width;
     FormWordPuzzle = new WordPuzzle(wordList, puzzleHeight, puzzleWidth, difficultyIndex);
     DisplayPuzzle(FormWordPuzzle);
     showAnswers = false;
     BuildView();
 }
示例#2
0
 //Place the panels in the appropriate places on the form
 private void DisplayPuzzle(WordPuzzle wordPuzzle)
 {
     lettersPanel = new Panel();
     WordGrid gridToParse = wordPuzzle.puzzleGrid;
     for (int i = 0; i < gridToParse.Height; i++)
     {
         for (int j = 0; j < gridToParse.Width; j++)
         {
             Letter letterAtGridLoc = gridToParse.puzzle[i, j];
             char charAtGridLoc = letterAtGridLoc.PuzzleChar;
             bool isLetterInWord;
             isLetterInWord = letterAtGridLoc.IsPartOfWord;
             int charXLoc = j * 20 + 10;
             int charYloc = i * 20 + 5;
             Letter addThisLetter = new Letter(charAtGridLoc, isLetterInWord);
             TransparentLetter letterToAdd = AddLetter(letterAtGridLoc, charXLoc, charYloc);
             lettersPanel.Controls.Add(letterToAdd);
         }
     }
     puzzleHeight = gridToParse.Height * 20 + 10;
     puzzleWidth = gridToParse.Width * 20 + 15;
     lettersPanel.Size = new Size(puzzleWidth, puzzleHeight);
     lettersPanel.Location = new Point(20, 50);
     lettersPanel.BorderStyle = BorderStyle.FixedSingle;
 }