Selaa lähdekoodia

增加根据相似度批量修改功能

cxs 4 kuukautta sitten
vanhempi
commit
49fedc9867

+ 12 - 3
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ListOfSimilarParticles.Designer.cs

@@ -34,6 +34,7 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
             this.dgV_SimilarParticles = new System.Windows.Forms.DataGridView();
             this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
             this.movetoparticleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.从此颗粒之下取消选择ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.btn_OK = new System.Windows.Forms.Button();
             this.btn_Cannnel = new System.Windows.Forms.Button();
             this.tB_SimilarRatio = new System.Windows.Forms.TextBox();
@@ -64,7 +65,6 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
             this.dgV_SimilarParticles.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
             this.dgV_SimilarParticles.Size = new System.Drawing.Size(1772, 725);
             this.dgV_SimilarParticles.TabIndex = 6;
-            this.dgV_SimilarParticles.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgV_SimilarParticles_CellMouseClick);
             this.dgV_SimilarParticles.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgV_SimilarParticles_CellMouseDoubleClick);
             this.dgV_SimilarParticles.KeyUp += new System.Windows.Forms.KeyEventHandler(this.dgV_SimilarParticles_KeyUp);
             this.dgV_SimilarParticles.MouseUp += new System.Windows.Forms.MouseEventHandler(this.dgV_SimilarParticles_MouseUp);
@@ -72,9 +72,10 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
             // contextMenuStrip1
             // 
             this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.movetoparticleToolStripMenuItem});
+            this.movetoparticleToolStripMenuItem,
+            this.从此颗粒之下取消选择ToolStripMenuItem});
             this.contextMenuStrip1.Name = "contextMenuStrip1";
-            this.contextMenuStrip1.Size = new System.Drawing.Size(211, 26);
+            this.contextMenuStrip1.Size = new System.Drawing.Size(211, 48);
             // 
             // movetoparticleToolStripMenuItem
             // 
@@ -83,6 +84,13 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
             this.movetoparticleToolStripMenuItem.Text = "移动SEM到颗粒视域位置";
             this.movetoparticleToolStripMenuItem.Click += new System.EventHandler(this.movetoparticleToolStripMenuItem_Click);
             // 
+            // 从此颗粒之下取消选择ToolStripMenuItem
+            // 
+            this.从此颗粒之下取消选择ToolStripMenuItem.Name = "从此颗粒之下取消选择ToolStripMenuItem";
+            this.从此颗粒之下取消选择ToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
+            this.从此颗粒之下取消选择ToolStripMenuItem.Text = "从此颗粒之下取消选择";
+            this.从此颗粒之下取消选择ToolStripMenuItem.Click += new System.EventHandler(this.从此颗粒之下取消选择ToolStripMenuItem_Click);
+            // 
             // btn_OK
             // 
             this.btn_OK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@@ -225,5 +233,6 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
         private System.Windows.Forms.ToolStripMenuItem movetoparticleToolStripMenuItem;
         private System.Windows.Forms.Label label2;
         private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.ToolStripMenuItem 从此颗粒之下取消选择ToolStripMenuItem;
     }
 }

+ 98 - 3
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ListOfSimilarParticles.cs

@@ -488,7 +488,10 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
             checkBoxColumn.Width = 30;
             checkBoxColumn.ReadOnly = false;
             dgV_SimilarParticles.Columns.Insert(0, checkBoxColumn);
-            dgV_SimilarParticles.Rows[0].Cells[2].Value = _RenameInfo[1];
+            if (_RenameInfo != null)
+            {
+                dgV_SimilarParticles.Rows[0].Cells[2].Value = _RenameInfo[1];
+            }
             dgV_SimilarParticles.Visible = true;
         }
 
