Both login dialogs react on Enter key (moves focus).
This commit is contained in:
Generated
+66
-65
@@ -31,71 +31,72 @@ namespace Users.Forms
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginDlg));
|
||||
this.aliasLabel = new System.Windows.Forms.Label();
|
||||
this.passwordLabel = new System.Windows.Forms.Label();
|
||||
this.passwordTextBox = new System.Windows.Forms.TextBox();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.userNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// aliasLabel
|
||||
//
|
||||
resources.ApplyResources(this.aliasLabel, "aliasLabel");
|
||||
this.aliasLabel.Name = "aliasLabel";
|
||||
this.aliasLabel.Click += new System.EventHandler(this.aliasLabel_Click);
|
||||
//
|
||||
// passwordLabel
|
||||
//
|
||||
resources.ApplyResources(this.passwordLabel, "passwordLabel");
|
||||
this.passwordLabel.Name = "passwordLabel";
|
||||
//
|
||||
// passwordTextBox
|
||||
//
|
||||
resources.ApplyResources(this.passwordTextBox, "passwordTextBox");
|
||||
this.passwordTextBox.Name = "passwordTextBox";
|
||||
this.passwordTextBox.UseSystemPasswordChar = true;
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
resources.ApplyResources(this.cancelButton, "cancelButton");
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// userNameTextBox
|
||||
//
|
||||
resources.ApplyResources(this.userNameTextBox, "userNameTextBox");
|
||||
this.userNameTextBox.Name = "userNameTextBox";
|
||||
//
|
||||
// LoginDlg
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.Controls.Add(this.userNameTextBox);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.passwordTextBox);
|
||||
this.Controls.Add(this.passwordLabel);
|
||||
this.Controls.Add(this.aliasLabel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Name = "LoginDlg";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Load += new System.EventHandler(this.LoginDlg_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginDlg));
|
||||
this.aliasLabel = new System.Windows.Forms.Label();
|
||||
this.passwordLabel = new System.Windows.Forms.Label();
|
||||
this.passwordTextBox = new System.Windows.Forms.TextBox();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.userNameTextBox = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// aliasLabel
|
||||
//
|
||||
resources.ApplyResources(this.aliasLabel, "aliasLabel");
|
||||
this.aliasLabel.Name = "aliasLabel";
|
||||
this.aliasLabel.Click += new System.EventHandler(this.aliasLabel_Click);
|
||||
//
|
||||
// passwordLabel
|
||||
//
|
||||
resources.ApplyResources(this.passwordLabel, "passwordLabel");
|
||||
this.passwordLabel.Name = "passwordLabel";
|
||||
//
|
||||
// passwordTextBox
|
||||
//
|
||||
resources.ApplyResources(this.passwordTextBox, "passwordTextBox");
|
||||
this.passwordTextBox.Name = "passwordTextBox";
|
||||
this.passwordTextBox.UseSystemPasswordChar = true;
|
||||
this.passwordTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.passwordTextBox_KeyPress);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
resources.ApplyResources(this.cancelButton, "cancelButton");
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
resources.ApplyResources(this.okButton, "okButton");
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// userNameTextBox
|
||||
//
|
||||
resources.ApplyResources(this.userNameTextBox, "userNameTextBox");
|
||||
this.userNameTextBox.Name = "userNameTextBox";
|
||||
this.userNameTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.userNameTextBox_KeyPress);
|
||||
//
|
||||
// LoginDlg
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.Controls.Add(this.userNameTextBox);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.passwordTextBox);
|
||||
this.Controls.Add(this.passwordLabel);
|
||||
this.Controls.Add(this.aliasLabel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Name = "LoginDlg";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.Load += new System.EventHandler(this.LoginDlg_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -184,5 +184,21 @@ namespace Users.Forms
|
||||
|
||||
aliasLabel.Text = GetAliasLabel();
|
||||
}
|
||||
|
||||
private void userNameTextBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (Convert.ToInt32(e.KeyChar) == 13)
|
||||
{
|
||||
passwordTextBox.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void passwordTextBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (Convert.ToInt32(e.KeyChar) == 13)
|
||||
{
|
||||
okButton_Click(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user