Explorar el Código

报告颗粒列表添加颗粒图像及谱图显示

cxs hace 1 año
padre
commit
239fc4fad4

+ 55 - 17
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_XRayTable.cs

@@ -48,8 +48,10 @@ namespace OTSIncAReportGraph.Controls
         float m_i_draw_start = 0;                                       //整个界面绘制的起始点
         float m_i_draw_end = 1004;                                      //整个界面绘制的边界
 
+        float m_Y_draw_end = 220;                                      //整个界面绘制的边界高
         float m_Y_draw_TopDiff = 15;                                    //Y轴距离顶部距离
         float m_Y_MaxValue = 0;                                         //Y轴显示的最大刻度长度
+        uint m_Y_Value = 50;                                           //Y轴大刻度包含像素数
 
         float m_i_rightdrawlabellocation_x = 850;                       //右上角要显示文字的位置
         float m_i_rightdrawlabellocation_y = 5;                         //右上角要显示文字的位置
@@ -164,6 +166,22 @@ namespace OTSIncAReportGraph.Controls
         public Control_XRayTable()
         {
             InitializeComponent();
+            pictureBox1.Visible = false;
+            pictureBox2.Visible = false;
+            m_i_draw_start += 25;
+        }
+        public Control_XRayTable(Bitmap a_bitmap)
+        {
+            InitializeComponent();
+            pictureBox1.Visible = true;
+            pictureBox2.Visible = true;
+            m_i_draw_start += pictureBox1.Width+pictureBox2.Width+25;
+        }
+
+        public void SetBitmapOfPictureBox(Bitmap a_bitmap1, Bitmap a_bitmap2)
+        {
+            pictureBox1.Image = a_bitmap1;
+            pictureBox2.Image = a_bitmap2;
         }
 
         /// <summary>
