private void NameTextBox_Leave(object sender, EventArgs e) { NameTextBox.Text = NameTextBox.Text.Trim(); if (!String.IsNullOrEmpty(NameTextBox.Text) && DomainTextBox.BackColor != M.TextBoxErrorColor && !String.IsNullOrEmpty(DomainTextBox.Text)) { OK_Button.Enabled = true; OK_Button.Focus(); } }
/// <summary> /// Palette domains are limited to 12 because that seems adequate. /// The domain is actually only limited by the width of palette forms. /// (There has to be enough space for the demo buttons.) /// </summary> private void DomainTextBox_Leave(object sender, EventArgs e) { M.LeaveIntRangeTextBox(DomainTextBox, false, 1, 0, 12, SetDialogState); if (DomainTextBox.BackColor != M.TextBoxErrorColor) { _domain = int.Parse(DomainTextBox.Text); if (!String.IsNullOrEmpty(NameTextBox.Text)) { OK_Button.Enabled = true; OK_Button.Focus(); } } else { OK_Button.Enabled = false; } }
public NotifyBoxInterface(string title, string message, NotifyBoxType type, NotifyBoxIcon icon) { InitializeComponent( ); TITLE_LABEL.Text = title; MESSAGE_LABEL.Text = message; this.SetStyle(ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true); this.UpdateStyles( ); this.Opacity = 0; switch (icon) { case NotifyBoxIcon.Error: TYPE_ICON.Image = Properties.Resources.ERROR_ICON; System.Media.SystemSounds.Hand.Play( ); break; case NotifyBoxIcon.Information: TYPE_ICON.Image = Properties.Resources.INFORMATION_ICON; System.Media.SystemSounds.Beep.Play( ); break; case NotifyBoxIcon.Warning: TYPE_ICON.Image = Properties.Resources.WARNING_ICON; System.Media.SystemSounds.Exclamation.Play( ); break; case NotifyBoxIcon.Question: TYPE_ICON.Image = Properties.Resources.QUESTION_ICON; System.Media.SystemSounds.Beep.Play( ); break; case NotifyBoxIcon.Danger: TYPE_ICON.Image = Properties.Resources.DANGER_ICON; System.Media.SystemSounds.Hand.Play( ); break; } switch (type) { case NotifyBoxType.OK: OK_Button.Visible = true; Yes_Button.Visible = false; NO_Button.Visible = false; OK_Button.Focus( ); this.FormClosing += delegate(object sender, FormClosingEventArgs e) { if (Result != NotifyBoxResult.OK) { Result = NotifyBoxResult.OK; } }; break; case NotifyBoxType.YesNo: OK_Button.Visible = false; Yes_Button.Visible = true; NO_Button.Visible = true; this.FormClosing += delegate(object sender, FormClosingEventArgs e) { if (Result != NotifyBoxResult.Yes && Result != NotifyBoxResult.No) { Result = NotifyBoxResult.No; } }; break; } }