@@ -534,6 +537,37 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
 
         private void btn_OK_Click(object sender, EventArgs e)
         {
+            if (_RenameInfo == null)
+            {
+                string CategoryName = "";
+                //循环选中颗粒
+                DataGridViewRow dgvr = dgV_SimilarParticles.Rows[0];
+                CategoryName = dgvr.Cells[2].Value.ToString();
+                string TypeId = "";
+                string TypeName = "";
+                string TypeColor = "";
+                string GroupName = "";
+                DataTable da = _particlesGridDevidePage.Particledata.GetParticleListForParticlSize("area", "");
+                ModifyCategoryForm modifyCategoryForm = new ModifyCategoryForm(da, CategoryName);
+                DialogResult result = modifyCategoryForm.ShowDialog();
+                if (modifyCategoryForm.DoYouWantToModifyIt)
+                {
+                    TypeId = modifyCategoryForm.OutTypeAndName[0];
+                    TypeName = modifyCategoryForm.OutTypeAndName[1];
+                    TypeColor = modifyCategoryForm.OutTypeAndName[2];
+                    GroupName = modifyCategoryForm.OutTypeAndName[3];
+
+                    _RenameInfo = new List<string>();
+                    _RenameInfo.Add(TypeId);
+                    _RenameInfo.Add(TypeName);
+                    _RenameInfo.Add(TypeColor);
+                    _RenameInfo.Add(GroupName);
+                }
+                else
+                {
+                    return;
+                }
+            }
             List<KeyValuePair<string, SQLiteParameter[]>> cmdlist = new List<KeyValuePair<string, SQLiteParameter[]>>();
             foreach (DataGridViewRow row in dgV_SimilarParticles.Rows)
             {
@@ -780,6 +814,7 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
             }
         }
 
+
         private void dgV_SimilarParticles_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
         {
             var SelectRows = dgV_SimilarParticles.SelectedRows;
@@ -801,10 +836,70 @@ namespace OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage
                 }
             }
         }
-
-        private void dgV_SimilarParticles_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
+        public ListOfSimilarParticles(OTSIncAReportGrids.ParticlesGridDevidePage particlesGridDevidePage, uint[] SelXray, int classifyid)
         {
+            InitializeComponent();
+            _particlesGridDevidePage = particlesGridDevidePage;
+            SelXrayclr.SetXrayData(SelXray);
+            table = particlesGridDevidePage.table;
+            _classifyid = classifyid;
+
+            m_mythread = new Thread(new ParameterizedThreadStart(Thread_GO));
+
+
+            //设置窗体的双缓冲,以保证大数据时拖动不卡
+            this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint, true);
+            this.UpdateStyles();
+            //利用反射设置DataGridView的双缓冲
+            Type dgvType = this.dgV_SimilarParticles.GetType();
+            PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
+            pi.SetValue(this.dgV_SimilarParticles, true, null);
 
+            this.control_XRayTable1 = new OTSIncAReportGraph.Controls.Control_XRayTable(null);
+            this.control_XRayTable1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
+            this.control_XRayTable1.Dock = System.Windows.Forms.DockStyle.Bottom;
+            this.control_XRayTable1.GBInfoStr = "";
+            this.control_XRayTable1.GoodChineseName = "";
+            this.control_XRayTable1.MaterialName = "";
+            this.control_XRayTable1.Location = new System.Drawing.Point(0, 400);
+            this.control_XRayTable1.Name = "control_XRayTable1";
+            this.control_XRayTable1.ShowAnalysisXray = true;
+            this.control_XRayTable1.ShowSearchXray = false;
+            this.control_XRayTable1.Size = new System.Drawing.Size(1004, 200);
+            this.control_XRayTable1.STDName = "";
+            this.control_XRayTable1.Visible = false;
+            this.control_XRayTable1.label_close.Visible = true;
+            panel1.Controls.Add(this.control_XRayTable1);
+        }
+
+
+
+
+
+
+
+
+
+
+
+
+        private void 从此颗粒之下取消选择ToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            var SelectRows = dgV_SimilarParticles.SelectedRows;
+            if (SelectRows.Count != 0)
+            {
+                DataGridViewRow dgvr = SelectRows[0];
+                for (int i = dgvr.Index + 1; i < dgV_SimilarParticles.Rows.Count; i++)
+                {
+                    dgV_SimilarParticles.Rows[i].Cells[0].Value=false;
+                }
+                if(dgvr.Index + 1!= dgV_SimilarParticles.Rows.Count)
+                {
+                    this.cBx_All.CheckedChanged -= new System.EventHandler(this.cBx_All_CheckedChanged);
+                    cBx_All.Checked=false;
+                    this.cBx_All.CheckedChanged += new System.EventHandler(this.cBx_All_CheckedChanged);
+                }
+            }
         }
     }
 }

