浏览代码

添加联网设备图片

章政 7 年之前
父节点
当前提交
99ea21607b

+ 14 - 12
UAS_DeviceMonitor/Main.Designer.cs

@@ -134,11 +134,12 @@ namespace UAS_DeviceMonitor
             this.pl_remark = new DevExpress.XtraGrid.Columns.GridColumn();
             this.PageDeviceStatus = new DevExpress.XtraTab.XtraTabPage();
             this.PanelDeviceStatus = new DevExpress.XtraEditors.XtraScrollableControl();
+            this.pictureEdit1 = new DevExpress.XtraEditors.PictureEdit();
             this.PageWorkCenterStatus = new DevExpress.XtraTab.XtraTabPage();
             this.GridWorkCenterStatus = new UAS_DeviceMonitor.CustomerControl.AutoDataGridControl.AutoDataGridControl();
             this.GridViewWorkCenterStatus = new UAS_DeviceMonitor.CustomerControl.GridViewWithSerialNum.GridViewWithSerialNum();
             this.TimerDeviceStatus = new System.Windows.Forms.Timer(this.components);
-            this.pictureEdit1 = new DevExpress.XtraEditors.PictureEdit();
+            this.CommonTipController = new DevExpress.Utils.ToolTipController(this.components);
             ((System.ComponentModel.ISupportInitialize)(this.RibbonNav)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.MainTabControl)).BeginInit();
             this.MainTabControl.SuspendLayout();
@@ -166,10 +167,10 @@ namespace UAS_DeviceMonitor
             ((System.ComponentModel.ISupportInitialize)(this.GridViewPolling)).BeginInit();
             this.PageDeviceStatus.SuspendLayout();
             this.PanelDeviceStatus.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureEdit1.Properties)).BeginInit();
             this.PageWorkCenterStatus.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.GridWorkCenterStatus)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridViewWorkCenterStatus)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.pictureEdit1.Properties)).BeginInit();
             this.SuspendLayout();
             // 
             // RibbonNav
@@ -1208,6 +1209,15 @@ namespace UAS_DeviceMonitor
             this.PanelDeviceStatus.Size = new System.Drawing.Size(1027, 577);
             this.PanelDeviceStatus.TabIndex = 0;
             // 
+            // pictureEdit1
+            // 
+            this.pictureEdit1.Location = new System.Drawing.Point(502, 126);
+            this.pictureEdit1.MenuManager = this.RibbonNav;
+            this.pictureEdit1.Name = "pictureEdit1";
+            this.pictureEdit1.Properties.ShowCameraMenuItem = DevExpress.XtraEditors.Controls.CameraMenuItemVisibility.Auto;
+            this.pictureEdit1.Size = new System.Drawing.Size(100, 96);
+            this.pictureEdit1.TabIndex = 0;
+            // 
             // PageWorkCenterStatus
             // 
             this.PageWorkCenterStatus.Controls.Add(this.GridWorkCenterStatus);
@@ -1248,15 +1258,6 @@ namespace UAS_DeviceMonitor
             this.TimerDeviceStatus.Interval = 10000;
             this.TimerDeviceStatus.Tick += new System.EventHandler(this.TimerDeviceStatus_Tick);
             // 
-            // pictureEdit1
-            // 
-            this.pictureEdit1.Location = new System.Drawing.Point(502, 126);
-            this.pictureEdit1.MenuManager = this.RibbonNav;
-            this.pictureEdit1.Name = "pictureEdit1";
-            this.pictureEdit1.Properties.ShowCameraMenuItem = DevExpress.XtraEditors.Controls.CameraMenuItemVisibility.Auto;
-            this.pictureEdit1.Size = new System.Drawing.Size(100, 96);
-            this.pictureEdit1.TabIndex = 0;
-            // 
             // Main
             // 
             this.AllowFormGlass = DevExpress.Utils.DefaultBoolean.False;
