Explorar o código

报告程序从数据中删除选中颗粒(未完成临时)

zhangjiaxin %!s(int64=3) %!d(string=hai) anos
pai
achega
bc43d2bc6c

+ 7 - 18
FAQ/FAQ.docx

@@ -1,18 +1,7 @@
-1.git拉取成功但推送失败,报错304
-windows 凭据管理器 credential 删除git 用户名
-2.样品孔拍摄失败怎么办?
-将电镜放大倍数调成与样品孔拍照放大倍数一致
-3.带Bool返回值的函数在编程中应该添加接收判断
-4.牛津能谱采集不到图像,显示灰图怎么办?
-   在路径Release_oxford50\Config\ProData中找到配置文件HardwareConfig.xml,将文件中的"BSE"修改为"SE"后点击保存
-
-5.样品台移动失败
-增加延时时间ControlDelay数值,单位为毫秒
-
-6.如果能谱识别出的元素特别少
-重启能谱控制器单元(小盒子)
-7.小颗粒Xray采集时间过小可能导致采集xray失败
-8.自定义标准库中规则无效
-检查标准库表达式中"<",">"前后不能有空格
-9.牛津能谱获取xray超时失败
-     Extender所有dll版本是否正确
+1.git拉取成功但推送失败,报错304windows 凭据管理器 credential 删除git 用户名2.样品孔拍摄失败怎么办?将电镜放大倍数调成与样品孔拍照放大倍数一致3.带Bool返回值的函数在编程中应该添加接收判断4.牛津能谱采集不到图像,显示灰图怎么办?   在路径Release_oxford50\Config\ProData中找到配置文件HardwareConfig.xml,将文件中的"BSE"修改为"SE"后点击保存5.样品台移动失败增加延时时间ControlDelay数值,单位为毫秒6.如果能谱识别出的元素特别少  重启能谱控制器单元(小盒子)
+7.小颗粒Xray采集时间过小可能导致采集xray失败8.自定义标准库中规则无效  检查标准库表达式中"<",">"前后不能有空格
+9.牛津能谱获取xray超时失败     Extender所有dll版本是否正确
+ 如果颗粒物质分析不正确或者颗粒物质识别错误
+  方案1,创建自定义标准库,在标准库中创建Invalid分类并写入非夹杂物规则,过滤掉非夹杂物颗粒。
+  方案2,从新打磨、抛光、清洗样品,确定样品测量表面的清洁干净,确保无锈点、灰尘、印记等。
+  方案3,在程序中选择颗粒右键选择删除颗粒,可在数据库中删除该选中的颗粒。(制作中)

+ 38 - 127
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.cs

@@ -47,7 +47,9 @@ namespace OTSIncAReportGraph.Controls
       
        MoveSEMToParticle=1,
        CopyImage=2,
-       OriginalSplicing= 3
+       OriginalSplicing= 3,
+       DeleteParticle=4,
+            CopyDatabase=5
 
     }
     /// <summary>
@@ -1192,6 +1194,9 @@ namespace OTSIncAReportGraph.Controls
                        
                         CMenuStrip.Items[(int)RightButtonMenu.CopyImage].Visible = false;
                         CMenuStrip.Items[(int)RightButtonMenu.OriginalSplicing].Visible = false;
+                        CMenuStrip.Items[(int)RightButtonMenu.DeleteParticle].Visible = true;
+                        //CMenuStrip.Items[(int)RightButtonMenu.CopyDatabase].Visible = true;
+
                         CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Visible = true;
                         CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Tag = item;
                     }
@@ -1216,6 +1221,8 @@ namespace OTSIncAReportGraph.Controls
                        
 
                     }
+                    CMenuStrip.Items[(int)RightButtonMenu.DeleteParticle].Visible = false;
+                    //CMenuStrip.Items[(int)RightButtonMenu.CopyDatabase].Visible = false;
                     CMenuStrip.Items[(int)RightButtonMenu.CopyImage].Visible = true;
                     CMenuStrip.Items[(int)RightButtonMenu.OriginalSplicing].Visible = true;
                     CMenuStrip.Items[(int)RightButtonMenu.MoveSEMToParticle].Visible = false;
@@ -1297,6 +1304,8 @@ namespace OTSIncAReportGraph.Controls
             uint[] Search_xray = new uint[2000];
             uint[] Analysis_xray = new uint[2000];
 
+
+
             //
             int i_xray_id = 0;
 
@@ -1955,132 +1964,7 @@ namespace OTSIncAReportGraph.Controls
         
         #endregion
 
-        private bool outpic()
-        {
-
-            SaveFileDialog sfd = new SaveFileDialog();
-            //|ALL Files(*.*)|*.*
-            sfd.Filter = "BMP Files(*.bmp)|*.bmp|JPG Files(*.jpg)|*.jpg;*.jpeg";
-            if (sfd.ShowDialog() == DialogResult.OK)
-            { 
-                try
-                {
-                    DataTable picDatat = new DataTable();
-                    picDatat.Columns.Add("X", typeof(double));
-                    picDatat.Columns.Add("Y", typeof(double));
-                    picDatat.Columns.Add("pic_ID");
-                    foreach (var f in m_list_allDfield)
-                    {
-                        DataRow dr = picDatat.NewRow();
-                        dr["X"] = f.Rect.X;
-                        dr["Y"] = f.Rect.Y;
-                        dr["pic_ID"] = f.FieldID;
-                        picDatat.Rows.Add(dr);
-                    }
-                    int x_max = Convert.ToInt32(picDatat.Compute("Max(X)", "true"));
-                    int y_max = Convert.ToInt32(picDatat.Compute("Max(Y)", "true"));
-                    Bitmap pic_bitmap = new Bitmap(x_max, y_max);
-                    Graphics graph = Graphics.FromImage(pic_bitmap);
-                    foreach (var f in m_list_allDfield)
-                    {
-                        graph.DrawImage(f.OriginalImage, f.Rect.X, f.Rect.Y, f.Rect.Width, f.Rect.Height);
-                    }
-
-                    pic_bitmap.Save(sfd.FileName);
-                    pic_bitmap.Dispose();
-                    return true;
-                }
-                catch
-                {
-                    return false;
-                }
-               
-            }
-            return false;
-
-        }
-        private bool outpic_Render()
-        {
-            SaveFileDialog sfd = new SaveFileDialog();
-            sfd.Filter = "BMP Files(*.bmp)|*.bmp|JPG Files(*.jpg)|*.jpg;*.jpeg";
-            List<Field> fieldlist = resultFile.List_OTSField;
-
-            if (sfd.ShowDialog() == DialogResult.OK)
-            {
-                try
-                {
-                    double x_max ;
-                    double y_max ;
-                    DataTable picDatat = new DataTable();
-                    picDatat.Columns.Add("X", typeof(double));
-                    picDatat.Columns.Add("Y", typeof(double));
-                    picDatat.Columns.Add("pic_ID");
-                    foreach (var f in m_list_allDfield)
-                    {
-                        DataRow dr = picDatat.NewRow();
-                        dr["X"] = f.Rect.X;
-                        dr["Y"] = f.Rect.Y;
-                        dr["pic_ID"] = f.FieldID;
-                        picDatat.Rows.Add(dr);
-                    }
-                     x_max = Convert.ToDouble(picDatat.Compute("Max(X)", "true"));
-                     y_max = Convert.ToDouble(picDatat.Compute("Max(Y)", "true"));
-                    Bitmap pic_bitmap = new Bitmap((int)x_max, (int)y_max);
-                    Graphics graph = Graphics.FromImage(pic_bitmap);
-                    foreach (var f in m_list_allDfield)
-                    {
-                        Bitmap image = new Bitmap(f.OriginalImage.Width,f.OriginalImage.Height);
-                        Graphics g2= Graphics.FromImage(image);
-                        g2.DrawImage(f.OriginalImage,0,0, f.OriginalImage.Width, f.OriginalImage.Height);
-                        Graphics graph_2 = Graphics.FromImage(image);
-
-                        for (int i = 0; i < fieldlist.Count; i++)
-                        {
-                            if (fieldlist[i].FieldID.ToString() == f.FieldID.ToString())
-                            {
-                                //先获取该Field中的所有Particle
-                                List<Particle> list_particle;
-                                list_particle = fieldlist[i].ParticleList;
-                                //再循环计算所有的Particle对象
-                                foreach (Particle particle in list_particle)
-                                {
-                                    //创建DParticle颗粒
-                                    DisplayParticle dp = new DisplayParticle(particle);
-                                    List<Segment> list_seg;
-                                    list_seg = particle.SegmentList;
-                                    //创建颗粒分布图对应的类对象
-                                    List<DisplaySegment> list_dsegment = new List<DisplaySegment>();
-                                    //再循环取出里面所有的segment
-                                    foreach (Segment seg in list_seg)
-                                    {
-                                        #region 创建DSegment对象,并将STD分析出的化合物颜色保存到DSegment对象中
-                                        
-                                        Point on_p = new Point() { X = seg.Start, Y = seg.Height };
-                                        Point off_p = new Point() { X = seg.Start + seg.Length, Y = seg.Height };
-                                        Pen npen = new Pen(dp.Color);
-                                        graph_2.DrawLine(npen, on_p, off_p);
-                                 
-                                        #endregion
-                                    }
-                                }
-                            }
-                        }
-                        graph.DrawImage(image, f.Rect.X, f.Rect.Y, f.Rect.Width, f.Rect.Height);
-                    }
-
-                    pic_bitmap.Save(sfd.FileName);
-                    pic_bitmap.Dispose();
-                    pic_bitmap.Dispose();
-                    return true;
-                }
-                catch
-                {
-                    return false;
-                }
-
-            }
-            return false;
-        }
+    
       
 
         private static byte[] ImgtoByte(Image img)