@@ -190,8 +208,9 @@ namespace OTSIncAReportGraph.Controls
         {
             //重新加载时,对当前的宽度等重新加载并计算
             m_i_draw_end = this.Width;
-            m_i_smalkd = (m_i_draw_end - 4) / m_i_smallkd_number;//按宽度重新计算小刻度的长度 -4是有4像素的边框差
-            m_i_bigkd = (m_i_draw_end - 4) / m_i_bigkd_number;   //按宽度重新计算大刻度的长度
+            m_Y_draw_end = this.Height;
+            m_i_smalkd = (m_i_draw_end- m_i_draw_start - 4) / m_i_smallkd_number;//按宽度重新计算小刻度的长度 -4是有4像素的边框差
+            m_i_bigkd = (m_i_draw_end- m_i_draw_start - 4) / m_i_bigkd_number;   //按宽度重新计算大刻度的长度
 
 
             #region 重新初始化相关全局变量
@@ -272,7 +291,7 @@ namespace OTSIncAReportGraph.Controls
 
             double ls_width = m_i_draw_end;//改成固定值,整个绘制浪线的总长
             double ls_cs = 2000;
-            m_f_zl = (float)(ls_width / ls_cs);
+            m_f_zl = (float)((ls_width- m_i_draw_start) / ls_cs);
 
             //计算KML峰值判定的上标值与下标值
             GetKMLFPD_MAXANDMIN(m_analysis_xray);
@@ -447,16 +466,19 @@ namespace OTSIncAReportGraph.Controls
         /// </summary>
         /// <param name="g"></param>
         protected void DrawXrayImage(Graphics g)
-        { 
+        {
 
             #region //绘制标尺表盘部份----------------------------------------------------------------------------------------------
-
+            
             //宽度比的缩放基数
             float f_js_width = 1;//经过考虑,先定为1,为固定的像素进行绘制
 
+
             #region 绘制下面的标尺
             //x轴标尺的线
             g.DrawLine(m_this_p, m_i_draw_start, m_f_rulerX_location, m_i_draw_end * f_js_width, m_f_rulerX_location);
+            //y轴标尺的线
+            g.DrawLine(m_this_p, m_i_draw_start, m_f_rulerX_location, m_i_draw_start, -m_Y_draw_end+ m_Y_draw_TopDiff+ m_f_rulerX_location+20);
 
             //200个小刻度
             for (int i = 0; i < m_i_smallkd_number; i++)
@@ -476,6 +498,18 @@ namespace OTSIncAReportGraph.Controls
                     g.DrawString((i_count - 1).ToString(), m_thisfont_bold, m_this_sb, m_i_draw_start + (i * m_i_bigkd * f_js_width) + 1, m_f_rulerX_location + 10);
                 }
             }
+            int m_Y_Value_Count = (int)Math.Floor(m_xraytopixel_multiple * 150 / 25);
+            m_Y_Value = (uint)(m_Y_Value_Count/4) * 25;
+            //纵坐标
+            for (int i = 0; i < 30; i++)
+            {
+                if (i * m_Y_Value <= m_xraytopixel_multiple*150)
+                {
+                    g.DrawLine(m_this_p, m_i_draw_start, m_f_rulerX_location - (i * GetValueByRatio(m_Y_Value) * f_js_width), m_i_draw_start + 3, m_f_rulerX_location - (i * GetValueByRatio(m_Y_Value) * f_js_width));
+                    int aa = i * Convert.ToInt16(m_Y_Value);
+                    g.DrawString(aa.ToString(), m_thisfont_bold, m_this_sb, m_i_draw_start - 10 - ((aa.ToString().Length - 1) * 6), m_f_rulerX_location - (i * GetValueByRatio(m_Y_Value) * f_js_width) - 7);
+                }
+            }
 
             //补充输入文字,为了美观
             //g.DrawString("kv", m_thisfont_bold, m_this_sb, 8, m_f_rulerX_location + 10);
@@ -498,9 +532,9 @@ namespace OTSIncAReportGraph.Controls
                 for (int i = 0; i < m_list_twopoint1.Count(); i++)
                 {
                     PointF ls_pf1 = m_list_twopoint1[i].pf1;
-                    ls_pf1.X = ls_pf1.X * f_js_width;
+                    ls_pf1.X = ls_pf1.X * f_js_width+ m_i_draw_start;
                     PointF ls_pf2 = m_list_twopoint1[i].pf2;
-                    ls_pf2.X = ls_pf2.X * f_js_width;
+                    ls_pf2.X = ls_pf2.X * f_js_width+ m_i_draw_start;
 
                     g.DrawLine(m_this_p, ls_pf1, ls_pf2);
 
@@ -514,9 +548,9 @@ namespace OTSIncAReportGraph.Controls
                 for (int i = 0; i < m_list_twopoint2.Count(); i++)
                 {
                     PointF ls_pf1_2 = m_list_twopoint2[i].pf1;
-                    ls_pf1_2.X = ls_pf1_2.X * f_js_width;
+                    ls_pf1_2.X = (ls_pf1_2.X) * f_js_width+ m_i_draw_start ;
                     PointF ls_pf2_2 = m_list_twopoint2[i].pf2;
-                    ls_pf2_2.X = ls_pf2_2.X * f_js_width;
+                    ls_pf2_2.X = (ls_pf2_2.X) * f_js_width+ m_i_draw_start ;
 
                     g.DrawLine(m_this_p_blue, ls_pf1_2, ls_pf2_2);
 
@@ -545,28 +579,28 @@ namespace OTSIncAReportGraph.Controls
                     //先把峰值上的文字去掉,因为这里与底层分析出的结果不太一致,为了不产生疑问所以这里去掉
 
                     //绘制竖线
-                    g.DrawLine(new Pen(Color.Wheat, 0.5f), f_js_width * (m_list_kmlfpoint[i].kml_x * (m_i_draw_end / 20)), m_f_rulerX_location / 3 + i_py, f_js_width * (m_list_kmlfpoint[i].kml_x * (m_i_draw_end / 20)), m_f_rulerX_location - 3);
+                    g.DrawLine(new Pen(Color.Wheat, 0.5f), f_js_width * (m_list_kmlfpoint[i].kml_x * ((m_i_draw_end- m_i_draw_start) / 20)) + m_i_draw_start, m_f_rulerX_location / 3 + i_py, f_js_width * (m_list_kmlfpoint[i].kml_x * ((m_i_draw_end - m_i_draw_start) / 20) + m_i_draw_start), m_f_rulerX_location - 3);
                     //输出文字,并将字输出到线的上面
                     SizeF out_testsizef = g.MeasureString(m_list_kmlfpoint[i].ysm, m_thisfont);
                     PointF ut_test_pointF = new PointF(m_mouse_point.X - (out_testsizef.Width / 2), 2);
-                    g.FillRectangle(Brushes.Goldenrod, new RectangleF(new PointF(f_js_width * (m_list_kmlfpoint[i].kml_x * (m_i_draw_end / 20) - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py), out_testsizef));
+                    g.FillRectangle(Brushes.Goldenrod, new RectangleF(new PointF(f_js_width * ((m_list_kmlfpoint[i].kml_x * ((m_i_draw_end - m_i_draw_start) / 20)) + m_i_draw_start - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py), out_testsizef));
                     g.DrawString(m_list_kmlfpoint[i].ysm,
                         m_thisfont_bold,
                         m_this_sb,
-                        new PointF(f_js_width * (m_list_kmlfpoint[i].kml_x * (m_i_draw_end / 20) - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py));
+                        new PointF(f_js_width * ((m_list_kmlfpoint[i].kml_x * ((m_i_draw_end - m_i_draw_start) / 20)) + m_i_draw_start - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py));
 
                     if (m_list_kmlfpoint[i].lml_x != 0)
                     {
                         //绘制竖线
-                        g.DrawLine(new Pen(Color.Wheat, 0.5f), f_js_width * (m_list_kmlfpoint[i].lml_x * (m_i_draw_end / 20)), m_f_rulerX_location / 3 + i_py, f_js_width * (m_list_kmlfpoint[i].lml_x * (m_i_draw_end / 20)), m_f_rulerX_location - 3);
+                        g.DrawLine(new Pen(Color.Wheat, 0.5f), f_js_width * (m_list_kmlfpoint[i].lml_x * ((m_i_draw_end - m_i_draw_start) / 20)) + m_i_draw_start, m_f_rulerX_location / 3 + i_py, f_js_width * (m_list_kmlfpoint[i].lml_x * ((m_i_draw_end - m_i_draw_start) / 20) + m_i_draw_start), m_f_rulerX_location - 3);
                         //输出文字,并将字输出到线的上面
                         SizeF out_testsizef2 = g.MeasureString(m_list_kmlfpoint[i].ysm, m_thisfont);
                         PointF ut_test_pointF2 = new PointF(m_mouse_point.X - (out_testsizef.Width / 2), 2);
-                        g.FillRectangle(Brushes.Goldenrod, new RectangleF(new PointF(f_js_width * (m_list_kmlfpoint[i].lml_x * (m_i_draw_end / 20) - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py), out_testsizef));
+                        g.FillRectangle(Brushes.Goldenrod, new RectangleF(new PointF(f_js_width * ((m_list_kmlfpoint[i].lml_x * ((m_i_draw_end - m_i_draw_start) / 20))+ m_i_draw_start - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py), out_testsizef));
                         g.DrawString(m_list_kmlfpoint[i].ysm,
                             m_thisfont_bold,
                             m_this_sb,
-                            new PointF(f_js_width * (m_list_kmlfpoint[i].lml_x * (m_i_draw_end / 20) - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py));
+                            new PointF(f_js_width * ((m_list_kmlfpoint[i].lml_x * ((m_i_draw_end - m_i_draw_start) / 20)) + m_i_draw_start - out_testsizef.Width / 2), m_f_rulerX_location / 3 - 20 + i_py));
                     }
                 }
             }
@@ -583,11 +617,11 @@ namespace OTSIncAReportGraph.Controls
                 if (m_analysis_xray[i] > m_f_kmlfzpd_mix)
                 {
                     //用绘线线段,的起始点与鼠标当前位置进行对应上的话,那么就进行取kmlf值,进行显示
-                    if (Convert.ToInt32(m_list_twopoint2[i].pf1.X * f_js_width) == m_mouse_point.X)
+                    if (Convert.ToInt32(m_list_twopoint2[i].pf1.X * f_js_width) == m_mouse_point.X+ m_i_draw_start)
                     {
                         ls_label_str = m_list_twopoint2[i].kmlf_value.ToString();
                     }
-                    if (Convert.ToInt32(m_list_twopoint2[i].pf2.X * f_js_width) == m_mouse_point.X)
+                    if (Convert.ToInt32(m_list_twopoint2[i].pf2.X * f_js_width) == m_mouse_point.X + m_i_draw_start)
                     {
                         ls_label_str = m_list_twopoint2[i].kmlf_value.ToString();
                     }
@@ -697,6 +731,10 @@ namespace OTSIncAReportGraph.Controls
         }
         #endregion
 
+        private void label_close_Click(object sender, EventArgs e)
+        {
+            this.Visible = false;
+        }
     }
 
     #region 用来显示连接线封装的类

+ 51 - 0
OTSIncAReportApp/1-UI/Control_Graph/Controls/Control_XRayTable.designer.cs

@@ -28,19 +28,70 @@
         /// </summary>
         private void InitializeComponent()
         {
+            this.pictureBox1 = new System.Windows.Forms.PictureBox();
+            this.label_close = new System.Windows.Forms.Label();
+            this.pictureBox2 = new System.Windows.Forms.PictureBox();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
             this.SuspendLayout();
             // 
+            // pictureBox1
+            // 
+            this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left)));
+            this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.pictureBox1.Location = new System.Drawing.Point(0, 0);
+            this.pictureBox1.Name = "pictureBox1";
+            this.pictureBox1.Size = new System.Drawing.Size(177, 220);
+            this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+            this.pictureBox1.TabIndex = 0;
+            this.pictureBox1.TabStop = false;
+            // 
+            // label_close
+            // 
+            this.label_close.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.label_close.AutoSize = true;
+            this.label_close.Location = new System.Drawing.Point(990, 0);
+            this.label_close.Name = "label_close";
+            this.label_close.Size = new System.Drawing.Size(11, 12);
+            this.label_close.TabIndex = 1;
+            this.label_close.Text = "X";
+            this.label_close.Visible = false;
+            this.label_close.Click += new System.EventHandler(this.label_close_Click);
+            // 
+            // pictureBox2
+            // 
+            this.pictureBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left)));
+            this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.pictureBox2.Location = new System.Drawing.Point(174, 0);
+            this.pictureBox2.Name = "pictureBox2";
+            this.pictureBox2.Size = new System.Drawing.Size(177, 220);
+            this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+            this.pictureBox2.TabIndex = 2;
+            this.pictureBox2.TabStop = false;
+            // 
             // Control_XRayTable
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
             this.BackColor = System.Drawing.Color.White;
