[Mono-bugs] [Bug 79907][Wis] New - Esc key closes form

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Nov 11 14:55:34 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by kobruleht2 at hot.ee.

http://bugzilla.ximian.com/show_bug.cgi?id=79907

--- shadow/79907	2006-11-11 14:55:34.000000000 -0500
+++ shadow/79907.tmp.27715	2006-11-11 14:55:34.000000000 -0500
@@ -0,0 +1,127 @@
+Bug#: 79907
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: kobruleht2 at hot.ee               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Esc key closes form
+
+To reproduce:
+
+1. Run the code in Windows XP with 1.2RC0
+2. Press Esc 
+
+Observed: Application exists.
+
+Expected: Application must remain active.
+
+----- form1.cs
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace esckeyclosesmainform
+{
+    public partial class Form1 : Form
+    {
+        public Form1()
+        {
+            InitializeComponent();
+        }
+
+        private void Form1_KeyPress(object sender, KeyPressEventArgs e)
+        {
+            if ((int)e.KeyChar == (int)System.Windows.Forms.Keys.Escape)
+            {
+                this.Close();
+            }
+
+
+        }
+    }
+}
+
+--- form1.designer.cs
+
+namespace esckeyclosesmainform
+{
+    partial class Form1
+    {
+        private System.ComponentModel.IContainer components = null;
+
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.components = new System.ComponentModel.Container();
+            this.mainMenu1 = new System.Windows.Forms.MainMenu();
+            this.SuspendLayout();
+            // 
+            // Form1
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(292, 273);
+            this.IsMdiContainer = true;
+            this.Menu = this.mainMenu1;
+            this.Name = "Form1";
+            this.Text = "Form1";
+            this.KeyPress += new System.Windows.Forms.KeyPressEventHandler
+(this.Form1_KeyPress);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.MainMenu mainMenu1;
+    }
+}
+
+----- program.cs
+
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace esckeyclosesmainform
+{
+    static class Program
+    {
+        [STAThread]
+        static void Main()
+        {
+            Application.EnableVisualStyles();
+            Application.SetCompatibleTextRenderingDefault(false);
+            Application.Run(new Form1());
+        }
+    }
+}


More information about the mono-bugs mailing list