@@ -2161,5 +2045,32 @@ namespace OTSIncAReportGraph.Controls
                 bThread.Start();
             }
         }
+
+        private void ToolStripMenuItemDelete_Particle_Click(object sender, EventArgs e)
+        {
+            DialogResult dr = MessageBox.Show("Should I delete particles", "Tips", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
+            if (dr== DialogResult.OK)
+            {
+                
+               if (ReportFun.DeleteParticlesFromLibrary(m_mouseOver_dparticle.ParticleId, m_mouseOver_dparticle.FieldId))
+                {
+                    MessageBox.Show("Deleted successfully");
+                    FieldData fieldData = new FieldData(resultFile.FilePath);
+                    List<Field> fieldlist = fieldData.GetFieldList();
+                    m_ReportApp.m_rstDataMgr.CurResultFile.List_OTSField = fieldlist;
+                }
+               else
+                {
+                    MessageBox.Show("Delete failed");
+                }
+            }
+            else
+            {
+                return;
+            }
+           
+        }
+
+      
     }
 }

+ 12 - 2
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_DrawDistrbutionImageAndBSE.designer.cs

@@ -34,6 +34,7 @@
             this.ToolStripMenuItem_movesempoint = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripMenuItem_copyimage = new System.Windows.Forms.ToolStripMenuItem();
             this.ExportoriginalspliceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.ToolStripMenuItemDelete_Particle = new System.Windows.Forms.ToolStripMenuItem();
             this.CMenuStrip.SuspendLayout();
             this.SuspendLayout();
             // 
@@ -44,9 +45,10 @@
             this.ToolStripMenuItem_selected,
             this.ToolStripMenuItem_movesempoint,
             this.toolStripMenuItem_copyimage,
-            this.ExportoriginalspliceToolStripMenuItem});
+            this.ExportoriginalspliceToolStripMenuItem,
+            this.ToolStripMenuItemDelete_Particle});
             this.CMenuStrip.Name = "contextMenuStrip1";
-            this.CMenuStrip.Size = new System.Drawing.Size(219, 146);
+            this.CMenuStrip.Size = new System.Drawing.Size(219, 154);
             // 
             // ToolStripMenuItem_selected
             // 
@@ -80,6 +82,13 @@
             this.ExportoriginalspliceToolStripMenuItem.Text = "导出原图拼接分类图";
             this.ExportoriginalspliceToolStripMenuItem.Click += new System.EventHandler(this.ExportoriginalspliceToolStripMenuItem_Click);
             // 
+            // ToolStripMenuItemDelete_Particle
+            // 
+            this.ToolStripMenuItemDelete_Particle.Name = "ToolStripMenuItemDelete_Particle";
+            this.ToolStripMenuItemDelete_Particle.Size = new System.Drawing.Size(218, 30);
+            this.ToolStripMenuItemDelete_Particle.Text = "Delete particles";
+            this.ToolStripMenuItemDelete_Particle.Click += new System.EventHandler(this.ToolStripMenuItemDelete_Particle_Click);
+            // 
             // Control_DrawDistrbutionImageAndBSE
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -102,5 +111,6 @@
         private Control_Ruler control_Ruler1;
         private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem_copyimage;
         private System.Windows.Forms.ToolStripMenuItem ExportoriginalspliceToolStripMenuItem;
+        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemDelete_Particle;
     }
 }

+ 68 - 0
OTSIncAReportApp/1-UI/Control_Graph/OTSIncAReportGraphFuncation/OTSImageDisHelp.cs

@@ -13,6 +13,7 @@ using System.Diagnostics;
 
 using System.Drawing;
 using System.Drawing.Drawing2D;
+using System.IO;
 using System.Linq;
 
 
@@ -364,7 +365,74 @@ namespace OTSIncAReportGraph.OTSIncAReportGraphFuncation
 
         }
 
+        public bool DeleteParticlesFromLibrary(int in_clr_tagid, int in_clr_fieldid)
+        {
+            bool DoesItExist = false;
+            for (int i=1;i<201;i++)
+            {
+                if (System.IO.Directory.Exists(resultFile.FilePath + "\\FIELD_FILES\\Backups"+i.ToString()))
+                {
+                    DoesItExist = true;
+                    break;
+                }
+            }
+            if (!DoesItExist)
+            {
+                //备份数据库
+                BackupDatabase();
+            }
+            DoesItExist = false;
+
+            //防止为空校验判断
+            if (resultFile.List_OTSField == null)
+                return false;
+            Particle particle = resultFile.List_OTSField.Find(x => x.FieldID == in_clr_fieldid).ParticleList.Find(x => x.ParticleId == in_clr_tagid);
+            if (new ParticleData(resultFile.FilePath).DeleteFromData(Convert.ToString(particle.FieldId), Convert.ToString(particle.XrayId)))
+            {
+                
+                return true;
+            }else
+
+            {
+                return false;
+            }
+        }
+
+        public bool BackupDatabase()
+        {
+            //创建备份数据库文件夹
+            string sourcePath = resultFile.FilePath + "\\FIELD_FILES\\Inclusion.db";//源文件路径
+            string sourceName = "Inclusion.db";//源文件名称
+            string folderPath = resultFile.FilePath + "\\FIELD_FILES\\Backups";//目标文件夹
+            string Fields = "";
+            for (int i = 1; i < 201; i++)
+            {
+                if (System.IO.Directory.Exists(folderPath + i.ToString()))
+                {
+                    Fields = folderPath + i.ToString();
+                    break;
+                }
+                else
+                {
+                    System.IO.Directory.CreateDirectory(folderPath + i.ToString());
+                    Fields = folderPath + i.ToString();
+                    break;
+                }
+            }
+            if (Fields == "")
+            {
+                return false;
+            }
+            //复制数据库文件
+            string targetPath = Path.Combine(Fields, sourceName);
+            FileInfo file = new FileInfo(sourcePath);
+            if (file.Exists)
+            {
+                file.CopyTo(targetPath, true);
+            }
 
+            return true;
+        }
         /// <summary>
         /// 传入所有的物理field坐标点,和单个物理field的宽高,返回所有field的左上角位置,和整个field组成的rect大小
         /// </summary>

