/// <summary> /// When the UserInputBox is clicked, it removes the example text and sets color of font to app default. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UserInputBox_Click(object sender, EventArgs e) { UserInputBox.ForeColor = Color.White; if (UserInputBox.Text == arrayInputEx) { UserInputBox.Clear(); } if (UserInputBox.BackColor == Color.FromArgb(236, 188, 188)) { UserInputBox.BackColor = Color.FromArgb(44, 44, 44); } }
public GameRenderer() { _gameWindow = new TextBox(1, 1, Console.WindowWidth - 1, Console.WindowHeight - 1); _inputBox = new UserInputBox(_gameWindow.LeftPos + 10, (_gameWindow.Height - 3) / 2, _gameWindow.Width - 20); _titlebox = new TextBox((_gameWindow.LeftPos + _gameWindow.Width - 12) / 2, _gameWindow.TopPos + 1, 13); _typingSpeedIndicator = new TextBox(_inputBox.LeftPos + _inputBox.Width - 23, _inputBox.TopPos - 3, 23); _timeLeft = new TextBox(_inputBox.LeftPos, _inputBox.TopPos - 3, 19); _promptWindow = new TextBox((_gameWindow.LeftPos + _gameWindow.Width - 80) / 2, (_gameWindow.Height - 3) / 2, 80); _typingAccuracyBox = new TextBox((Console.WindowWidth - 31) / 2, _promptWindow.TopPos + 3, 31); _typingSpeedBox = new TextBox((Console.WindowWidth - 31) / 2, _typingAccuracyBox.TopPos + 3, _typingAccuracyBox.Width); _typosBox = new TextBox(0, _typingSpeedBox.TopPos + 3, 0); }
private void AlgoListBox_SelectedIndexChanged(object sender, EventArgs e) { AdditionalInputLabel.Visible = false; AdditionalInputTxtBox.Visible = false; AnswerTxtBox.Clear(); UserInputBox.Clear(); AdditionalInputTxtBox.Clear(); currentSelection = AlgoListBox.SelectedItem.ToString(); switch (AlgoListBox.SelectedItem.ToString()) { case "Find three largest numbers in array": UserInputLabel.Text = arrayInputLabel; UserInputBox.ForeColor = Color.Gray; UserInputBox.Text = arrayInputEx; InstructionTxtBox.Text = Properties.Resources.FindThreeLargestNumsInfoTxt; //CodePreviewBox.Text = TextConnector.FullFilePath("FindThreeLargestNumsCode.txt").LoadFile(); CodePreviewBox.Text = Properties.Resources.FindThreeLargestNumsInfoTxt; break; case "Move elements in array to end": AdditionalInputLabel.Visible = true; AdditionalInputTxtBox.Visible = true; AdditionalInputLabel.Text = "Enter an integer that is in the first array"; UserInputLabel.Text = arrayInputLabel; UserInputBox.ForeColor = Color.Gray; UserInputBox.Text = arrayInputEx; InstructionTxtBox.Text = Properties.Resources.MoveToEndInfoTxt; CodePreviewBox.Text = Properties.Resources.MoveToEndCode; break; case "Palindrome validator": UserInputLabel.Text = "Enter possible Palindrome"; InstructionTxtBox.Text = Properties.Resources.PalindromeCheckerInfoTxt; CodePreviewBox.Text = Properties.Resources.PalindromeCheckerCode; break; case "Sub sequence validator": AdditionalInputLabel.Visible = true; AdditionalInputTxtBox.Visible = true; UserInputLabel.Text = arrayInputLabel; UserInputBox.Text = arrayInputEx; UserInputBox.ForeColor = Color.Gray; AdditionalInputLabel.Text = "Enter potential subsequence"; AdditionalInputTxtBox.Text = arrayInputEx; AdditionalInputTxtBox.ForeColor = Color.Gray; InstructionTxtBox.Text = Properties.Resources.SubsequenceInfoTxt; CodePreviewBox.Text = Properties.Resources.SubsetCheckerCode; break; case "Nth Fibonacci": UserInputLabel.Text = "Enter integer "; InstructionTxtBox.Text = Properties.Resources.NthFibonacciInfoTxt; CodePreviewBox.Text = Properties.Resources.NthFibonacciCode; break; default: break; } }
private void ClearButton_Click(object sender, EventArgs e) { UserInputBox.Clear(); AnswerTxtBox.Clear(); AdditionalInputTxtBox.Clear(); }