Browse Source

处理 颗粒列表图像 显示不全的 bug

CXS 4 years ago
parent
commit
d2f0f237f1

+ 1 - 0
OTSIncAReportApp/Control_Grids/ParticlesGridDevidePage.Designer.cs

@@ -100,6 +100,7 @@
             this.panel2.Name = "panel2";
             this.panel2.Size = new System.Drawing.Size(2254, 56);
             this.panel2.TabIndex = 6;
+            this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint);
             // 
             // label_Condition
             // 

+ 4 - 268
OTSIncAReportApp/Control_Grids/ParticlesGridDevidePage.cs

@@ -383,274 +383,6 @@ namespace OTSIncAReportGrids
             return bmap;
         }
 
-        ///// <summary>
-        ///// 绑定datagridview数据--
-        ///// </summary>
-        //private void BindDataGridView()
-        //{
-        //    #region 加载显示进度条部份
-        //    //m_sec.SendCall("设置鼠标样式", "", "WaitCursor");
-        //    this.Cursor = Cursors.WaitCursor;
-        //    m_frm_userprogress = new Frm_UserProgress();
-
-        //    //显示进度条,计算进度条应该显示的位置和宽度
-        //    Form ls_main_form = this.ParentForm.ParentForm;//取出父窗体
-        //    if (ls_main_form == null)
-        //    {
-        //        m_frm_userprogress.Visible = false;
-        //    }
-        //    else
-        //    {
-        //        string str7 = table["str7"].ToString();
-        //        m_frm_userprogress.Width = (int)(MyPrimaryScreen.DESKTOP.Width / MyPrimaryScreen.ScaleX * 0.9);
-        //        m_frm_userprogress.Location = new Point(ls_main_form.Location.X + 80, ls_main_form.Location.Y + (int)(MyPrimaryScreen.DESKTOP.Height / MyPrimaryScreen.ScaleX) / 2);
-        //        m_frm_userprogress.Show();
-        //        m_frm_userprogress.SetProgressValueAndText(0, str7);
-        //    }
-
-        //    string str2 = "加载颗粒列表,开始从底层加载数据....";
-        //    str2 = table["str2"].ToString();
-        //    m_frm_userprogress.SetProgressValueAndText(1, str2);
-        //    #endregion
-
-        //    dgV_ParticlesDevidePage.Rows.Clear();
-        //    dgV_ParticlesDevidePage.Columns.Clear();
-        //    //列名
-        //    Dictionary<string, string> keyValues = new Dictionary<string, string>() { };
-
-        //    keyValues.Add("rowid", table["str4"].ToString());
-        //    keyValues.Add("TypeName", table["str6"].ToString());
-        //    keyValues.Add("ParticleImage", table["str5"].ToString());
-        //    keyValues.Add("Area", "Areaμm²");
-        //    keyValues.Add("DMAX", "DMAXμm");
-        //    keyValues.Add("DMIN", "DMINμm");
-        //    keyValues.Add("ASPECT_MAX", "ASPECT_MAX");
-
-        //    keyValues.Add("DFERET", "FERETμm");
-        //    keyValues.Add("DPERP", "DPERPμm");
-        //    keyValues.Add("PERIMETER", "PERIMETERμm");
-        //    keyValues.Add("DINSCR", "DINSCRμm");
-        //    keyValues.Add("DMEAN", "DMEANμm");
-        //    keyValues.Add("DELONG", "DELONGμm");
-        //    keyValues.Add("ASPECT_ELONG", "ASPECT_ELONG");
-        //    keyValues.Add("ORIENTATION", "ORIENTATION");
-        //    keyValues.Add("Element", "Element");
-
-        //    Dictionary<string, string>.Enumerator en = keyValues.GetEnumerator();
-        //    for (int irow = 0; irow < keyValues.Count; irow++)
-        //    {
-        //        if (en.MoveNext())
-        //        {
-        //            if (en.Current.Key == "ParticleImage")
-        //            {
-        //                DataGridViewImageColumn iconColumn = new DataGridViewImageColumn();
-        //                iconColumn.Name = en.Current.Key;
-        //                iconColumn.HeaderText = en.Current.Value;
-        //                dgV_ParticlesDevidePage.Columns.Add(iconColumn);
-        //            }
-        //            else if (en.Current.Key == "Element")
-        //            {
-
-        //            }
-        //            else
-        //            {
-        //                int columndid = dgV_ParticlesDevidePage.Columns.Add(en.Current.Key, en.Current.Value);
-        //            }
-
-        //        }
-        //    }
-
-        //    ParticleData fielddata = new ParticleData(result.FilePath);
-        //    DataTable particles = fielddata.GetInfoForPartucleDevidePage(PageIndex, pageSize, OrderFunction, condition);
-        //    PageSize = particles.Rows.Count;
-        //    if (particles == null)
-        //    {
-        //        return;
-        //    }
-
-        //    List<string> ElementType = new List<string>();
-        //    for (int i = 0; i < particles.Rows.Count; i++)
-        //    {
-        //        string[] strcbo = particles.Rows[i]["Element"].ToString().Split(';');
-        //        for (int j = 0; j < strcbo.Length; j++)
-        //        {
-        //            string str = strcbo[j].Split('-')[0].ToString();
-        //            if (!ElementType.Contains(str))
-        //            {
-        //                ElementType.Add(str);
-        //            }
-        //        }
-        //    }
-        //    ElementType.Sort(delegate (string a, string b) { return ReturnsAtomicNumberByElementName(a).CompareTo(ReturnsAtomicNumberByElementName(b)); });
-        //    List<string> list_str = new List<string>(GetElementsColName().Distinct().ToList());//去重
-        //    List<string> ElementTypeSort = new List<string>(ElementType);
-        //    for (int i = 0; i < list_str.Count; i++)
-        //    {
-        //        for (int j = 0; j < ElementType.Count; j++)
-        //        {
-        //            if (list_str[i] == ElementType[j])
-        //            {
-        //                dgV_ParticlesDevidePage.Columns.Add(ElementType[j], ElementType[j]);
-        //                ElementTypeSort.Remove(ElementType[j]);
-        //            }
-        //        }
-        //    }
-
-        //    for (int i = 0; i < ElementTypeSort.Count; i++)
-        //    {
-        //        dgV_ParticlesDevidePage.Columns.Add(ElementTypeSort[i], ElementTypeSort[i]);
-        //    }
-
-        //    RecordCount = fielddata.GetAllInfo(condition).Rows.Count;
-        //    string particleM = "";
-
-
-        //    double jd = 95f / (double)particles.Rows.Count;//计算进度刻度
-        //    //将datatable的数据,分别解析绑定到GridView上
-        //    KeyValuePair<string, Bitmap> FieldImage = new KeyValuePair<string, Bitmap>();
-        //    for (int i = 0; i < particles.Rows.Count; i++)
-        //    {
-        //        //更新进度,每100条记录加载完,更新一次进度
-        //        if (i % 100 == 0)
-        //            m_frm_userprogress.SetProgressValueAndText((int)(jd * i), "Loding..");
-
-        //        Dictionary<string, string>.Enumerator enl = keyValues.GetEnumerator();
-
-        //        int add_rowindex = dgV_ParticlesDevidePage.Rows.Add();
-        //        dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[0].Value = (pageSize * (PageIndex - 1) + add_rowindex + 1).ToString();
-
-        //        for (int k = 0; k < keyValues.Count; k++)
-        //        {
-        //            if (enl.MoveNext())
-        //            {
-        //                if (enl.Current.Key == "rowid")
-        //                {
-        //                    //dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = i + 1;
-        //                }
-
-        //                if (enl.Current.Key == "ParticleImage")
-        //                {
-        //                    string subt = particles.Rows[i]["SubParticles"].ToString();
-        //                    if (subt != null && subt != "")
-        //                    {
-        //                        double ScanFieldSize = 1142;
-        //                        //double ScanFieldSize = Convert.ToDouble(((Dictionary<string, object>)((Dictionary<string, object>)((Dictionary<string, object>)result.ResultInfo["Sample"])["Members"])["SEMDataMsr"])["ScanFieldSize"]);
-        //                        string filePatht = result.FilePath + "\\FIELD_FILES\\";
-        //                        string imagePatht = filePatht + "Field" + subt.Split(',')[0].Split(':')[0].ToString() + ".bmp";
-        //                        //然后将取出的数据,转换成Bitmap对象
-        //                        Bitmap tempbit = fielddata.ReadImageFile(imagePatht);
-        //                        int pixw = tempbit.Width;
-        //                        double xs = pixw / ScanFieldSize;
-        //                        particleM = particleM + "," + subt;
-        //                        Bitmap bmap = fielddata.GetBitmapForBig(subt, xs, result.FilePath);
-        //                        if (bmap != null)
-        //                        {
-        //                            bmap.Tag = new List<string>() { subt.Split(',')[0].Split(':')[0], subt.Split(',')[0].Split(':')[1], particles.Rows[i]["TypeId"].ToString() };
-        //                            dgV_ParticlesDevidePage.Rows[add_rowindex].Height = 150;
-        //                            dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = bmap;
-        //                        }
-        //                        else
-        //                        {
-        //                            dgV_ParticlesDevidePage.Rows[add_rowindex].Height = 150;
-        //                        }
-        //                    }
-        //                    else
-        //                    {
-        //                        string filePath = result.FilePath + "\\FIELD_FILES\\";
-        //                        if (FieldImage.Key != particles.Rows[i]["fieldid"].ToString() || FieldImage.Value == null)
-        //                        {
-        //                            string imagePath = filePath + "Field" + particles.Rows[i]["fieldid"].ToString() + ".bmp";
-        //                            FieldImage = new KeyValuePair<string, Bitmap>(particles.Rows[i]["fieldid"].ToString(), fielddata.ReadImageFile(imagePath));
-        //                        }
-
-        //                        Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(particles.Rows[i]["RectLeft"]), Y = Convert.ToInt32(particles.Rows[i]["RectTop"]), Width = Convert.ToInt32(particles.Rows[i]["RectWidth"]), Height = Convert.ToInt32(particles.Rows[i]["RectHeight"]) };
-        //                        Bitmap bmap = fielddata.GetBitmapByParticle(FieldImage.Value, rectangle);
-        //                        bmap.Tag = new List<string>() { particles.Rows[i]["FieldId"].ToString(), particles.Rows[i]["ParticleId"].ToString(), particles.Rows[i]["TypeId"].ToString() };
-        //                        dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = bmap;
-        //                    }
-        //                }
-        //                if (enl.Current.Key == "ASPECT_MAX")
-        //                {
-        //                    double d = Convert.ToDouble(particles.Rows[i]["DMAX"]) / Convert.ToDouble(particles.Rows[i]["DMIN"]);
-        //                    dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = Math.Round(d, 2);
-        //                }
-        //                if (enl.Current.Key == "ASPECT_ELONG")
-        //                {
-        //                    double d = Convert.ToDouble(particles.Rows[i]["DELONG"]) / Convert.ToDouble(particles.Rows[i]["DMEAN"]);
-        //                    dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = Math.Round(d, 2);
-        //                }
-
-        //                if (particles.Columns.Contains(enl.Current.Key))
-        //                {
-        //                    double num = 0;
-        //                    if (double.TryParse(particles.Rows[i][enl.Current.Key].ToString(), out num))
-        //                    {
-        //                        dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = Math.Round(num, 2);
-        //                    }
-        //                    else if (enl.Current.Key == "Element")
-        //                    {
-        //                        List<string> elementtemp = new List<string>(ElementType);
-        //                        string[] strcbo = particles.Rows[i][enl.Current.Key].ToString().Split(';');
-        //                        for (int j = 0; j < strcbo.Length; j++)
-        //                        {
-        //                            string[] str = strcbo[j].Split('-');
-        //                            dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[str[0].ToString()].Value = Math.Round(double.Parse(str[1]), 2).ToString();
-        //                            elementtemp.Remove(str[0].ToString());
-        //                        }
-        //                        foreach (var ele in elementtemp)
-        //                        {
-        //                            dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[ele].Value = "0";
-        //                        }
-        //                    }
-        //                    else
-        //                    {
-        //                        dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = particles.Rows[i][enl.Current.Key];
-        //                    }
-        //                }
-        //                if (enl.Current.Key == "TypeName")
-        //                {
-        //                    if (particles.Rows[i]["TypeId"].ToString() == "7")
-        //                    {
-        //                        dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = table["partcletype7"].ToString();
-        //                    }
-        //                    else if (particles.Rows[i]["TypeId"].ToString() == "8")
-        //                    {
-        //                        dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = table["partcletype8"].ToString();
-        //                    }
-        //                    else if (particles.Rows[i]["TypeId"].ToString() == "9")
-        //                    {
-        //                        dgV_ParticlesDevidePage.Rows[add_rowindex].Cells[k].Value = table["partcletype9"].ToString();
-        //                    }
-        //                }
-        //            }
-        //        }
-
-        //        //每加载2000条数据后,进行一次内存回收
-        //        if (i % 2000 == 0)
-        //        {
-        //            GC.Collect();
-        //            GC.WaitForPendingFinalizers();
-        //        }
-
-        //    }
-
-        //    #region 加载进度条进度部份结束
-        //    //加载完成设置鼠标为默认
-        //    //m_sec.SendCall("设置鼠标样式", "", "Default");
-        //    this.Cursor = Cursors.Default;
-        //    string str8 = table["str8"].ToString();
-        //    m_frm_userprogress.SetProgressValueAndText(100, str8);
-        //    //加载完成,关闭进度条
-        //    m_frm_userprogress.Close();
-        //    #endregion
-
-        //}
-
-
-
-
-
-
         private void BindDataGridView()
         {
 
@@ -960,6 +692,7 @@ namespace OTSIncAReportGrids
 
             }
 
+            this.dgV_ParticlesDevidePage.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;
             #region 加载进度条进度部份结束
             //加载完成设置鼠标为默认
             this.Cursor = Cursors.Default;
@@ -2320,7 +2053,10 @@ namespace OTSIncAReportGrids
             return list_str;
         }
 
+        private void panel2_Paint(object sender, PaintEventArgs e)
+        {
 
+        }
     }