+ 88 - 110
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.Designer.cs

@@ -69,6 +69,7 @@
             this.ToolStripMenuItem_exportimagefile = new System.Windows.Forms.ToolStripMenuItem();
             this.testToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.EXCELToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.ToolStripMenuItemDelete_Particle = new System.Windows.Forms.ToolStripMenuItem();
             this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
             this.dgV_ParticlesDevidePage = new System.Windows.Forms.DataGridView();
             this.panel2.SuspendLayout();
@@ -95,37 +96,33 @@
             this.panel2.Controls.Add(this.cbB_order);
             this.panel2.Controls.Add(this.label_order);
             this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.panel2.Location = new System.Drawing.Point(4, 4);
-            this.panel2.Margin = new System.Windows.Forms.Padding(4);
+            this.panel2.Location = new System.Drawing.Point(3, 3);
             this.panel2.Name = "panel2";
-            this.panel2.Size = new System.Drawing.Size(2254, 56);
+            this.panel2.Size = new System.Drawing.Size(1502, 37);
             this.panel2.TabIndex = 6;
             // 
             // label_Condition
             // 
             this.label_Condition.AutoSize = true;
-            this.label_Condition.Location = new System.Drawing.Point(21, 20);
-            this.label_Condition.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label_Condition.Location = new System.Drawing.Point(14, 13);
             this.label_Condition.Name = "label_Condition";
-            this.label_Condition.Size = new System.Drawing.Size(89, 18);
+            this.label_Condition.Size = new System.Drawing.Size(59, 12);
             this.label_Condition.TabIndex = 35;
             this.label_Condition.Text = "条件查询:";
             // 
             // tbx_Type
             // 
-            this.tbx_Type.Location = new System.Drawing.Point(693, 15);
-            this.tbx_Type.Margin = new System.Windows.Forms.Padding(4);
+            this.tbx_Type.Location = new System.Drawing.Point(462, 10);
             this.tbx_Type.Name = "tbx_Type";
-            this.tbx_Type.Size = new System.Drawing.Size(101, 28);
+            this.tbx_Type.Size = new System.Drawing.Size(69, 21);
             this.tbx_Type.TabIndex = 34;
             this.tbx_Type.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
             // 
             // btn_Sel
             // 
-            this.btn_Sel.Location = new System.Drawing.Point(802, 12);
-            this.btn_Sel.Margin = new System.Windows.Forms.Padding(4);
+            this.btn_Sel.Location = new System.Drawing.Point(535, 8);
             this.btn_Sel.Name = "btn_Sel";
-            this.btn_Sel.Size = new System.Drawing.Size(81, 34);
+            this.btn_Sel.Size = new System.Drawing.Size(54, 23);
             this.btn_Sel.TabIndex = 33;
             this.btn_Sel.Text = "查询";
             this.btn_Sel.UseVisualStyleBackColor = true;
@@ -134,86 +131,77 @@
             // label_ParticleName
             // 
             this.label_ParticleName.AutoSize = true;
-            this.label_ParticleName.Location = new System.Drawing.Point(613, 20);
-            this.label_ParticleName.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label_ParticleName.Location = new System.Drawing.Point(409, 13);
             this.label_ParticleName.Name = "label_ParticleName";
-            this.label_ParticleName.Size = new System.Drawing.Size(80, 18);
+            this.label_ParticleName.Size = new System.Drawing.Size(53, 12);
             this.label_ParticleName.TabIndex = 32;
             this.label_ParticleName.Text = "颗粒名称";
             // 
             // label_Dmax
             // 
             this.label_Dmax.AutoSize = true;
-            this.label_Dmax.Location = new System.Drawing.Point(368, 22);
-            this.label_Dmax.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label_Dmax.Location = new System.Drawing.Point(245, 15);
             this.label_Dmax.Name = "label_Dmax";
-            this.label_Dmax.Size = new System.Drawing.Size(89, 18);
+            this.label_Dmax.Size = new System.Drawing.Size(59, 12);
             this.label_Dmax.TabIndex = 27;
             this.label_Dmax.Text = "Dmax(μm)";
             // 
             // tbx_DmaxMax
             // 
-            this.tbx_DmaxMax.Location = new System.Drawing.Point(548, 17);
-            this.tbx_DmaxMax.Margin = new System.Windows.Forms.Padding(4);
+            this.tbx_DmaxMax.Location = new System.Drawing.Point(365, 11);
             this.tbx_DmaxMax.Name = "tbx_DmaxMax";
-            this.tbx_DmaxMax.Size = new System.Drawing.Size(58, 28);
+            this.tbx_DmaxMax.Size = new System.Drawing.Size(40, 21);
             this.tbx_DmaxMax.TabIndex = 25;
             this.tbx_DmaxMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
             // 
             // label9
             // 
             this.label9.AutoSize = true;
-            this.label9.Location = new System.Drawing.Point(527, 22);
-            this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label9.Location = new System.Drawing.Point(351, 15);
             this.label9.Name = "label9";
-            this.label9.Size = new System.Drawing.Size(17, 18);
+            this.label9.Size = new System.Drawing.Size(11, 12);
             this.label9.TabIndex = 24;
             this.label9.Text = "~";
             // 
             // tbx_DmaxMin
             // 
-            this.tbx_DmaxMin.Location = new System.Drawing.Point(463, 17);
-            this.tbx_DmaxMin.Margin = new System.Windows.Forms.Padding(4);
+            this.tbx_DmaxMin.Location = new System.Drawing.Point(309, 11);
             this.tbx_DmaxMin.Name = "tbx_DmaxMin";
-            this.tbx_DmaxMin.Size = new System.Drawing.Size(58, 28);
+            this.tbx_DmaxMin.Size = new System.Drawing.Size(40, 21);
             this.tbx_DmaxMin.TabIndex = 23;
             this.tbx_DmaxMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
             // 
             // label_Area
             // 
             this.label_Area.AutoSize = true;
-            this.label_Area.Location = new System.Drawing.Point(113, 20);
-            this.label_Area.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label_Area.Location = new System.Drawing.Point(75, 13);
             this.label_Area.Name = "label_Area";
-            this.label_Area.Size = new System.Drawing.Size(98, 18);
+            this.label_Area.Size = new System.Drawing.Size(65, 12);
             this.label_Area.TabIndex = 22;
             this.label_Area.Text = "面积(μm²)";
             // 
             // Tbx_AreaMax
             // 
-            this.Tbx_AreaMax.Location = new System.Drawing.Point(299, 15);
-            this.Tbx_AreaMax.Margin = new System.Windows.Forms.Padding(4);
+            this.Tbx_AreaMax.Location = new System.Drawing.Point(199, 10);
             this.Tbx_AreaMax.Name = "Tbx_AreaMax";