+            this.Controls.Add(this.pictureBox2);
+            this.Controls.Add(this.label_close);
+            this.Controls.Add(this.pictureBox1);
             this.Name = "Control_XRayTable";
             this.Size = new System.Drawing.Size(1004, 220);
             this.Load += new System.EventHandler(this.Control_XRayTable_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
             this.ResumeLayout(false);
+            this.PerformLayout();
 
         }
 
         #endregion
+
+        private System.Windows.Forms.PictureBox pictureBox1;
+        public System.Windows.Forms.Label label_close;
+        private System.Windows.Forms.PictureBox pictureBox2;
     }
 }

+ 10 - 5
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ParticlesGridDevidePage.Designer.cs

@@ -1,4 +1,6 @@
-namespace OTSIncAReportGrids
+using OTSIncAReportGraph.Controls;
+
+namespace OTSIncAReportGrids
 {
     partial class ParticlesGridDevidePage
     {
@@ -162,15 +164,16 @@
             // 
             // tbx_Type
             // 
-            this.tbx_Type.Location = new System.Drawing.Point(723, 10);
+            this.tbx_Type.Enabled = false;
+            this.tbx_Type.Location = new System.Drawing.Point(716, 9);
             this.tbx_Type.Name = "tbx_Type";
-            this.tbx_Type.Size = new System.Drawing.Size(69, 21);
+            this.tbx_Type.Size = new System.Drawing.Size(207, 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(809, 8);
+            this.btn_Sel.Location = new System.Drawing.Point(929, 9);
             this.btn_Sel.Name = "btn_Sel";
             this.btn_Sel.Size = new System.Drawing.Size(54, 23);
             this.btn_Sel.TabIndex = 33;
@@ -185,7 +188,7 @@
             this.label_ParticleName.Name = "label_ParticleName";
             this.label_ParticleName.Size = new System.Drawing.Size(53, 12);
             this.label_ParticleName.TabIndex = 32;
-            this.label_ParticleName.Text = "颗粒名称";
+            this.label_ParticleName.Text = "颗粒类别";
             // 
             // label_Dmax
             // 
@@ -522,6 +525,7 @@
             this.dgV_ParticlesDevidePage.TabIndex = 5;
             this.dgV_ParticlesDevidePage.SortCompare += new System.Windows.Forms.DataGridViewSortCompareEventHandler(this.dgV_ParticlesDevidePage_SortCompare);
             this.dgV_ParticlesDevidePage.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dgV_ParticlesDevidePage_KeyDown);
+            this.dgV_ParticlesDevidePage.KeyUp += new System.Windows.Forms.KeyEventHandler(this.dgV_ParticlesDevidePage_KeyUp);
             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);
             // 
@@ -590,5 +594,6 @@
         private System.Windows.Forms.Label label3;
         private System.Windows.Forms.Button btn_showconfig;
         public System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
+        private Control_XRayTable control_XRayTable1;
     }
 }

