Sfoglia il codice sorgente

优先响应窗体KeyDown事件

章政 7 anni fa
parent
commit
782792a0f1

+ 3 - 2
UAS_DeviceMonitor/Device/Information/DeviceDetailInfo.Designer.cs

@@ -244,12 +244,13 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.Controls.Add(this.GridDeviceDetailInfo);
             this.Controls.Add(this.groupControl1);
             this.FormBorderEffect = DevExpress.XtraEditors.FormBorderEffect.None;
+            this.KeyPreview = true;
             this.MaximizeBox = false;
             this.Name = "DeviceDetailInfo";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
             this.Text = " ";
-            this.Load += new System.EventHandler(this.DeviceStatusInfo_Load);
-            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DeviceStatusInfo_KeyDown);
+            this.Load += new System.EventHandler(this.DeviceDetailInfo_Load);
+            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DeviceDetailInfo_KeyDown);
             ((System.ComponentModel.ISupportInitialize)(this.groupControl1)).EndInit();
             this.groupControl1.ResumeLayout(false);
             this.groupControl1.PerformLayout();

+ 2 - 11
UAS_DeviceMonitor/Device/Information/DeviceDetailInfo.cs

@@ -21,13 +21,6 @@ namespace UAS_DeviceMonitor.Device.Infomation
         {
             InitializeComponent();
             repositoryItemCheckEdit1.QueryCheckStateByValue += RepositoryItemCheckEdit1_QueryCheckStateByValue;
-            KeyDown += DeviceDetailInfo_KeyDown;
-        }
-
-        private void DeviceDetailInfo_KeyDown(object sender, KeyEventArgs e)
-        {
-            if (e.KeyCode == Keys.Escape)
-                Close();
         }
 
         private void RepositoryItemCheckEdit1_QueryCheckStateByValue(object sender, DevExpress.XtraEditors.Controls.QueryCheckStateByValueEventArgs e)
@@ -67,7 +60,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             Text = DevcieCode;
         }
 
-        private void DeviceStatusInfo_Load(object sender, EventArgs e)
+        private void DeviceDetailInfo_Load(object sender, EventArgs e)
         {
             DataTable dt = (DataTable)dh.ExecuteSql("select * from devicenetconfig where dnc_decode='" + de_code + "'", "select");
             if (dt.Rows.Count > 0)
@@ -78,12 +71,10 @@ namespace UAS_DeviceMonitor.Device.Infomation
             GridDeviceDetailInfo.DataSource = dt;
         }
 
-        private void DeviceStatusInfo_KeyDown(object sender, KeyEventArgs e)
+        private void DeviceDetailInfo_KeyDown(object sender, KeyEventArgs e)
         {
             if (e.KeyCode == Keys.Escape)
-            {
                 Close();
-            }
         }
     }
 }

+ 73 - 72
UAS_DeviceMonitor/Device/Information/DeviceStatusInfo.Designer.cs

@@ -31,12 +31,8 @@ namespace UAS_DeviceMonitor.Device.Infomation
         private void InitializeComponent()
         {
             this.groupControl1 = new DevExpress.XtraEditors.GroupControl();
-            this.de_linecode = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
-            this.de_address = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
             this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
-            this.de_wccode = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
             this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
-            this.de_name = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
             this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
             this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
             this.groupControl2 = new DevExpress.XtraEditors.GroupControl();
@@ -48,12 +44,16 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.labelControl12 = new DevExpress.XtraEditors.LabelControl();
             this.labelControl10 = new DevExpress.XtraEditors.LabelControl();
             this.labelControl9 = new DevExpress.XtraEditors.LabelControl();
-            this.dpg_starttime = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
             this.labelControl14 = new DevExpress.XtraEditors.LabelControl();
-            this.dpg_senddatasize = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
-            this.dpg_receivedatasize = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
-            this.dpg_count = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
             this.groupControl3 = new DevExpress.XtraEditors.GroupControl();
+            this.dpg_count = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            this.dpg_receivedatasize = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            this.dpg_senddatasize = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            this.dpg_starttime = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            this.de_linecode = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            this.de_address = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            this.de_wccode = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
+            this.de_name = new UAS_DeviceMonitor.CustomerControl.ValueLabel.ValueLabel();
             ((System.ComponentModel.ISupportInitialize)(this.groupControl1)).BeginInit();
             this.groupControl1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.groupControl2)).BeginInit();