-            this.Tbx_AreaMax.Size = new System.Drawing.Size(58, 28);
+            this.Tbx_AreaMax.Size = new System.Drawing.Size(40, 21);
             this.Tbx_AreaMax.TabIndex = 4;
             this.Tbx_AreaMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
             // 
             // label5
             // 
             this.label5.AutoSize = true;
-            this.label5.Location = new System.Drawing.Point(278, 20);
-            this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label5.Location = new System.Drawing.Point(185, 13);
             this.label5.Name = "label5";
-            this.label5.Size = new System.Drawing.Size(17, 18);
+            this.label5.Size = new System.Drawing.Size(11, 12);
             this.label5.TabIndex = 3;
             this.label5.Text = "~";
             // 
             // tBx_AreaMin
             // 
-            this.tBx_AreaMin.Location = new System.Drawing.Point(213, 15);
-            this.tBx_AreaMin.Margin = new System.Windows.Forms.Padding(4);
+            this.tBx_AreaMin.Location = new System.Drawing.Point(142, 10);
             this.tBx_AreaMin.Name = "tBx_AreaMin";
-            this.tBx_AreaMin.Size = new System.Drawing.Size(58, 28);
+            this.tBx_AreaMin.Size = new System.Drawing.Size(40, 21);
             this.tBx_AreaMin.TabIndex = 2;
             this.tBx_AreaMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
             // 
@@ -221,10 +209,9 @@
             // 
             this.cbB_order.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.cbB_order.FormattingEnabled = true;
-            this.cbB_order.Location = new System.Drawing.Point(1152, 15);
-            this.cbB_order.Margin = new System.Windows.Forms.Padding(4);
+            this.cbB_order.Location = new System.Drawing.Point(768, 10);
             this.cbB_order.Name = "cbB_order";
-            this.cbB_order.Size = new System.Drawing.Size(160, 26);
+            this.cbB_order.Size = new System.Drawing.Size(108, 20);
             this.cbB_order.TabIndex = 1;
             this.cbB_order.Visible = false;
             this.cbB_order.SelectedIndexChanged += new System.EventHandler(this.cbB_order_SelectedIndexChanged);
@@ -232,10 +219,9 @@
             // label_order
             // 
             this.label_order.AutoSize = true;
-            this.label_order.Location = new System.Drawing.Point(1065, 20);
-            this.label_order.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label_order.Location = new System.Drawing.Point(710, 13);
             this.label_order.Name = "label_order";
-            this.label_order.Size = new System.Drawing.Size(89, 18);
+            this.label_order.Size = new System.Drawing.Size(59, 12);
             this.label_order.TabIndex = 0;
             this.label_order.Text = "排序方式:";
             this.label_order.Visible = false;
@@ -256,40 +242,36 @@
             this.panel1.Controls.Add(this.label2);
             this.panel1.Controls.Add(this.label1);
             this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.panel1.Location = new System.Drawing.Point(4, 1188);
-            this.panel1.Margin = new System.Windows.Forms.Padding(4);
+            this.panel1.Location = new System.Drawing.Point(3, 793);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(2254, 60);
+            this.panel1.Size = new System.Drawing.Size(1502, 39);
             this.panel1.TabIndex = 4;
             // 
             // cbB_PageSize
             // 
             this.cbB_PageSize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.cbB_PageSize.FormattingEnabled = true;
-            this.cbB_PageSize.Location = new System.Drawing.Point(204, 15);
-            this.cbB_PageSize.Margin = new System.Windows.Forms.Padding(4);
+            this.cbB_PageSize.Location = new System.Drawing.Point(136, 10);
             this.cbB_PageSize.Name = "cbB_PageSize";
-            this.cbB_PageSize.Size = new System.Drawing.Size(86, 26);
+            this.cbB_PageSize.Size = new System.Drawing.Size(59, 20);
             this.cbB_PageSize.TabIndex = 38;
             this.cbB_PageSize.SelectedIndexChanged += new System.EventHandler(this.cbB_PageSize_SelectedIndexChanged);
             // 
             // label6
             // 
             this.label6.AutoSize = true;
-            this.label6.Location = new System.Drawing.Point(393, 19);
-            this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label6.Location = new System.Drawing.Point(262, 13);
             this.label6.Name = "label6";
-            this.label6.Size = new System.Drawing.Size(26, 18);
+            this.label6.Size = new System.Drawing.Size(17, 12);
             this.label6.TabIndex = 37;
             this.label6.Text = "页";
             // 
             // lblPageCount
             // 
             this.lblPageCount.AutoSize = true;
-            this.lblPageCount.Location = new System.Drawing.Point(360, 19);
-            this.lblPageCount.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.lblPageCount.Location = new System.Drawing.Point(240, 13);
             this.lblPageCount.Name = "lblPageCount";
-            this.lblPageCount.Size = new System.Drawing.Size(35, 18);
+            this.lblPageCount.Size = new System.Drawing.Size(23, 12);
             this.lblPageCount.TabIndex = 36;
             this.lblPageCount.Text = "100";
             this.lblPageCount.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -297,30 +279,27 @@
             // label4
             // 
             this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(82, 19);
-            this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label4.Location = new System.Drawing.Point(55, 13);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(116, 18);
+            this.label4.Size = new System.Drawing.Size(77, 12);
             this.label4.TabIndex = 35;
             this.label4.Text = "条记录,每页";
             // 
             // lblTotalCount
             // 
             this.lblTotalCount.AutoSize = true;
-            this.lblTotalCount.Location = new System.Drawing.Point(33, 19);
-            this.lblTotalCount.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.lblTotalCount.Location = new System.Drawing.Point(22, 13);
             this.lblTotalCount.Name = "lblTotalCount";
-            this.lblTotalCount.Size = new System.Drawing.Size(26, 18);
+            this.lblTotalCount.Size = new System.Drawing.Size(17, 12);
             this.lblTotalCount.TabIndex = 34;
             this.lblTotalCount.Text = "20";
             this.lblTotalCount.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
             // btnGo
             // 
-            this.btnGo.Location = new System.Drawing.Point(760, 11);
-            this.btnGo.Margin = new System.Windows.Forms.Padding(4);
+            this.btnGo.Location = new System.Drawing.Point(507, 7);
             this.btnGo.Name = "btnGo";
-            this.btnGo.Size = new System.Drawing.Size(56, 34);
+            this.btnGo.Size = new System.Drawing.Size(37, 23);
             this.btnGo.TabIndex = 33;
             this.btnGo.Text = "GO";
             this.btnGo.UseVisualStyleBackColor = true;
@@ -328,10 +307,9 @@
             // 
             // lnkLast
             // 
-            this.lnkLast.Location = new System.Drawing.Point(696, 11);
-            this.lnkLast.Margin = new System.Windows.Forms.Padding(4);
+            this.lnkLast.Location = new System.Drawing.Point(464, 7);
             this.lnkLast.Name = "lnkLast";
-            this.lnkLast.Size = new System.Drawing.Size(56, 34);
+            this.lnkLast.Size = new System.Drawing.Size(37, 23);
             this.lnkLast.TabIndex = 32;
             this.lnkLast.Text = ">|";
             this.lnkLast.UseVisualStyleBackColor = true;
@@ -339,10 +317,9 @@
             // 
             // lnkNext
             // 
-            this.lnkNext.Location = new System.Drawing.Point(632, 11);
-            this.lnkNext.Margin = new System.Windows.Forms.Padding(4);
+            this.lnkNext.Location = new System.Drawing.Point(421, 7);
             this.lnkNext.Name = "lnkNext";