+ 12 - 2
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ParticlesGridDevidePage.Designer.cs

@@ -85,6 +85,7 @@ namespace OTSIncAReportGrids
             this.ToolStripMenuItemDelete_Particle = new System.Windows.Forms.ToolStripMenuItem();
             this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
             this.dgV_ParticlesDevidePage = new System.Windows.Forms.DataGridView();
+            this.根据相似度批量修改ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.panel2.SuspendLayout();
             this.panel1.SuspendLayout();
             this.contextMenuStrip1.SuspendLayout();
@@ -525,9 +526,10 @@ namespace OTSIncAReportGrids
             this.ToolStripMenuItem_exportimagefile,
             this.testToolStripMenuItem,
             this.EXCELToolStripMenuItem,
-            this.ToolStripMenuItemDelete_Particle});
+            this.ToolStripMenuItemDelete_Particle,
+            this.根据相似度批量修改ToolStripMenuItem});
             this.contextMenuStrip1.Name = "contextMenuStrip1";
-            this.contextMenuStrip1.Size = new System.Drawing.Size(211, 230);
+            this.contextMenuStrip1.Size = new System.Drawing.Size(211, 252);
             // 
             // ToolStripMenuItem1
             // 
@@ -637,6 +639,13 @@ namespace OTSIncAReportGrids
             this.dgV_ParticlesDevidePage.MouseDown += new System.Windows.Forms.MouseEventHandler(this.dgV_ParticlesDevidePage_MouseDown);
             this.dgV_ParticlesDevidePage.MouseUp += new System.Windows.Forms.MouseEventHandler(this.dgV_ParticlesDevidePage_MouseUp);
             // 
+            // 根据相似度批量修改ToolStripMenuItem
+            // 
+            this.根据相似度批量修改ToolStripMenuItem.Name = "根据相似度批量修改ToolStripMenuItem";
+            this.根据相似度批量修改ToolStripMenuItem.Size = new System.Drawing.Size(210, 22);
+            this.根据相似度批量修改ToolStripMenuItem.Text = "根据相似度批量修改";
+            this.根据相似度批量修改ToolStripMenuItem.Click += new System.EventHandler(this.根据相似度批量修改ToolStripMenuItem_Click);
+            // 
             // ParticlesGridDevidePage
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -712,5 +721,6 @@ namespace OTSIncAReportGrids
         private System.Windows.Forms.TextBox tbx_ECDMax;
         private System.Windows.Forms.Label label10;
         private System.Windows.Forms.TextBox tbx_ECDMin;
+        private System.Windows.Forms.ToolStripMenuItem 根据相似度批量修改ToolStripMenuItem;
     }
 }

+ 78 - 19
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ParticlesGridDevidePage.cs

@@ -1674,25 +1674,6 @@ namespace OTSIncAReportGrids
                     DialogResult result3=Form_listOfSimilarParticles.ShowDialog();
                     if(result3== DialogResult.OK)
                     {
-                        UpdateTable();
-                        lnkFirst_Click(null, null);
-                        SetDataGridViewStyle();
-                        DataTable table = GetClassificationOfAllParticles();
-                        if (table != null)
-                        {
-                            if (table.Rows.Count > 0)
-                            {
-                                foreach (DataRow row in table.Rows)
-                                {
-                                    tbx_Type.Text += row["TypeName"].ToString() + '$';
-                                }
-                            }
-                            if (tbx_Type.Text != "")
-                            {
-                                tbx_Type.Text = tbx_Type.Text.Remove(tbx_Type.Text.Length - 1);
-                            }
-                        }
-                        dgV_ParticlesDevidePage.Focus();
                     }
                     else
                     {
@@ -1735,6 +1716,25 @@ namespace OTSIncAReportGrids
                     }
                     Particledata.ExecuteNonQueryBatch(cmdlist);
                 }