@@ -78,22 +78,6 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.groupControl1.TabIndex = 0;
             this.groupControl1.Text = "设备信息";
             // 
-            // de_linecode
-            // 
-            this.de_linecode.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.de_linecode.Location = new System.Drawing.Point(70, 137);
-            this.de_linecode.Name = "de_linecode";
-            this.de_linecode.Size = new System.Drawing.Size(0, 16);
-            this.de_linecode.TabIndex = 19;
-            // 
-            // de_address
-            // 
-            this.de_address.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.de_address.Location = new System.Drawing.Point(70, 106);
-            this.de_address.Name = "de_address";
-            this.de_address.Size = new System.Drawing.Size(0, 16);
-            this.de_address.TabIndex = 18;
-            // 
             // labelControl4
             // 
             this.labelControl4.Appearance.Font = new System.Drawing.Font("黑体", 12F);
@@ -103,14 +87,6 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.labelControl4.TabIndex = 6;
             this.labelControl4.Text = "线体";
             // 
-            // de_wccode
-            // 
-            this.de_wccode.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.de_wccode.Location = new System.Drawing.Point(70, 74);
-            this.de_wccode.Name = "de_wccode";
-            this.de_wccode.Size = new System.Drawing.Size(0, 16);
-            this.de_wccode.TabIndex = 17;
-            // 
             // labelControl3
             // 
             this.labelControl3.Appearance.Font = new System.Drawing.Font("黑体", 12F);
@@ -120,14 +96,6 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.labelControl3.TabIndex = 5;
             this.labelControl3.Text = "区域";
             // 
-            // de_name
-            // 
-            this.de_name.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.de_name.Location = new System.Drawing.Point(70, 41);
-            this.de_name.Name = "de_name";
-            this.de_name.Size = new System.Drawing.Size(0, 16);
-            this.de_name.TabIndex = 16;
-            // 
             // labelControl2
             // 
             this.labelControl2.Appearance.Font = new System.Drawing.Font("黑体", 12F);
@@ -230,14 +198,6 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.labelControl9.TabIndex = 14;
             this.labelControl9.Text = "接收字节";
             // 
-            // dpg_starttime
-            // 
-            this.dpg_starttime.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dpg_starttime.Location = new System.Drawing.Point(101, 41);
-            this.dpg_starttime.Name = "dpg_starttime";
-            this.dpg_starttime.Size = new System.Drawing.Size(0, 16);
-            this.dpg_starttime.TabIndex = 0;
-            // 
             // labelControl14
             // 
             this.labelControl14.Appearance.Font = new System.Drawing.Font("黑体", 12F);
@@ -247,30 +207,6 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.labelControl14.TabIndex = 15;
             this.labelControl14.Text = "轮询次数";
             // 
-            // dpg_senddatasize
-            // 
-            this.dpg_senddatasize.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dpg_senddatasize.Location = new System.Drawing.Point(101, 106);
-            this.dpg_senddatasize.Name = "dpg_senddatasize";
-            this.dpg_senddatasize.Size = new System.Drawing.Size(0, 16);
-            this.dpg_senddatasize.TabIndex = 1;
-            // 
-            // dpg_receivedatasize
-            // 
-            this.dpg_receivedatasize.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dpg_receivedatasize.Location = new System.Drawing.Point(101, 139);
-            this.dpg_receivedatasize.Name = "dpg_receivedatasize";
-            this.dpg_receivedatasize.Size = new System.Drawing.Size(0, 16);
-            this.dpg_receivedatasize.TabIndex = 2;
-            // 
-            // dpg_count
-            // 
-            this.dpg_count.Appearance.Font = new System.Drawing.Font("黑体", 12F);
-            this.dpg_count.Location = new System.Drawing.Point(101, 172);
-            this.dpg_count.Name = "dpg_count";
-            this.dpg_count.Size = new System.Drawing.Size(0, 16);
-            this.dpg_count.TabIndex = 3;
-            // 
             // groupControl3
             // 
             this.groupControl3.Controls.Add(this.dpg_count);