-            this.lnkNext.Size = new System.Drawing.Size(56, 34);
+            this.lnkNext.Size = new System.Drawing.Size(37, 23);
             this.lnkNext.TabIndex = 31;
             this.lnkNext.Text = ">";
             this.lnkNext.UseVisualStyleBackColor = true;
@@ -350,20 +327,18 @@
             // 
             // txtPageNum
             // 
-            this.txtPageNum.Location = new System.Drawing.Point(567, 14);
-            this.txtPageNum.Margin = new System.Windows.Forms.Padding(4);
+            this.txtPageNum.Location = new System.Drawing.Point(378, 9);
             this.txtPageNum.Name = "txtPageNum";
-            this.txtPageNum.Size = new System.Drawing.Size(54, 28);
+            this.txtPageNum.Size = new System.Drawing.Size(37, 21);
             this.txtPageNum.TabIndex = 30;
             this.txtPageNum.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
             this.txtPageNum.TextChanged += new System.EventHandler(this.txtPageSize_TextChanged);
             // 
             // lnkPrev
             // 
-            this.lnkPrev.Location = new System.Drawing.Point(502, 11);
-            this.lnkPrev.Margin = new System.Windows.Forms.Padding(4);
+            this.lnkPrev.Location = new System.Drawing.Point(335, 7);
             this.lnkPrev.Name = "lnkPrev";
-            this.lnkPrev.Size = new System.Drawing.Size(56, 34);
+            this.lnkPrev.Size = new System.Drawing.Size(37, 23);
             this.lnkPrev.TabIndex = 29;
             this.lnkPrev.Text = "<";
             this.lnkPrev.UseVisualStyleBackColor = true;
@@ -371,10 +346,9 @@
             // 
             // lnkFirst
             // 
-            this.lnkFirst.Location = new System.Drawing.Point(438, 11);
-            this.lnkFirst.Margin = new System.Windows.Forms.Padding(4);
+            this.lnkFirst.Location = new System.Drawing.Point(292, 7);
             this.lnkFirst.Name = "lnkFirst";
-            this.lnkFirst.Size = new System.Drawing.Size(56, 34);
+            this.lnkFirst.Size = new System.Drawing.Size(37, 23);
             this.lnkFirst.TabIndex = 28;
             this.lnkFirst.Text = "|<";
             this.lnkFirst.UseVisualStyleBackColor = true;
@@ -383,20 +357,18 @@
             // label2
             // 
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(298, 19);
-            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label2.Location = new System.Drawing.Point(199, 13);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(62, 18);
+            this.label2.Size = new System.Drawing.Size(41, 12);
             this.label2.TabIndex = 27;
             this.label2.Text = "条,共";
             // 
             // label1
             // 
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(4, 19);
-            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label1.Location = new System.Drawing.Point(3, 13);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(26, 18);
+            this.label1.Size = new System.Drawing.Size(17, 12);
             this.label1.TabIndex = 26;
             this.label1.Text = "共";
             // 
@@ -413,15 +385,16 @@
             this.ToolStripMenuItem_selectparticle,
             this.ToolStripMenuItem_exportimagefile,
             this.testToolStripMenuItem,
-            this.EXCELToolStripMenuItem});
+            this.EXCELToolStripMenuItem,
+            this.ToolStripMenuItemDelete_Particle});
             this.contextMenuStrip1.Name = "contextMenuStrip1";
-            this.contextMenuStrip1.Size = new System.Drawing.Size(289, 298);
+            this.contextMenuStrip1.Size = new System.Drawing.Size(219, 310);
             // 
             // ToolStripMenuItem1
             // 
             this.ToolStripMenuItem1.Image = global::OTSIncAReportApp.Properties.Resources.复制;
             this.ToolStripMenuItem1.Name = "ToolStripMenuItem1";
-            this.ToolStripMenuItem1.Size = new System.Drawing.Size(288, 32);
+            this.ToolStripMenuItem1.Size = new System.Drawing.Size(218, 30);
             this.ToolStripMenuItem1.Text = "复制整个表";
             this.ToolStripMenuItem1.Click += new System.EventHandler(this.ToolStripMenuItem1_Click);
             // 
@@ -429,7 +402,7 @@
             // 
             this.ToolStripMenuItem2.Image = global::OTSIncAReportApp.Properties.Resources.复制全部;
             this.ToolStripMenuItem2.Name = "ToolStripMenuItem2";
-            this.ToolStripMenuItem2.Size = new System.Drawing.Size(288, 32);
+            this.ToolStripMenuItem2.Size = new System.Drawing.Size(218, 30);
             this.ToolStripMenuItem2.Text = "复制选择区域";
             this.ToolStripMenuItem2.Click += new System.EventHandler(this.ToolStripMenuItem2_Click);
             // 
@@ -437,20 +410,20 @@
             // 
             this.toolStripMenuItem4.Image = global::OTSIncAReportApp.Properties.Resources.复制图像;
             this.toolStripMenuItem4.Name = "toolStripMenuItem4";
-            this.toolStripMenuItem4.Size = new System.Drawing.Size(288, 32);
+            this.toolStripMenuItem4.Size = new System.Drawing.Size(218, 30);
             this.toolStripMenuItem4.Text = "复制图像";
             this.toolStripMenuItem4.Click += new System.EventHandler(this.toolStripMenuItem4_Click);
             // 
             // toolStripSeparator1
             // 
             this.toolStripSeparator1.Name = "toolStripSeparator1";
-            this.toolStripSeparator1.Size = new System.Drawing.Size(285, 6);
+            this.toolStripSeparator1.Size = new System.Drawing.Size(215, 6);
             // 
             // ToolStripMenuItem3
             // 
             this.ToolStripMenuItem3.Image = global::OTSIncAReportApp.Properties.Resources.恢复;
             this.ToolStripMenuItem3.Name = "ToolStripMenuItem3";
-            this.ToolStripMenuItem3.Size = new System.Drawing.Size(288, 32);
+            this.ToolStripMenuItem3.Size = new System.Drawing.Size(218, 30);
             this.ToolStripMenuItem3.Text = "恢复至初始状态";
             this.ToolStripMenuItem3.Click += new System.EventHandler(this.ToolStripMenuItem3_Click);
             // 
@@ -458,7 +431,7 @@
             // 
             this.ToolStripMenuItem5.Image = global::OTSIncAReportApp.Properties.Resources.移动SEM到当前位置;
             this.ToolStripMenuItem5.Name = "ToolStripMenuItem5";
-            this.ToolStripMenuItem5.Size = new System.Drawing.Size(288, 32);
+            this.ToolStripMenuItem5.Size = new System.Drawing.Size(218, 30);
             this.ToolStripMenuItem5.Text = "移动SEM到颗粒视域位置";
             this.ToolStripMenuItem5.Click += new System.EventHandler(this.ToolStripMenuItem5_Click);
             // 
@@ -466,7 +439,7 @@
             // 
             this.ToolStripMenuItem_selectparticle.Image = global::OTSIncAReportApp.Properties.Resources.选择颗粒;
             this.ToolStripMenuItem_selectparticle.Name = "ToolStripMenuItem_selectparticle";
-            this.ToolStripMenuItem_selectparticle.Size = new System.Drawing.Size(288, 32);
+            this.ToolStripMenuItem_selectparticle.Size = new System.Drawing.Size(218, 30);
             this.ToolStripMenuItem_selectparticle.Text = "Select Particles";
             this.ToolStripMenuItem_selectparticle.Click += new System.EventHandler(this.ToolStripMenuItem_selectparticle_Click);
             // 
