System.Windows.Forms.Form.ProcessDialogKey C# (CSharp) Method

ProcessDialogKey() protected method

protected ProcessDialogKey ( Keys keyData ) : bool
keyData Keys
return bool
		protected override bool ProcessDialogKey(Keys keyData) {
			if ((keyData & Keys.Modifiers) == 0) {
				if (keyData == Keys.Enter) {
					IntPtr window = XplatUI.GetFocus ();
					Control c = Control.FromHandle (window);
					if (c is Button && c.FindForm () == this) {
						((Button)c).PerformClick ();
						return true;
					}
					else if (accept_button != null) {
						accept_button.PerformClick();
						return true;
					}
				} else if (keyData == Keys.Escape && cancel_button != null) {
					cancel_button.PerformClick();
					return true;
				}
			}
			return base.ProcessDialogKey(keyData);
		}
Form