Browse Source

序列号Keydown文本自动全选

章政 7 years ago
parent
commit
fa6922bbb7

+ 7 - 1
UAS-MES/CustomControl/TextBoxWithIcon/SnCollectionBox.Designer.cs

@@ -30,7 +30,13 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
         /// </summary>
         private void InitializeComponent()
         {
-            components = new System.ComponentModel.Container();
+            this.SuspendLayout();
+            // 
+            // SnCollectionBox
+            // 
+            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SnCollectionBox_KeyDown);
+            this.ResumeLayout(false);
+
         }
 
       

+ 8 - 0
UAS-MES/CustomControl/TextBoxWithIcon/SnCollectionBox.cs

@@ -32,5 +32,13 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
                 base.Text = value;
             }
         }
+
+        private void SnCollectionBox_KeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.KeyCode == Keys.Enter)
+            {
+                this.SelectAll();
+            }
+        }
     }
 }