@@ -474,14 +447,14 @@
             // 
             this.ToolStripMenuItem_exportimagefile.Image = global::OTSIncAReportApp.Properties.Resources.导出;
             this.ToolStripMenuItem_exportimagefile.Name = "ToolStripMenuItem_exportimagefile";
-            this.ToolStripMenuItem_exportimagefile.Size = new System.Drawing.Size(288, 32);
+            this.ToolStripMenuItem_exportimagefile.Size = new System.Drawing.Size(218, 30);
             this.ToolStripMenuItem_exportimagefile.Text = "导出图像文件";
             this.ToolStripMenuItem_exportimagefile.Click += new System.EventHandler(this.ToolStripMenuItem_exportimagefile_Click);
             // 
             // testToolStripMenuItem
             // 
             this.testToolStripMenuItem.Name = "testToolStripMenuItem";
-            this.testToolStripMenuItem.Size = new System.Drawing.Size(288, 32);
+            this.testToolStripMenuItem.Size = new System.Drawing.Size(218, 30);
             this.testToolStripMenuItem.Text = "显示能谱数据";
             this.testToolStripMenuItem.Visible = false;
             this.testToolStripMenuItem.Click += new System.EventHandler(this.testToolStripMenuItem_Click);
@@ -490,10 +463,17 @@
             // 
             this.EXCELToolStripMenuItem.Image = global::OTSIncAReportApp.Properties.Resources.导出所有数据到EXCEL321;
             this.EXCELToolStripMenuItem.Name = "EXCELToolStripMenuItem";
-            this.EXCELToolStripMenuItem.Size = new System.Drawing.Size(288, 32);
+            this.EXCELToolStripMenuItem.Size = new System.Drawing.Size(218, 30);
             this.EXCELToolStripMenuItem.Text = "导出EXCEL";
             this.EXCELToolStripMenuItem.Click += new System.EventHandler(this.EXCELToolStripMenuItem_Click);
             // 
+            // ToolStripMenuItemDelete_Particle
+            // 
+            this.ToolStripMenuItemDelete_Particle.Name = "ToolStripMenuItemDelete_Particle";
+            this.ToolStripMenuItemDelete_Particle.Size = new System.Drawing.Size(218, 30);
+            this.ToolStripMenuItemDelete_Particle.Text = "Delete particles";
+            this.ToolStripMenuItemDelete_Particle.Click += new System.EventHandler(this.ToolStripMenuItem_Delete_Particle_Click);
+            // 
             // tableLayoutPanel1
             // 
             this.tableLayoutPanel1.ColumnCount = 1;
@@ -503,14 +483,13 @@
             this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 2);
             this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
-            this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4);
             this.tableLayoutPanel1.Name = "tableLayoutPanel1";
             this.tableLayoutPanel1.RowCount = 3;
-            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 64F));
+            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 43F));
             this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
-            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 68F));
-            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
-            this.tableLayoutPanel1.Size = new System.Drawing.Size(2262, 1252);
+            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 45F));
+            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 13F));
+            this.tableLayoutPanel1.Size = new System.Drawing.Size(1508, 835);
             this.tableLayoutPanel1.TabIndex = 7;
             // 
             // dgV_ParticlesDevidePage
@@ -521,23 +500,21 @@
             this.dgV_ParticlesDevidePage.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.dgV_ParticlesDevidePage.ContextMenuStrip = this.contextMenuStrip1;
             this.dgV_ParticlesDevidePage.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.dgV_ParticlesDevidePage.Location = new System.Drawing.Point(4, 68);
-            this.dgV_ParticlesDevidePage.Margin = new System.Windows.Forms.Padding(4);
+            this.dgV_ParticlesDevidePage.Location = new System.Drawing.Point(3, 46);
             this.dgV_ParticlesDevidePage.Name = "dgV_ParticlesDevidePage";
             this.dgV_ParticlesDevidePage.ReadOnly = true;
             this.dgV_ParticlesDevidePage.RowHeadersWidth = 4;
             this.dgV_ParticlesDevidePage.RowTemplate.Height = 23;
-            this.dgV_ParticlesDevidePage.Size = new System.Drawing.Size(2254, 1112);
+            this.dgV_ParticlesDevidePage.Size = new System.Drawing.Size(1502, 741);
             this.dgV_ParticlesDevidePage.TabIndex = 5;
             // 
             // ParticlesGridDevidePage
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.Controls.Add(this.tableLayoutPanel1);
-            this.Margin = new System.Windows.Forms.Padding(4);
             this.Name = "ParticlesGridDevidePage";
-            this.Size = new System.Drawing.Size(2262, 1252);
+            this.Size = new System.Drawing.Size(1508, 835);
             this.Load += new System.EventHandler(this.ParticlesGridDevidePage_Load);
             this.panel2.ResumeLayout(false);
             this.panel2.PerformLayout();
@@ -593,5 +570,6 @@
         private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
         private System.Windows.Forms.ToolStripMenuItem EXCELToolStripMenuItem;
         private System.Windows.Forms.DataGridView dgV_ParticlesDevidePage;
+        private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemDelete_Particle;
     }
 }

+ 47 - 1
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage.cs

@@ -5,6 +5,7 @@ using OTSIncAReportApp.DataOperation.DataAccess;
 using OTSIncAReportApp.DataOperation.Model;
 using OTSIncAReportApp.SysMgrTools;
 using OTSIncAReportGraph.Class;
+using OTSIncAReportGraph.OTSIncAReportGraphFuncation;
 using OTSIncAReportGrids.OTSIncAReportGridsFuncation;
 using OTSIncAReportMailInterface;
 
@@ -68,6 +69,9 @@ namespace OTSIncAReportGrids
         //单个数据源所拥有的列数,这里保存下来,供导出模块使用
         public int m_oneresult_columncount = 0;
 
+        OTSImageDisHelp m_ReportFun = null;
+        private OTSImageDisHelp ReportFun { get => m_ReportFun; set => m_ReportFun = value; }
+
         //多个数据源,每个数据源拥有的列数,这里保存下来,供分组使用
         public List<int> m_list_oneresult_columncount;
         //国际化
@@ -158,13 +162,16 @@ namespace OTSIncAReportGrids
         #endregion
 
         frmReportApp m_ReportApp;
+        ResultFile resultFile = null;
         #endregion
 
         public ParticlesGridDevidePage(frmReportApp ReportApp)
         {
             m_ReportApp = ReportApp;
             m_condition = ReportApp.m_conditionChoose;
-            
+            resultFile = ReportApp.m_rstDataMgr.CurResultFile;
+            ReportFun = new OTSImageDisHelp(resultFile);
+
             string sou=m_condition.m_CurrentConditions[OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.DATA_SOURCE].itemDisplayVal.ToString();
             if (sou.Contains("+"))
             {
@@ -1803,6 +1810,45 @@ namespace OTSIncAReportGrids
             }
         }
 
