//Add a word instead of a letter private TransparentWord AddWord(string word, int x, int y) { TransparentWord newWord = new TransparentWord(); newWord.Font = new Font("Microsoft Sans Serif", 9F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0))); newWord.Text = word; newWord.Location = new Point(x, y); newWord.TextAlign = ContentAlignment.MiddleLeft; newWord.Size = new Size(150, 13); return newWord; }
//Place the controls on the form private void BuildView() { parentPanel = new Panel(); TransparentWord puzzleTitleLabel = new TransparentWord(); puzzleTitleLabel.Text = Title; puzzleTitleLabel.TextAlign = ContentAlignment.MiddleCenter; puzzleTitleLabel.AutoSize = true; puzzleTitleLabel.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0))); int puzzleTitleX = (lettersPanel.Width) / 2; puzzleTitleLabel.Left = puzzleTitleX; puzzleTitleLabel.Top = 30; AddWordBox(puzzleWidth, puzzleHeight, this.WordList); parentPanel.Width = lettersPanel.Width + 60; parentPanel.Height = lettersPanel.Height +wordsPanel.Height + 100; parentPanel.Controls.Add(puzzleTitleLabel); parentPanel.Controls.Add(lettersPanel); parentPanel.Controls.Add(wordsPanel); parentPanel.BackColor = System.Drawing.Color.Transparent; parentPanel.BorderStyle = BorderStyle.None; this.Width = lettersPanel.Width + 60; this.Height = lettersPanel.Height + wordsPanel.Height + 100; this.Controls.Add(parentPanel); }