+                UpdateTable();
+                lnkFirst_Click(null, null);
+                SetDataGridViewStyle();
+                DataTable table = GetClassificationOfAllParticles();
+                if (table != null)
+                {
+                    if (table.Rows.Count > 0)
+                    {
+                        foreach (DataRow row in table.Rows)
+                        {
+                            tbx_Type.Text += row["TypeName"].ToString() + '$';
+                        }
+                    }
+                    if (tbx_Type.Text != "")
+                    {
+                        tbx_Type.Text = tbx_Type.Text.Remove(tbx_Type.Text.Length - 1);
+                    }
+                }
+                dgV_ParticlesDevidePage.Focus();
             }
         }
         void CreateChart(IDrawing drawing, ISheet sheet, IClientAnchor anchor, int rowid)
@@ -2497,6 +2497,65 @@ namespace OTSIncAReportGrids
             DataTable table = Particledata.GetClassificationOfAllParticles(str);
             return table;
         }
+
+        private void 根据相似度批量修改ToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            //如果没有选中颗粒退出
+            if (dgV_ParticlesDevidePage.SelectedRows.Count == 0)
+            {
+                return;
+            }
+            int sel = m_ReportApp.m_conditionChoose.m_conditionData.GetComboDownListIndexByItemName(OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.PARTICE_LIST);
+            if (sel == (int)SelItem.MergeParticles)
+            {
+                return;
+            }
+            var SelectRows = dgV_ParticlesDevidePage.SelectedRows;
+            uint[] Search_xray = new uint[2000];
+            int classifyid = -1;
+            if (SelectRows.Count != 0)
+            {
+                if (SelectRows.Count == 1)
+                {
+                    DataGridViewRow dgvr = SelectRows[0];
+                    Bitmap ls_bp = (Bitmap)dgvr.Cells[2].Value;
+                    List<string> list_str = (List<string>)ls_bp.Tag;
+                    classifyid = Convert.ToInt32(list_str[2]);
+                    uint[] Analysis_xray = new uint[2000];
+                    int i_xray_id = 0;
+                    List<Element> list_celementchemistryclr = new List<Element>();
+                    ReportFun.GetXrayByParticleTagIDAndFieldID_ForDrawDistrbutionImageAndBSE(Convert.ToInt32(dgvr.Cells["particleId"].Value), Convert.ToInt32(dgvr.Cells["fieldid"].Value), out Search_xray, out Analysis_xray, out i_xray_id, out list_celementchemistryclr);
+                }
+            }
+            ListOfSimilarParticles Form_listOfSimilarParticles = new ListOfSimilarParticles(this, Search_xray, classifyid);
+            DialogResult result3 = Form_listOfSimilarParticles.ShowDialog();
+            if (result3 == DialogResult.OK)
+            {
+                UpdateTable();
+                lnkFirst_Click(null, null);
+                SetDataGridViewStyle();
+                DataTable table = GetClassificationOfAllParticles();
+                if (table != null)
+                {
+                    if (table.Rows.Count > 0)
+                    {
+                        foreach (DataRow row in table.Rows)
+                        {
+                            tbx_Type.Text += row["TypeName"].ToString() + '$';
+                        }
+                    }
+                    if (tbx_Type.Text != "")
+                    {
+                        tbx_Type.Text = tbx_Type.Text.Remove(tbx_Type.Text.Length - 1);
+                    }
+                }
+                dgV_ParticlesDevidePage.Focus();
+            }
+            else
+            {
+                
+            }
+        }
     }
 }