+     
+
+        private void ToolStripMenuItem_Delete_Particle_Click(object sender, EventArgs e)
+        {
+            string path = result.FilePath;
+            ParticleData fielddata = new ParticleData(result.FilePath);
+            List<Particle> particles = fielddata.GetParticleAllList();
+
+            List<Particle> ls_list_cotsparticleclr = new List<Particle>();
+            for (int l = 0; l < dgV_ParticlesDevidePage.SelectedRows.Count; l++)
+            {
+                //从事先加载的Bitmap对象的Tag中取出List<string>
+                DataGridViewRow dgvr = dgV_ParticlesDevidePage.SelectedRows[l];
+                Bitmap ls_bp = (Bitmap)dgvr.Cells[2].Value;
+                List<string> list_str = (List<string>)ls_bp.Tag;
+                if (list_str != null)
+                {
+                    int i_ls_fieldid = Convert.ToInt32(list_str[0]);
+                    int i_ls_particleid = Convert.ToInt32(list_str[1]);
+                    foreach (Particle item in particles)
+                    {
+                        if (i_ls_fieldid == item.FieldId && i_ls_particleid == item.ParticleId)
+                        {
+                            if (ReportFun.DeleteParticlesFromLibrary(item.ParticleId, item.FieldId))
+                            {
+                                MessageBox.Show("Deleted successfully");
+                            }
+                            else
+                            {
+                                MessageBox.Show("Delete failed");
+                            }
+                            break;
+                        }
+                    }
+
+                }
+            }
+        }
+
     }
 
 

+ 4 - 0
OTSIncAReportApp/1-UI/OTSRibbon/OTSRibbonFun.cs

@@ -28,6 +28,7 @@ namespace OTSIncAReportApp.OTSRibbon
             //下拉菜单中
             m_ReportApp.dpbOpen.Enabled = true;         //打开,下拉菜单中
             m_ReportApp.dpbExport.Enabled = bRibState;  //输出,下拉菜单中
+            m_ReportApp.Backup.Enabled = bRibState;//备份数据库,下拉菜单
 
             //Ribbon菜单中
             m_ReportApp.rbOpen.Enabled = true;                  //打开,ribbon中
@@ -57,6 +58,7 @@ namespace OTSIncAReportApp.OTSRibbon
                 //(主菜单)下拉菜单中的 新建,打开,保存,另存为,输出
                 m_ReportApp.dpbOpen.Enabled = true;
                 m_ReportApp.dpbExport.Enabled = true;
+                m_ReportApp.Backup.Enabled = true;
 
                 //主菜单文件框里(保存、另存为、输出、新建)设置
                 m_ReportApp.rbSave.Enabled = true;
@@ -77,6 +79,7 @@ namespace OTSIncAReportApp.OTSRibbon
                 //(主菜单)下拉菜单中的 新建,打开,保存,另存为,输出
                 m_ReportApp.dpbOpen.Enabled = true;
                 m_ReportApp.dpbExport.Enabled = true;
+                m_ReportApp.Backup.Enabled = true;
 
                 //主菜单文件框里(保存、另存为、输出、新建)设置
                 m_ReportApp.rbSave.Enabled = true;
@@ -97,6 +100,7 @@ namespace OTSIncAReportApp.OTSRibbon
                 //(主菜单)下拉菜单中的 新建,打开,保存,另存为,输出
                 m_ReportApp.dpbOpen.Enabled = true;
                 m_ReportApp.dpbExport.Enabled = true;
+                m_ReportApp.Backup.Enabled = true;
 
                 //主菜单文件框里(保存、另存为、输出、新建)设置
                 m_ReportApp.rbSave.Enabled = true;

+ 31 - 13
OTSIncAReportApp/1-UI/frmReportApp.Designer.cs

@@ -85,6 +85,7 @@
             this.ribbonOrbMenuItem7 = new System.Windows.Forms.RibbonOrbMenuItem();
             this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
             this.ribbonButton3 = new System.Windows.Forms.RibbonButton();
+            this.Backup = new System.Windows.Forms.RibbonOrbMenuItem();
             ribbonPanel1 = new System.Windows.Forms.RibbonPanel();
             this.statusStrip1.SuspendLayout();
             this.SuspendLayout();
@@ -184,7 +185,7 @@
             // 
             this.ribbon1.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.ribbon1.Location = new System.Drawing.Point(0, 0);
-            this.ribbon1.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
+            this.ribbon1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.ribbon1.Minimized = false;
             this.ribbon1.Name = "ribbon1";
             // 
@@ -195,10 +196,11 @@
             this.ribbon1.OrbDropDown.MenuItems.Add(this.dpbOpen);
             this.ribbon1.OrbDropDown.MenuItems.Add(this.dpbExport);
             this.ribbon1.OrbDropDown.MenuItems.Add(this.ribbonOrbMenuItem_Extremum);
+            this.ribbon1.OrbDropDown.MenuItems.Add(this.Backup);
             this.ribbon1.OrbDropDown.Name = "";
             this.ribbon1.OrbDropDown.OptionItems.Add(this.ribbonOrbOptionButton1);
             this.ribbon1.OrbDropDown.RecentItems.Add(this.ribbonOrbRecentItem1);
-            this.ribbon1.OrbDropDown.Size = new System.Drawing.Size(527, 204);
+            this.ribbon1.OrbDropDown.Size = new System.Drawing.Size(527, 248);
             this.ribbon1.OrbDropDown.TabIndex = 0;
             this.ribbon1.OrbImage = global::OTSIncAReportApp.Properties.Resources.logo_40;
             // 
@@ -211,7 +213,7 @@
             this.ribbon1.QuickAcessToolbar.ToolTip = null;
             this.ribbon1.QuickAcessToolbar.ToolTipImage = null;
             this.ribbon1.QuickAcessToolbar.ToolTipTitle = null;
-            this.ribbon1.Size = new System.Drawing.Size(1701, 130);
+            this.ribbon1.Size = new System.Drawing.Size(1276, 130);
             this.ribbon1.TabIndex = 0;
             this.ribbon1.Tabs.Add(this.ribbonTab1);
             this.ribbon1.Tabs.Add(this.rbMenu);
@@ -535,11 +537,11 @@
             this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.RSGrayVal,
             this.mouseMatter});
-            this.statusStrip1.Location = new System.Drawing.Point(0, 835);
+            this.statusStrip1.Location = new System.Drawing.Point(0, 666);
             this.statusStrip1.Name = "statusStrip1";
-            this.statusStrip1.Padding = new System.Windows.Forms.Padding(12, 0, 3, 0);
+            this.statusStrip1.Padding = new System.Windows.Forms.Padding(9, 0, 2, 0);
             this.statusStrip1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
-            this.statusStrip1.Size = new System.Drawing.Size(1701, 30);
+            this.statusStrip1.Size = new System.Drawing.Size(1276, 26);
             this.statusStrip1.TabIndex = 4;
             this.statusStrip1.Text = "statusStrip1";
             // 
@@ -547,14 +549,14 @@
             // 
             this.RSGrayVal.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right;
             this.RSGrayVal.Name = "RSGrayVal";
-            this.RSGrayVal.Size = new System.Drawing.Size(58, 24);
+            this.RSGrayVal.Size = new System.Drawing.Size(48, 21);
             this.RSGrayVal.Text = "灰度值";
             // 
             // mouseMatter
             // 
             this.mouseMatter.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right;
             this.mouseMatter.Name = "mouseMatter";
-            this.mouseMatter.Size = new System.Drawing.Size(103, 24);
+            this.mouseMatter.Size = new System.Drawing.Size(84, 21);
             this.mouseMatter.Text = "鼠标点的物质";
             // 
             // DockWindowPanel
@@ -563,9 +565,9 @@
             this.DockWindowPanel.Dock = System.Windows.Forms.DockStyle.Fill;
             this.DockWindowPanel.DockBackColor = System.Drawing.SystemColors.Control;
             this.DockWindowPanel.Location = new System.Drawing.Point(0, 130);