@@ -1301,10 +1302,10 @@ namespace UAS_DeviceMonitor
             ((System.ComponentModel.ISupportInitialize)(this.GridViewPolling)).EndInit();
             this.PageDeviceStatus.ResumeLayout(false);
             this.PanelDeviceStatus.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.pictureEdit1.Properties)).EndInit();
             this.PageWorkCenterStatus.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.GridWorkCenterStatus)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.GridViewWorkCenterStatus)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.pictureEdit1.Properties)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -1416,5 +1417,6 @@ namespace UAS_DeviceMonitor
         private GridViewWithSerialNum GridViewWorkCenterStatus;
         private XtraScrollableControl PanelDeviceStatus;
         private PictureEdit pictureEdit1;
+        private DevExpress.Utils.ToolTipController CommonTipController;
     }
 }

+ 12 - 3
UAS_DeviceMonitor/Main.cs

@@ -411,16 +411,25 @@ namespace UAS_DeviceMonitor
                 {
                     LastRowCount = Count % CountPerRow;
                 }
+                CommonTipController.ShowBeak = true;
                 for (int i = 0; i < (j == RowCount - 1 ? LastRowCount : CountPerRow); i++)
                 {
                     PictureEditWithText pic = new PictureEditWithText();
+                    pic.Name = dt.Rows[j * CountPerRow + i]["de_code"].ToString();
                     pic.Anchor = AnchorStyles.Left;
                     pic.Anchor = AnchorStyles.Top;
                     pic.Picedit.Properties.SizeMode = PictureSizeMode.Squeeze;
+
                     if (dt.Rows[j * CountPerRow + i]["dpc_status"].ToString() != "Running")
-                        pic.Picedit.Image = Properties.Resources.network_offline;   
+                    {
+                        CommonTipController.SetToolTip(pic, "离线");
+                        pic.Picedit.Image = Properties.Resources.network_offline;
+                    }
                     else
-                        pic.Picedit.Image = Properties.Resources.devicecontrol;
+                    {
+                        CommonTipController.SetToolTip(pic, "在线");
+                        pic.Picedit.Image = Properties.Resources.net_connected;
+                    }
                     pic.Text = dt.Rows[j * CountPerRow + i]["de_code"].ToString();
                     pic.Picedit.BorderStyle = BorderStyles.HotFlat;
                     pic.Location = new Point((10 + RightPadding) / 2 + 110 * i, 10 + j * 130);
@@ -439,7 +448,7 @@ namespace UAS_DeviceMonitor
         }
 
         private void PanelDeviceStatus_SizeChanged(object sender, EventArgs e)
-        {   
+        {
             if (PageDeviceStatus.PageVisible)
             {
                 ShowDeviceStatus();

+ 3 - 0
UAS_DeviceMonitor/Main.resx

@@ -473,6 +473,9 @@
   <metadata name="TimerDeviceStatus.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
+  <metadata name="CommonTipController.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>178, 17</value>
+  </metadata>
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         AAABAAEAQEAAAAEAIAAoQgAAFgAAACgAAABAAAAAgAAAAAEAIAAAAAAAAEAAABMLAAATCwAAAAAAAAAA

+ 10 - 0
UAS_DeviceMonitor/Properties/Resources.Designer.cs

@@ -90,6 +90,16 @@ namespace UAS_DeviceMonitor.Properties {
             }
         }
         
+        /// <summary>
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
+        /// </summary>
+        internal static System.Drawing.Bitmap net_connected {
+            get {
+                object obj = ResourceManager.GetObject("net_connected", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         /// <summary>
         ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>

+ 3 - 0
UAS_DeviceMonitor/Properties/Resources.resx

@@ -148,4 +148,7 @@
   <data name="network_offline" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Resources\network-offline.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
+  <data name="net_connected" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\net_connected.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
 </root>

二进制
UAS_DeviceMonitor/Resources/net_connected.png


+ 1 - 0
UAS_DeviceMonitor/UAS_DeviceMonitor.csproj

@@ -196,6 +196,7 @@
     <None Include="Resources\check_16px_1137507_easyicon.net.png" />
     <None Include="Resources\devicecontrol.png" />
     <None Include="Resources\network-offline.png" />
+    <None Include="Resources\net_connected.png" />
     <Content Include="Tool\Oracle.ManagedDataAccess.dll" />
   </ItemGroup>
   <ItemGroup>