+ 145 - 26
OTSIncAReportApp/1-UI/Control_Grids/ParticlesGridDevidePage/ParticlesGridDevidePage.cs

@@ -24,6 +24,9 @@ using NPOI.XSSF.UserModel;
 using NPOI.SS.UserModel.Charts;
 using NPOI.SS.Util;
 using OTSIncAReportApp._1_UI.Control_Grids.ParticlesGridDevidePage;
+using OTSIncAReportGraph.Controls;
+using OTSIncAReportApp.Properties;
+using OTSPeriodicTable;
 
 namespace OTSIncAReportGrids
 {
@@ -194,6 +197,23 @@ namespace OTSIncAReportGrids
             Type dgvType = this.dgV_ParticlesDevidePage.GetType();
             PropertyInfo pi = dgvType.GetProperty("DoubleBuffered", BindingFlags.Instance | BindingFlags.NonPublic);
             pi.SetValue(this.dgV_ParticlesDevidePage, true, null);
+
+            this.control_XRayTable1 = new 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.List_ShowElementInfo = ((System.Collections.Generic.List<OTSIncAReportGraph.Controls.ShowElementInfo>)(Resources.GetObject("control_XRayTable1.List_ShowElementInfo")));
+            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;
+            this.Controls.Add(this.control_XRayTable1);
         }
         bool Init()
         {
@@ -258,6 +278,8 @@ namespace OTSIncAReportGrids
             cbB_PageSize.Items.Add("5000");
             cbB_PageSize.Items.Add("All");
             cbB_PageSize.SelectedIndex = 0;
+
+            dgV_ParticlesDevidePage.Focus();
         }
 
         #region 自定义方法