-            this.DockWindowPanel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.DockWindowPanel.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.DockWindowPanel.Name = "DockWindowPanel";
-            this.DockWindowPanel.Size = new System.Drawing.Size(1701, 705);
+            this.DockWindowPanel.Size = new System.Drawing.Size(1276, 536);
             dockPanelGradient4.EndColor = System.Drawing.SystemColors.ControlLight;
             dockPanelGradient4.StartColor = System.Drawing.SystemColors.ControlLight;
             autoHideStripSkin2.DockStripGradient = dockPanelGradient4;
@@ -654,17 +656,32 @@
             this.ribbonButton3.ToolTipImage = null;
             this.ribbonButton3.ToolTipTitle = null;
             // 
+            // Backup
+            // 
+            this.Backup.AltKey = null;
+            this.Backup.DropDownArrowDirection = System.Windows.Forms.RibbonArrowDirection.Left;
+            this.Backup.DropDownArrowSize = new System.Drawing.Size(5, 3);
+            this.Backup.Image = ((System.Drawing.Image)(resources.GetObject("Backup.Image")));
+            this.Backup.SmallImage = ((System.Drawing.Image)(resources.GetObject("Backup.SmallImage")));
+            this.Backup.Style = System.Windows.Forms.RibbonButtonStyle.Normal;
+            this.Backup.Tag = null;
+            this.Backup.Text = "Backup Database";
+            this.Backup.ToolTip = null;
+            this.Backup.ToolTipImage = null;
+            this.Backup.ToolTipTitle = null;
+            this.Backup.Click += new System.EventHandler(this.Backup_Click);
+            // 
             // frmReportApp
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1701, 865);
+            this.ClientSize = new System.Drawing.Size(1276, 692);
             this.Controls.Add(this.DockWindowPanel);
             this.Controls.Add(this.statusStrip1);
             this.Controls.Add(this.ribbon1);
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
             this.IsMdiContainer = true;
-            this.Margin = new System.Windows.Forms.Padding(4, 2, 4, 2);
+            this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.Name = "frmReportApp";
             this.Text = "OTSReportApp";
             this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
@@ -726,6 +743,7 @@
         public System.Windows.Forms.RibbonButton ribbonButton3;
         public System.Windows.Forms.RibbonButton rbHelp;
         private System.Windows.Forms.RibbonOrbMenuItem ribbonOrbMenuItem_Extremum;
+        public System.Windows.Forms.RibbonOrbMenuItem Backup;
     }
 }
 

+ 29 - 2
OTSIncAReportApp/1-UI/frmReportApp.cs

@@ -7,6 +7,7 @@ using OTSIncAReportApp.OTSRibbon;
 using OTSIncAReportApp.OTSSampleReportInfo;
 using OTSIncAReportApp.SysMgrTools;
 using OTSIncAReportGraph;
+using OTSIncAReportGraph.OTSIncAReportGraphFuncation;
 using OTSIncAReprotCharts;
 
 using System;
@@ -41,6 +42,11 @@ namespace OTSIncAReportApp
         public frmCharts m_ChartsWindow = null;                                //图表窗体
         public frmTables m_TablesWindow = null;                                //报表窗体
         public frmReportSysConfig m_ReportSysConfigForm;                        //配置参数窗体
+
+
+        ResultFile resultFile = null;
+        OTSImageDisHelp m_ReportFun = null;
+        public OTSImageDisHelp ReportFun { get => m_ReportFun; set => m_ReportFun = value; }
         #endregion //-----------------------------------------------------------------------------------------------
 
         #region 报告类结构相关------------------------------------------------------------------------------------
@@ -215,6 +221,8 @@ namespace OTSIncAReportApp
             m_OutputNlog = new OutputNlog();
             m_OutputNlog.Visible = true;
             log = NLog.LogManager.GetCurrentClassLogger();
+
+            
             InitializeComponent();
            
             //初始化Ribbon类,操作Ribbon按钮的可用或者不可用
@@ -234,6 +242,8 @@ namespace OTSIncAReportApp
             //grid表格窗体
             m_TablesWindow = new frmTables(this);
 
+
+
             SetTag();
 
             #region 国际化语言
@@ -296,8 +306,8 @@ namespace OTSIncAReportApp
             m_ChartsWindow = new frmCharts(this);
             //grid表格窗体
             m_TablesWindow = new frmTables(this);
-            
-            
+
+           
             SetTag();
             #region 国际化语言
             Language lan = new Language(this);
@@ -1127,6 +1137,23 @@ namespace OTSIncAReportApp
             csName = csName.Substring(0, csName.IndexOf('\0'));
             return csName;
         }
+
+     
+
+        private void Backup_Click(object sender, EventArgs e)
+        {
+            resultFile = m_rstDataMgr.CurResultFile;
+            ReportFun = new OTSImageDisHelp(resultFile);
+
+            if (ReportFun.BackupDatabase())
+            {
+                MessageBox.Show("Backup succeeded");
+            }
+            else
+            {
+                MessageBox.Show("Backup failed");
+            }
+        }
     }
 }
 

+ 12 - 0
OTSIncAReportApp/1-UI/frmReportApp.resx

@@ -185,6 +185,18 @@
     <value>
         iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAW
         JQAAFiUBSVIk8AAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="Backup.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABpJREFUWEftwQEBAAAAgiD/r25IQAAAAMC5GhAgAAGdeElDAAAAAElFTkSuQmCC
+</value>
+  </data>
+  <data name="Backup.SmallImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+        wwAADsMBx2+oZAAAABNJREFUOE9jGAWjYBSMAjBgYAAABBAAAadEfGMAAAAASUVORK5CYII=
 </value>
   </data>
   <data name="ribbonOrbOptionButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

+ 1 - 1
OTSIncAReportApp/2-CommonFunction/OTSDataMgrFunction/ResultDataMgr.cs

@@ -114,7 +114,7 @@ namespace OTSIncAReportApp.OTSDataMgrFunction
             List<Field> fieldlist = fieldData.GetFieldList();
             CurResultFile.List_OTSField = fieldlist;
 
-
+            //new OTSImageDisHelp(CurResultFile);
 
             return true;
         }

+ 14 - 1
OTSIncAReportApp/3-ServiceCenter/DataOperation/DataAccess/ParticleData.cs

@@ -333,7 +333,20 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
             DataTable DT = dbHelper.ExecuteDataTable(sqlp, null);
             return DT;
         }
-
+        public bool DeleteFromData(string fieldid, string particleid)
+        {
+            
+            string sqlp = @"delete from IncAData where FieldId="+ fieldid + " and ParticleId="
+            + particleid;
+            if (dbHelper.ExecuteQuery_bool(sqlp))
+            {
+                return true;
+            }else
+            {
+                return false;
+            }
+            
+        }
         /// <summary>
         /// 获取颗粒信息
         /// </summary>

+ 16 - 0
OTSIncAReportApp/3-ServiceCenter/DataOperation/DataAccess/SqlHelper.cs

@@ -129,6 +129,22 @@ namespace OTSIncAReportApp.DataOperation.DataAccess
             return dt;
         }
 
+
+        public bool ExecuteQuery_bool(string queryString)
+        {
+            try
+            {
+                dataAdapter = new SQLiteDataAdapter(queryString, dbConnection);
+                DataSet ds = new DataSet();
+                dataAdapter.Fill(ds);
+                return true;
+            }
+            catch (Exception)
+            {
+                return false;
+            }
+        }
+
         public DataTable ExecuteQuery2(string queryString)
         {
             SQLiteCommand sqlCommand = new SQLiteCommand(queryString,dbConnection);