private void SetupControls() { label = new Label(); progressBar = new ProgressBar(); rectangle = new Rectangle(); rectangle.BorderStyle = BorderStyle.Double; rectangle.Height = 8; rectangle.Width = Width - 6; rectangle.Top = Height / 2 - rectangle.Height / 2; rectangle.Left = Width / 2 - rectangle.Width / 2; rectangle.HasShadow = true; label.Width = rectangle.Width - 4; label.Top = rectangle.Top + 2; label.Left = rectangle.Left + 2; label.TextAlign = TextAlign.Center; progressBar.Width = label.Width / 2; progressBar.ProgressBarStyle = ProgressBarStyle.Marquee; progressBar.Left = Width / 2 - progressBar.Width / 2; progressBar.Top = label.Top + 2; progressBar.BorderStyle = BorderStyle.Single; progressBar.BlockColor = ConsoleColor.Green; Controls.Add(rectangle, label, progressBar); }
public Menu(IControlContainer owner) { Owner = owner; Height = 1; TabStop = true; FocusBackgroundColor = ConsoleColor.Black; FocusForegroundColor = ConsoleColor.Gray; ForegroundColor = ConsoleColor.Black; BackgroundColor = ConsoleColor.Gray; rectangle = new Rectangle(); rectangle.Owner = owner; }
public LoginScreen(string name) : base(name) { usernameLabel = new Label(); passwordLabel = new Label(); usernameTextBox = new TextBox(); passwordTextBox = new TextBox(); rectangle = new Rectangle(); loginButton = new Button(); cancelButton = new Button(); failureLabel = new Label(); progressBar = new ProgressBar(); SetupControls(); loginButton.Click += LoginButton_Click; cancelButton.Click += CancelButton_Click; cancelButton.EscPressed += CancelButton_Click; loginButton.EscPressed += CancelButton_Click; usernameTextBox.EscPressed += CancelButton_Click; passwordTextBox.EscPressed += CancelButton_Click; passwordTextBox.KeyPressed += PasswordTextBox_KeyPressed; }