Explorar o código

硬度列添加颜色

cxs %!s(int64=3) %!d(string=hai) anos
pai
achega
b5cd75691c

+ 33 - 3
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs

@@ -367,9 +367,12 @@ namespace OTSIncAReportGrids
                         DataRow[] dr = userLibraryData.Select("STDId=" + particlesAll.Rows[i]["TypeId"].ToString());
                         if (dr.Length > 0)
                         {
-                            particlesAll.Rows[i]["Hardness"] = System.Text.RegularExpressions.Regex.Replace(dr[0]["Hardness"].ToString(), @"[^\d.\d]", "");
-                            particlesAll.Rows[i]["Density"] = System.Text.RegularExpressions.Regex.Replace(dr[0]["Density"].ToString(), @"[^\d.\d]", "");
-                            particlesAll.Rows[i]["Electrical_conductivity"] = System.Text.RegularExpressions.Regex.Replace(dr[0]["Electrical_conductivity"].ToString(), @"[^\d.\d]", "");
+                            //particlesAll.Rows[i]["Hardness"] = System.Text.RegularExpressions.Regex.Replace(dr[0]["Hardness"].ToString(), @"[^\d.\d]", "");
+                            //particlesAll.Rows[i]["Density"] = System.Text.RegularExpressions.Regex.Replace(dr[0]["Density"].ToString(), @"[^\d.\d]", "");
+                            //particlesAll.Rows[i]["Electrical_conductivity"] = System.Text.RegularExpressions.Regex.Replace(dr[0]["Electrical_conductivity"].ToString(), @"[^\d.\d]", "");
+                            particlesAll.Rows[i]["Hardness"] = dr[0]["Hardness"].ToString();
+                            particlesAll.Rows[i]["Density"] = dr[0]["Density"].ToString();
+                            particlesAll.Rows[i]["Electrical_conductivity"] = dr[0]["Electrical_conductivity"].ToString();
                         }
                         else
                         {
@@ -895,6 +898,17 @@ namespace OTSIncAReportGrids
                             double Diameter = Math.Sqrt(dSize / Math.PI) * 2;
                             dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = Math.Round(Diameter, 2);
                         }
+                        if (enl.Current.Key == "Hardness")
+                        {
+                            string str = ChangeHardnessColor(particles.Rows[i]["Hardness"].ToString());
+                            {
+                                if(str== "#FF0000")
+                                {
+                                    dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Style.ForeColor = Color.Red;
+                                }
+                                dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = particles.Rows[i]["Hardness"].ToString();
+                            }
+                        }
                     }
                 }
             }
@@ -2125,6 +2139,22 @@ namespace OTSIncAReportGrids
             frmReMeasure.TopMost = true;//设置置顶
             frmReMeasure.ShowDialog();
         }
+
+        string ChangeHardnessColor(string Hardness)
+        {
+            string str = System.Text.RegularExpressions.Regex.Replace(Hardness, @"[^\d.\d]", "");
+            double hd;
+            if (double.TryParse(str, out hd))
+            {
+                if (hd >= 1000)
+                {
+                    return "#FF0000";
+                }
+                else return "";
+            }
+            else
+                return "";
+        }
     }