@@ -1498,31 +1520,6 @@ namespace OTSIncAReportGrids
 
         private void cbB_order_SelectedIndexChanged(object sender, EventArgs e)
         {
-            //int ordernum = cbB_order.SelectedIndex;
-            //if (ordernum == 0)
-            //{
-            //    OrderFunction = "fieldid,particleid";
-            //}
-            //else if (ordernum == 1)
-            //{
-            //    OrderFunction = "TypeName";
-            //}
-            //else if (ordernum == 2)
-            //{
-            //    OrderFunction = "DMAX";
-            //}
-            //else if (ordernum == 3)
-            //{
-            //    OrderFunction = "DMAX desc";
-            //}
-            //else if (ordernum == 4)
-            //{
-            //    OrderFunction = "Area";
-            //}
-            //else if (ordernum == 5)
-            //{
-            //    OrderFunction = "Area desc";
-            //}
 
             lnkFirst_Click(null, null);
             SetDataGridViewStyle();
@@ -2497,7 +2494,6 @@ namespace OTSIncAReportGrids
 
         private void dgV_ParticlesDevidePage_MouseDown(object sender, MouseEventArgs e)
         {
-
             var SelectRows = dgV_ParticlesDevidePage.SelectedRows;
             int sel = m_ReportApp.m_conditionChoose.m_conditionData.GetComboDownListIndexByItemName(OTSIncAReportApp.OTSSampleReportInfo.OTS_REPORT_PROP_GRID_ITEMS.PARTICE_LIST);
             {
@@ -2635,10 +2631,121 @@ namespace OTSIncAReportGrids
 
         private void dgV_ParticlesDevidePage_MouseUp(object sender, MouseEventArgs e)
         {
+            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;
             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;
+
+
+                    //显示xray相关信息
+                    uint[] Search_xray = new uint[2000];
+                    uint[] Analysis_xray = new uint[2000];
+                    int i_xray_id = 0;
+                    List<Element> list_celementchemistryclr = new List<Element>();
+                    //获取Xray数据
+                    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);
+
+                    //get CElementChemistryClr list
+                    List<ShowElementInfo> list_showelementinfo = new List<ShowElementInfo>();
+                    for (int i = 0; i < list_celementchemistryclr.Count; i++)
+                    {
+                        ShowElementInfo ls_sei = new ShowElementInfo();
+                        ls_sei.ElementName = list_celementchemistryclr[i].Name;
+                        ls_sei.Percentage = list_celementchemistryclr[i].Percentage;
+                        ls_sei.dKF = Convert.ToDouble(CListPeriodic.GetPeriodicByEleName(ls_sei.ElementName).K_Peak);
+                        double de_sx2 = 0;
+                        if (CListPeriodic.GetPeriodicByEleName(ls_sei.ElementName).L_Peak == "" || CListPeriodic.GetPeriodicByEleName(ls_sei.ElementName).L_Peak == "-")
+                        {
+                            de_sx2 = 0;
+                        }
+                        else
+                        {
+                            de_sx2 = Convert.ToDouble(CListPeriodic.GetPeriodicByEleName(ls_sei.ElementName).L_Peak);
+                        }
+                        ls_sei.dLF = de_sx2;
+                        list_showelementinfo.Add(ls_sei);
+                    }
+                    string str_IncAName = "";
+                    str_IncAName = Convert.ToString(dgvr.Cells[1].Value);
+                    Particle particle = resultFile.List_OTSField.Find(x => x.FieldID == Convert.ToInt32(dgvr.Cells["fieldid"].Value)).ParticleList.Find(x => x.ParticleId == Convert.ToInt32(dgvr.Cells["particleId"].Value));
+                    control_XRayTable1.SetParticleInfo("Area:" + Math.Round(particle.Area, 2) + " " + "DELONG:" + Math.Round(particle.DELONG, 2) + " " + "DFERET:" + Math.Round(particle.DFERET, 2) + " " + "DINSCR:" + Math.Round(particle.DINSCR, 2) + " " + "DMAX:" + Math.Round(particle.DMAX, 2) + "\n" + "DMEAN:" + Math.Round(particle.DMEAN, 2) + " " + "DMIN:" + Math.Round(particle.DMIN, 2) + " " + "DPERP:" + Math.Round(particle.DPERP, 2) + " " + "ORIENTATION:" + Math.Round(particle.ORIENTATION, 2) + " " + "PERIMETER:" + Math.Round(particle.PERIMETER, 2));
+
+                    //获取数据后,需要对xraytable设置
+                    control_XRayTable1.Visible = true;
+                    control_XRayTable1.SetXRayShowLineValue(null, Analysis_xray, list_showelementinfo);
+                    //颗粒国标信息
+                    control_XRayTable1.GBInfoStr = "";
+                    control_XRayTable1.MaterialName = str_IncAName;//杂夹物
+
+                    control_XRayTable1.List_ShowElementInfo = list_showelementinfo;
+
+
+                    string filePath = result.FilePath + "\\FIELD_FILES\\";
+                    string imagePath = filePath + "Field" + dgvr.Cells["fieldid"].Value.ToString() + ".bmp";
+                    Bitmap originalFieldImage=Particledata.ReadImageFile(imagePath);
+                    string str = " particleId= " + dgvr.Cells["particleId"].Value.ToString() + " and fieldid = " + dgvr.Cells["fieldid"].Value.ToString();
+                    DataRow[] drs = particles.Select(str);
+                    if (drs.Length > 0)
+                    {
+                        Rectangle rectangle = new Rectangle() { X = Convert.ToInt32(drs[0]["RectLeft"]), Y = Convert.ToInt32(drs[0]["RectTop"]), Width = Convert.ToInt32(drs[0]["RectWidth"]), Height = Convert.ToInt32(drs[0]["RectHeight"]) };
+                        Bitmap dpImage = new Bitmap(originalFieldImage.Width, originalFieldImage.Height);
+                        foreach (Segment seg in particle.SegmentList)
+                        {
+                            int f_length = seg.Length;
+                            for (int m = 0; m < f_length; m++)
+                            {
+                                int lsjs_x = seg.Start + m;
+                                int lsjs_y = seg.Height;
+                                var pixelColor = originalFieldImage.GetPixel(lsjs_x, lsjs_y);
+                                dpImage.SetPixel(lsjs_x, lsjs_y, pixelColor);
+                            }
+                        }
+
+
+                        Bitmap bmap = Particledata.GetBitmapByParticle(dpImage, rectangle);
+                        Bitmap binarizedBmp = new Bitmap(bmap.Width, bmap.Height);
+                        for (int x = 0; x < bmap.Width; x++)
+                        {
+                            for (int y = 0; y < bmap.Height; y++)
+                            {
+                                Color color = bmap.GetPixel(x, y);
+                                if (color.A == 255&&color.B==0 && color.G == 0 && color.R == 0)
+                                {
+                                    binarizedBmp.SetPixel(x, y, Color.White);
+                                }
+                                else
+                                {
+                                    int grayValue = (color.R + color.G + color.B) / 3;
+                                    if(grayValue>0)
+                                    {
+                                        binarizedBmp.SetPixel(x, y, Color.Black);
+                                    }
+                                    else
+                                    {
+                                        binarizedBmp.SetPixel(x, y, Color.White);
+                                    }
+                                }
+                            }
+                        }
+                        control_XRayTable1.SetBitmapOfPictureBox(ls_bp, binarizedBmp);
+                        Invalidate();
+                    }
+                    else
+                    {
+                        control_XRayTable1.Visible = false;
+                    }
+                }
                 SaveParticleslist_select();
+
             }
         }
 
@@ -2649,6 +2756,18 @@ namespace OTSIncAReportGrids
                 ToolStripMenuItem_Delete_Particle_Click(null, null);
             }
         }
+
+        private void dgV_ParticlesDevidePage_KeyUp(object sender, KeyEventArgs e)
+        {
+            if (e.KeyData == Keys.Down)
+            {
+                dgV_ParticlesDevidePage_MouseUp(null, null);
+            }
+            if (e.KeyData == Keys.Up)
+            {
+                dgV_ParticlesDevidePage_MouseUp(null, null);
+            }
+        }
     }
 }