@@ -288,6 +224,70 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.groupControl3.TabIndex = 2;
             this.groupControl3.Text = "运行信息";
             // 
+            // dpg_count
+            // 
+            this.dpg_count.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.dpg_count.Location = new System.Drawing.Point(101, 172);
+            this.dpg_count.Name = "dpg_count";
+            this.dpg_count.Size = new System.Drawing.Size(0, 16);
+            this.dpg_count.TabIndex = 3;
+            // 
+            // dpg_receivedatasize
+            // 
+            this.dpg_receivedatasize.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.dpg_receivedatasize.Location = new System.Drawing.Point(101, 139);
+            this.dpg_receivedatasize.Name = "dpg_receivedatasize";
+            this.dpg_receivedatasize.Size = new System.Drawing.Size(0, 16);
+            this.dpg_receivedatasize.TabIndex = 2;
+            // 
+            // dpg_senddatasize
+            // 
+            this.dpg_senddatasize.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.dpg_senddatasize.Location = new System.Drawing.Point(101, 106);
+            this.dpg_senddatasize.Name = "dpg_senddatasize";
+            this.dpg_senddatasize.Size = new System.Drawing.Size(0, 16);
+            this.dpg_senddatasize.TabIndex = 1;
+            // 
+            // dpg_starttime
+            // 
+            this.dpg_starttime.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.dpg_starttime.Location = new System.Drawing.Point(101, 41);
+            this.dpg_starttime.Name = "dpg_starttime";
+            this.dpg_starttime.Size = new System.Drawing.Size(0, 16);
+            this.dpg_starttime.TabIndex = 0;
+            // 
+            // de_linecode
+            // 
+            this.de_linecode.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.de_linecode.Location = new System.Drawing.Point(70, 137);
+            this.de_linecode.Name = "de_linecode";
+            this.de_linecode.Size = new System.Drawing.Size(0, 16);
+            this.de_linecode.TabIndex = 19;
+            // 
+            // de_address
+            // 
+            this.de_address.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.de_address.Location = new System.Drawing.Point(70, 106);
+            this.de_address.Name = "de_address";
+            this.de_address.Size = new System.Drawing.Size(0, 16);
+            this.de_address.TabIndex = 18;
+            // 
+            // de_wccode
+            // 
+            this.de_wccode.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.de_wccode.Location = new System.Drawing.Point(70, 74);
+            this.de_wccode.Name = "de_wccode";
+            this.de_wccode.Size = new System.Drawing.Size(0, 16);
+            this.de_wccode.TabIndex = 17;
+            // 
+            // de_name
+            // 
+            this.de_name.Appearance.Font = new System.Drawing.Font("黑体", 12F);
+            this.de_name.Location = new System.Drawing.Point(70, 41);
+            this.de_name.Name = "de_name";
+            this.de_name.Size = new System.Drawing.Size(0, 16);
+            this.de_name.TabIndex = 16;
+            // 
             // DeviceStatusInfo
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
@@ -297,6 +297,7 @@ namespace UAS_DeviceMonitor.Device.Infomation
             this.Controls.Add(this.groupControl2);
             this.Controls.Add(this.groupControl1);
             this.FormBorderEffect = DevExpress.XtraEditors.FormBorderEffect.None;
+            this.KeyPreview = true;
             this.MaximizeBox = false;
             this.Name = "DeviceStatusInfo";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;