Pārlūkot izejas kodu

add missing files while get out of Huawei.

gsp 4 gadi atpakaļ
vecāks
revīzija
68cbb8cf27

+ 160 - 0
HOZProject/OTSMeasureOutputNlog.Designer.cs

@@ -0,0 +1,160 @@
+namespace HOZProject
+{
+    partial class OTSMeasureOutputNlog
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.richTextBox_Nlog = new System.Windows.Forms.RichTextBox();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.button1 = new System.Windows.Forms.Button();
+            this.button_Clear = new System.Windows.Forms.Button();
+            this.button_stop = new System.Windows.Forms.Button();
+            this.combox_NlogType = new System.Windows.Forms.ComboBox();
+            this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+            this.groupBox1.SuspendLayout();
+            this.tableLayoutPanel1.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // richTextBox_Nlog
+            // 
+            this.richTextBox_Nlog.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.richTextBox_Nlog.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.richTextBox_Nlog.Location = new System.Drawing.Point(4, 62);
+            this.richTextBox_Nlog.Margin = new System.Windows.Forms.Padding(4);
+            this.richTextBox_Nlog.Name = "richTextBox_Nlog";
+            this.richTextBox_Nlog.ReadOnly = true;
+            this.richTextBox_Nlog.Size = new System.Drawing.Size(504, 909);
+            this.richTextBox_Nlog.TabIndex = 0;
+            this.richTextBox_Nlog.Text = "";
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.button1);
+            this.groupBox1.Controls.Add(this.button_Clear);
+            this.groupBox1.Controls.Add(this.button_stop);
+            this.groupBox1.Controls.Add(this.combox_NlogType);
+            this.groupBox1.Location = new System.Drawing.Point(4, 4);
+            this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
+            this.groupBox1.Size = new System.Drawing.Size(504, 45);
+            this.groupBox1.TabIndex = 7;
+            this.groupBox1.TabStop = false;
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(0, 12);
+            this.button1.Margin = new System.Windows.Forms.Padding(4);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(100, 29);
+            this.button1.TabIndex = 3;
+            this.button1.Text = "Test";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Visible = false;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // button_Clear
+            // 
+            this.button_Clear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.button_Clear.Location = new System.Drawing.Point(412, 12);
+            this.button_Clear.Margin = new System.Windows.Forms.Padding(4);
+            this.button_Clear.Name = "button_Clear";
+            this.button_Clear.Size = new System.Drawing.Size(84, 29);
+            this.button_Clear.TabIndex = 4;
+            this.button_Clear.Text = "close";
+            this.button_Clear.UseVisualStyleBackColor = true;
+            this.button_Clear.Click += new System.EventHandler(this.button_Clear_Click);
+            // 
+            // button_stop
+            // 
+            this.button_stop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.button_stop.Location = new System.Drawing.Point(292, 12);
+            this.button_stop.Margin = new System.Windows.Forms.Padding(4);
+            this.button_stop.Name = "button_stop";
+            this.button_stop.Size = new System.Drawing.Size(84, 29);
+            this.button_stop.TabIndex = 6;
+            this.button_stop.Text = "Stop";
+            this.button_stop.UseVisualStyleBackColor = true;
+            this.button_stop.Click += new System.EventHandler(this.button_stop_Click);
+            // 
+            // combox_NlogType
+            // 
+            this.combox_NlogType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.combox_NlogType.FormattingEnabled = true;
+            this.combox_NlogType.Location = new System.Drawing.Point(133, 15);
+            this.combox_NlogType.Margin = new System.Windows.Forms.Padding(4);
+            this.combox_NlogType.Name = "combox_NlogType";
+            this.combox_NlogType.Size = new System.Drawing.Size(104, 20);
+            this.combox_NlogType.TabIndex = 2;
+            this.combox_NlogType.SelectedIndexChanged += new System.EventHandler(this.combox_NlogType_SelectedIndexChanged);
+            // 
+            // tableLayoutPanel1
+            // 
+            this.tableLayoutPanel1.ColumnCount = 1;
+            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+            this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0);
+            this.tableLayoutPanel1.Controls.Add(this.richTextBox_Nlog, 0, 1);
+            this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
+            this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+            this.tableLayoutPanel1.RowCount = 2;
+            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5.948718F));
+            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 94.05128F));
+            this.tableLayoutPanel1.Size = new System.Drawing.Size(512, 975);
+            this.tableLayoutPanel1.TabIndex = 8;
+            // 
+            // OTSMeasureOutputNlog
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.AutoScroll = true;
+            this.AutoSize = true;
+            this.ClientSize = new System.Drawing.Size(512, 975);
+            this.Controls.Add(this.tableLayoutPanel1);
+            this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Margin = new System.Windows.Forms.Padding(4);
+            this.Name = "OTSMeasureOutputNlog";
+            this.ShowIcon = false;
+            this.ShowInTaskbar = false;
+            this.Load += new System.EventHandler(this.OTSMeasureOutputNlog_Load);
+            this.groupBox1.ResumeLayout(false);
+            this.tableLayoutPanel1.ResumeLayout(false);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.RichTextBox richTextBox_Nlog;
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.Button button_Clear;
+        private System.Windows.Forms.Button button_stop;
+        private System.Windows.Forms.ComboBox combox_NlogType;
+        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+    }
+}

+ 104 - 0
HOZProject/OTSMeasureOutputNlog.cs

@@ -0,0 +1,104 @@
+using NLog;
+using NLog.Config;
+using NLog.Targets;
+//using OTS.WinFormsUI.Docking;
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+
+namespace HOZProject
+{
+    public partial class OTSMeasureOutputNlog: Form
+    {
+        //OTSSysMgrTools.Language lan;
+        //Hashtable table;
+        protected static NLog.Logger log;
+        public OTSMeasureOutputNlog()
+        {
+            InitializeComponent();
+        }
+
+        private void OTSMeasureOutputNlog_Load(object sender, EventArgs e)
+        {
+            combox_NlogType.Items.Add("Trace");
+            combox_NlogType.Items.Add("Debug");
+            combox_NlogType.Items.Add("Info");
+            combox_NlogType.Items.Add("Warn");
+            combox_NlogType.Items.Add("Error");
+            combox_NlogType.Items.Add("Fatal");
+            combox_NlogType.SelectedIndex = 0;
+            log = NLog.LogManager.GetCurrentClassLogger();
+
+            //国际
+            //lan = new OTSSysMgrTools.Language(this);
+            //table = lan.GetNameTable(this.Name);
+            //label1.Text = table["label1"].ToString();
+            //button_Clear.Text = table["button_clear"].ToString();
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            log.Trace("Trace");
+            log.Debug("Debug");
+            log.Info("Info");
+            log.Warn("Warn");
+            log.Error("Error");
+            log.Fatal("Fatal THIS IS A LOG WHICH USED TO TEST THE LOG LENTH FIT TO THE FORM!");
+        }
+
+        private void button_Clear_Click(object sender, EventArgs e)
+        {
+            richTextBox_Nlog.Clear();
+        }
+
+        private void combox_NlogType_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            if (null == combox_NlogType.SelectedItem) return;
+            String str = combox_NlogType.SelectedItem.ToString();    // 获取日志级别.
+            LogLevel lv = LogLevel.Info;    // 若选择的值无效, 则当作 Info级.
+            lv = LogLevel.FromString(str);
+            LoggingRule lr = LogManager.Configuration.LoggingRules.FirstOrDefault(
+                                r => r.Targets.Any(
+                                    t => "control" == t.Name
+                                )
+                            );
+            if (lr != null)
+            {
+                lr.SetLoggingLevels(lv, LogLevel.Fatal);
+                LogManager.ReconfigExistingLoggers();    // 使配置生效.
+            }
+        }
+
+        private void button_stop_Click(object sender, EventArgs e)
+        {
+            if (button_stop.Text == "Stop")
+            {
+                LoggingRule lr = LogManager.Configuration.LoggingRules.FirstOrDefault(
+                                r => r.Targets.Any(
+                                    t => "control" == t.Name
+                                )
+                            ); 
+                LogManager.Configuration.LoggingRules.Remove(lr);
+                LogManager.ReconfigExistingLoggers(); 
+                button_stop.Text = "Start";
+            }
+            else
+            {
+                if (null == combox_NlogType.SelectedItem) return;
+                String str = combox_NlogType.SelectedItem.ToString();
+                LogManager.Configuration.AddRule(LogLevel.FromString(str), LogLevel.Fatal, "control");
+                LogManager.ReconfigExistingLoggers();    // 使配置生效.
+                button_stop.Text = "Stop";
+            }
+        }
+
+      
+    }
+}

+ 120 - 0
HOZProject/OTSMeasureOutputNlog.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 254 - 0
MeasureThread/Helpers/NewFunMethod.cs

@@ -0,0 +1,254 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Drawing;
+namespace HOZProject.Helpers
+{
+    public class NewFunMethod
+    {
+        //Xray谱图生成图片
+        /// <summary>
+        /// Xray谱图生成图片
+        /// </summary>
+        /// <param name="analysis_xray">Xray数据</param>
+        /// <param name="list_showelementinfo">元素列表</param>
+        /// <param name="saveImgPathName">保存路径名称</param>
+        /// <returns>Image</returns>
+        public void GetXrayToImage(uint[] analysis_xray, List<ShowElementInfo> list_showelementinfo, string saveImgPathName)
+        {
+            try
+            {
+                Control_XRayTable control_XRayTable1 = new Control_XRayTable();
+                //获取数据后,需要对xraytable设置
+                control_XRayTable1.SetXRayShowLineValue(analysis_xray, list_showelementinfo);
+                //设置图像
+                Bitmap bitmap = new Bitmap(control_XRayTable1.Width, control_XRayTable1.Height);
+                Rectangle rectImg = new Rectangle();
+                rectImg.Location = control_XRayTable1.Location;
+                rectImg.Width = control_XRayTable1.Width;
+                rectImg.Height = control_XRayTable1.Height;
+                control_XRayTable1.DrawToBitmap(bitmap, rectImg);
+                //如要保存请添加保存路径名称参数
+                bitmap.Save(saveImgPathName, System.Drawing.Imaging.ImageFormat.Png);
+                bitmap.Dispose();
+            }
+            catch (Exception ex)
+            {
+                //记录日志
+            }
+        }
+
+        /// <summary>
+        /// BSE标注颗粒位置
+        /// </summary>
+        /// <param name="bseImgPath">BSE图像所在位置路径参数</param>
+        /// <param name="points">分析点位置列表</param>
+        /// <param name="drawType">绘制类型 0:点 1:线 2:面</param>
+        /// <param name="saveImgPathName">添加分析点位置标注后,图像保存路径</param>
+        /// <returns></returns>
+        public void GetBseAnalyticalSite(string bseImgPath, List<DrawAnalysePoint> darwAPList, string saveImgPathName)
+        {
+            try
+            {
+                //1.BSE图像所在位置路径参数
+                System.Drawing.Image img = System.Drawing.Image.FromFile(bseImgPath);
+                Bitmap bitmap = new Bitmap(img.Width,img.Height);
+                string filePath = bseImgPath;
+                //全路径  C:\aaa\bbb\ccc.xml
+                string fileFullPath = System.IO.Path.GetFullPath(filePath);
+                //所在文件夹路径  C:\aaa\bbb
+                string fileDirectoryName = System.IO.Path.GetDirectoryName(filePath);
+                //文件名称.后缀名  ccc.xml
+                string fileName = System.IO.Path.GetFileName(filePath);
+                //后缀名 .xml
+                string ExtensionName = System.IO.Path.GetExtension(filePath);
+                //2.生成图像绘制对象
+                Graphics g = Graphics.FromImage(bitmap);
+                //绘制BSE原图
+                g.DrawImage(img, 0, 0);
+                //编辑绘制图形的线条颜色
+                Pen drawPan = new Pen(Color.Red);
+                //点标注 + 号 宽高长度
+                int WH = 20;
+                //字体大小 
+                float fontSize = 15;
+                Font font = new Font("黑体", fontSize, FontStyle.Bold);
+                SolidBrush solidBrush = new SolidBrush(Color.Red);
+                //绘制标签 Y轴向上偏移位置
+                int drawTitleOffUPLocation = 20;
+                //3.绘制类型 0:点 1:线 2:面
+                for (int i = 0; i < darwAPList.Count; i++)
+                {
+                    DrawType drawType = darwAPList[i].DrawType;
+                    string title = darwAPList[i].Title;
+                    switch (drawType)
+                    {
+                        case DrawType.Point:
+                            int startPointX = darwAPList[i].Point.X - WH;
+                            int endPointX = darwAPList[i].Point.X + WH;
+                            int startPointY = darwAPList[i].Point.Y - WH;
+                            int endPointY = darwAPList[i].Point.Y + WH;
+                            //绘制点十字
+                            g.DrawLine(drawPan, startPointX, darwAPList[i].Point.Y, endPointX, darwAPList[i].Point.Y);
+                            g.DrawLine(drawPan, darwAPList[i].Point.X, startPointY, darwAPList[i].Point.X, endPointY);
+                            //绘制标签
+                            g.DrawString(title, font, solidBrush, darwAPList[i].Point.X, darwAPList[i].Point.Y- drawTitleOffUPLocation);
+                            break;
+                        case DrawType.Line:
+                            List<Point> points = darwAPList[i].LinePoints;
+                            System.Drawing.Drawing2D.GraphicsPath graphicsPath = new System.Drawing.Drawing2D.GraphicsPath();
+                            //将多点生成绘制路径
+                            graphicsPath.AddLines(points.ToArray());
+                            g.DrawPath(drawPan, graphicsPath);
+                            //绘制标签
+                            g.DrawString(title, font, solidBrush, darwAPList[i].LinePoints[0].X, darwAPList[i].LinePoints[0].Y - drawTitleOffUPLocation);
+                            break;
+                        case DrawType.Rectangle:
+                            Rectangle rect = new Rectangle();
+                            rect.Location = new Point(darwAPList[i].Point.X, darwAPList[i].Point.Y);
+                            rect.Size = darwAPList[i].RectSize;
+                            g.DrawRectangle(drawPan, rect);
+                            //绘制标签
+                            g.DrawString(title, font, solidBrush, darwAPList[i].Point.X, darwAPList[i].Point.Y - drawTitleOffUPLocation);
+                            break;
+                        default:
+                            break;
+                    }
+                }
+                //4.添加分析点位置标注后,图像保存路径
+                bitmap.Save(saveImgPathName, System.Drawing.Imaging.ImageFormat.Png);
+                g.Dispose();
+                bitmap.Dispose();
+            }
+            catch (Exception ex)
+            {
+                //记录日志
+            }
+        }
+    }
+    public enum DrawType
+    {
+        Point = 0,
+        Line = 1,
+        Rectangle=2
+    }
+    //元素包含信息结构
+    public class Periodic
+    {
+        string _xh;         //序号
+        string _yzzl;    //原子重量,因为有标记的重量带有()括号,所以这里先用字符串进行存储
+        string _fh;      //符号
+        string _zwysm;   //中文元素名
+        string _ywm;     //英文名 
+        string _sx1;     //属性1
+        string _sx2;     //属性2
+        string _sx3;     //属性3
+        string _fl;      //分类
+
+        /// <summary>
+        /// 序号
+        /// </summary>
+        public string XH
+        {
+            get { return _xh; }
+            set { _xh = value; }
+        }
+        /// <summary>
+        /// 原子重量
+        /// </summary>
+        public string YZZL
+        {
+            get { return _yzzl; }
+            set { _yzzl = value; }
+        }
+        /// <summary>
+        /// 符号
+        /// </summary>
+        public string FH
+        {
+            get { return _fh; }
+            set { _fh = value; }
+        }
+        /// <summary>
+        /// 中文元素名
+        /// </summary>
+        public string ZWYSM
+        {
+            get { return _zwysm; }
+            set { _zwysm = value; }
+        }
+        /// <summary>
+        /// 英文名
+        /// </summary>
+        public string YWM
+        {
+            get { return _ywm; }
+            set { _ywm = value; }
+        }
+        /// <summary>
+        /// 属性1
+        /// </summary>
+        public string SX1
+        {
+            get { return _sx1; }
+            set { _sx1 = value; }
+        }
+        /// <summary>
+        /// 属性2
+        /// </summary>
+        public string SX2
+        {
+            get { return _sx2; }
+            set { _sx2 = value; }
+        }
+        /// <summary>
+        /// 属性3
+        /// </summary>
+        public string SX3
+        {
+            get { return _sx3; }
+            set { _sx3 = value; }
+        }
+        /// <summary>
+        /// 分类
+        /// </summary>
+        public string FL
+        {
+            get { return _fl; }
+            set { _fl = value; }
+        }
+    }
+
+    public class DrawAnalysePoint
+    {
+        /// <summary>
+        /// 标签名称
+        /// </summary>
+        private string title;
+        /// <summary>
+        /// 分析点位置
+        /// </summary>
+        private Point point;
+        /// <summary>
+        /// 绘制类型 面尺寸
+        /// </summary>
+        private Size rectSize;
+        /// <summary>
+        /// 绘制类型:线 点位置
+        /// </summary>
+        private List<Point> linePoints;
+        /// <summary>
+        /// 绘制类型 Point:点 Line:线 Rectangle:面
+        /// </summary>
+        private DrawType drawType;
+
+        public string Title { get => title; set => title = value; }
+        public Point Point { get => point; set => point = value; }
+        public Size RectSize { get => rectSize; set => rectSize = value; }
+        public List<Point> LinePoints { get => linePoints; set => linePoints = value; }
+        public DrawType DrawType { get => drawType; set => drawType = value; }
+    }
+}

+ 1 - 1
MeasureThread/Measure.cs

@@ -513,7 +513,7 @@ namespace MeasureThread
 
             if (m_measureFile.MParam.EDS == true)
             {
-                log.Info("能谱分析", true);
+                log.Info("进行能谱分析", true);
                 Init_MeasDB();
             }
 

+ 758 - 0
MeasureThread/UserControls/Control_XRayTable.cs

@@ -0,0 +1,758 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+//using OTSIncAReportGraph.Class;
+using System.Collections;
+using HOZProject.Helpers;
+
+namespace HOZProject
+{
+    /// <summary>
+    /// 能谱图类
+    /// </summary>
+    public partial class Control_XRayTable : UserControl
+    {
+        #region 变量定义
+        //定义两个能量值线,用来显示使用
+        float[] m_f_show1 = new float[2000];
+        float[] m_f_show2 = new float[2000];
+
+        //用来保存实际传入的xray值数,用该数据转换成显示的值
+        uint[] m_search_xray = new uint[2000];
+        uint[] m_analysis_xray = new uint[2000];
+
+        List<TwoPoint> m_list_twopoint1 = new List<TwoPoint>();
+        List<TwoPoint> m_list_twopoint2 = new List<TwoPoint>();
+
+        //记录鼠标所在位置
+        Point m_mouse_point = new Point();
+
+        //字体
+        Font m_thisfont = new Font("微软雅黑", 8, FontStyle.Regular);
+        Font m_thisfont_bold = new Font("微软雅黑", 8, FontStyle.Bold);
+
+        //下标尺分界位置
+        float m_f_rulerX_location = 170;
+
+        //下坐标尺设定参数
+        float m_i_smalkd = 5;//5像素一个小刻度
+        float m_i_bigkd = 25;//25像素一个大刻度
+        float m_i_smallkd_number = 200;//小刻度的个数
+        float m_i_bigkd_number = 40;//大刻度的个数
+
+        float m_i_draw_start = 0;//整个界面绘制的起始点
+        float m_i_draw_end = 1004;//整个界面绘制的边界
+
+        //float m_Y_draw_start = 0;//Y轴的起始点
+        //float m_Y_draw_Lenght = 10;//Y轴的刻度长度
+        float m_Y_draw_TopDiff = 15;//Y轴距离顶部距离
+        float m_Y_MaxValue = 0;//Y轴显示的最大刻度长度
+
+        float m_i_rightdrawlabellocation_x = 850;//右上角要显示文字的位置
+        float m_i_rightdrawlabellocation_y = 5;//右上角要显示文字的位置
+
+        SolidBrush m_this_sb = new SolidBrush(Color.Black);//画刷
+        SolidBrush m_this_sb_blue = new SolidBrush(Color.Blue);//
+        Pen m_this_p = new Pen(Color.Black, 0.5f);           //画笔的颜色
+        Pen m_this_p_blue = new Pen(Color.DimGray, 0.5f);       //画笔的颜色 , 分析xray的颜色
+        Pen m_mousemove_p = new Pen(Color.PowderBlue, 0.1f);//鼠标移动画的竖线的画笔颜色
+
+        float m_kml_fz_top = 0;       //计算KML峰值记录最高点变量
+
+        float m_xraytopixel_multiple = 40; //比如,从xray0-6000的值,转到显示像素中0-150的比例倍数
+
+        float m_xraysum2 = 0;             //xray计数总和2
+        List<Periodic> m_list_periodic;   //元素周期表,相关数据,窗体加载时初始化,然后用来计算使用
+        List<KMLFPoint> m_list_kmlfpoint;   //KML峰值,对应的位置和元素名
+
+        //属性相关变量,用来显示使用
+        private bool m_b_show_searchxray = false;          //是否绘制搜索xray线,不再显示搜索xray,只显示分析xray
+        private bool m_b_show_analysisxray = true;        //设置是否绘制分析xray线
+        private string m_goodname = "";                   //夹杂物名称
+        private string m_goodchinesename = "";            //夹杂物的中文名称
+        private string m_stdname = "";                    //标准名称
+        private static List<ShowElementInfo> m_list_showelementinfo = null;//需要显示的元素信息列表
+        private string m_GBinfostr = "";                    //国标信息显示
+
+        float m_f_zl = 0.5f;      //2000个数据放到1000个像素中计算出的增量
+
+        float m_f_kmlfzpd_max = 30;//KML峰值上界限,进行记数的值,峰值判断的界限,需要按峰值最高值,和
+        float m_f_kmlfzpd_mix = 5;//KML峰值下界限
+        #endregion
+
+        #region 属性相关
+
+        /// <summary>
+        /// 显示国标分类相关信息
+        /// </summary>
+        public string GBInfoStr
+        {
+            get { return m_GBinfostr; }
+            set { m_GBinfostr = value; }
+        }
+
+        /// <summary>
+        /// 设置是否绘制搜索Xray,默认为显示
+        /// </summary>
+        public bool ShowSearchXray
+        {
+            get { return m_b_show_searchxray; }
+            set { m_b_show_searchxray = value; }
+        }
+
+        /// <summary>
+        /// 显示当前夹杂物的名称
+        /// </summary>
+        public string GoodName
+        {
+            get { return m_goodname; }
+            set { m_goodname = value; }
+        }
+
+        /// <summary>
+        /// 显示当前夹杂物的中文名称
+        /// </summary>
+        public string GoodChineseName
+        {
+            get { return m_goodchinesename; }
+            set { m_goodchinesename = value; }
+        }
+
+        /// <summary>
+        /// 显示当前能谱物品的测试标准名
+        /// </summary>
+        public string STDName
+        {
+            get { return m_stdname; }
+            set { m_stdname = value; }
+        }
+
+        /// <summary>
+        /// 显示元素列表相关信息
+        /// </summary>
+        public List<ShowElementInfo> List_ShowElementInfo
+        {
+            get { return m_list_showelementinfo; }
+            set { m_list_showelementinfo = value; }
+        }
+
+        /// <summary>
+        /// 设置是否绘制分析Xray,默认为显示
+        /// </summary>
+        public bool ShowAnalysisXray
+        {
+            get { return m_b_show_analysisxray; }
+            set { m_b_show_analysisxray = value; }
+        }
+        #endregion
+
+        #region 构造函数
+        public Control_XRayTable()
+        {
+            InitializeComponent();
+            
+
+        }
+
+        /// <summary>
+        /// 需要确定下来倍数后,从xray最大值6000,转换成显示最大值150的比例转换
+        /// </summary>
+        /// <param name="in_value"></param>
+        /// <returns></returns>
+        private float GetValueByRatio(uint in_value)
+        {
+            return in_value / m_xraytopixel_multiple;
+        }
+
+        /// <summary>
+        /// 设置搜索xray和分析xray值到,记录变量中,及转换成显示变量中,用来供XrayTable显示及计算使用
+        /// </summary>
+        /// <param name="analysis_xray">Xray数据</param>
+        /// <param name="in_list_showelementinfo">元素信息列表</param>
+        public void SetXRayShowLineValue(uint[] analysis_xray,List<ShowElementInfo> in_list_showelementinfo)
+        {
+            //重新加载时,对当前的宽度等重新加载并计算
+            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;   //按宽度重新计算大刻度的长度
+
+
+            #region 重新初始化相关全局变量
+            //m_list_periodic = CListPeriodic.GetListPeriodic();
+            m_list_kmlfpoint = new List<KMLFPoint>();
+
+            m_f_show1 = new float[2000];
+            m_f_show2 = new float[2000];
+
+            //用来保存实际传入的xray值数,用该数据转换成显示的值
+            m_search_xray = new uint[2000];
+            m_analysis_xray = new uint[2000];
+
+            m_list_twopoint1 = new List<TwoPoint>();
+            m_list_twopoint2 = new List<TwoPoint>();
+
+            m_list_showelementinfo = in_list_showelementinfo;
+            //初始化xray之和为0,之后开始进行求和计算
+            m_xraysum2 = 0;
+            //重新初始化高度比例尺
+            m_xraytopixel_multiple = 0;
+            //标准库名
+            m_stdname = "无";
+            #endregion
+
+            //校验数据错误,防止空数据
+            if (analysis_xray.Count() == 0)
+            {
+                return;
+            }
+            //再防止全数据为0
+            uint ls_u_jcwl = 0;
+            for (int i = 0; i < analysis_xray.Count(); i++)
+            {
+                if (analysis_xray[i] > ls_u_jcwl)
+                    ls_u_jcwl = analysis_xray[i];
+            }
+            if (ls_u_jcwl == 0)
+            {
+                return;
+            }
+
+            //比例尺,要根据传入的数据,自动进行计算的
+            //逻辑那就应该是取最大的xray得到的值,加一点,然后除以我可以显示的像素分辨率,得到的倍数,后面都用这个倍数进行计算
+
+            //取出最大的xray值,计算倍数---------------------------------------------------
+            uint max_xra = 0;
+            for (int i = 0; i < analysis_xray.Length; i++)
+            {
+                if (max_xra < analysis_xray[i])
+                {
+                    max_xra = analysis_xray[i];
+                }
+            }
+            //用最大的值除以可用来显示的像素,得到倍数
+            m_xraytopixel_multiple = (float)(Convert.ToDouble(max_xra) / Convert.ToDouble(150));
+
+
+            //如果长度不是2000的话,不操作
+            if (analysis_xray.Length == 2000)
+            {
+                //保存实际传入的值
+                m_analysis_xray = analysis_xray;
+                for (int i = 0; i < analysis_xray.Length; i++)
+                {
+                    //这里按比例进行转换
+                    m_f_show2[i] = GetValueByRatio( analysis_xray[i]);
+                    m_xraysum2 = m_xraysum2 + analysis_xray[i];
+                }
+            }
+
+            //生成xray对应的绘制线段
+            float old_value = m_f_rulerX_location - 2;//从基础线-2的位置上进行绘制
+                                                    //float f_zl = 0.5f;//坐标值的增量,以小数做为增量的值,,,,这个坐标的增量应该根据实际的显示长度进行修改
+                                                    //当1000个像素时显示2000个数据,需要2000/1000=0.5f
+                                                    //0.5f就是2000个数据需要放到1000个像素中的计算系数
+                                                    
+            double ls_width = m_i_draw_end;//改成固定值,整个绘制浪线的总长
+            double ls_cs = 2000;
+            m_f_zl = (float)(ls_width / ls_cs);
+
+            //计算KML峰值判定的上标值与下标值
+            GetKMLFPD_MAXANDMIN(m_analysis_xray);
+
+            old_value = m_f_rulerX_location - 2;
+            for (int i = 0; i < m_f_show2.Length; i++)
+            {
+                TwoPoint tp = new TwoPoint();
+                tp.pf1.X = i * m_f_zl;
+                tp.pf1.Y = old_value;
+
+                tp.pf2.X = i * m_f_zl + m_f_zl;
+                tp.pf2.Y = m_f_rulerX_location - 2 - m_f_show2[i];
+                tp.value = m_analysis_xray[i];
+                tp.kmlf_value = (float)(Convert.ToDouble(i) / Convert.ToDouble(100));
+
+                //重新实现计算峰值上显示元素的计算方法
+                //CalcKMLFPoint(tp);
+
+                old_value = m_f_rulerX_location - 2 - m_f_show2[i];
+
+                m_list_twopoint2.Add(tp);
+            }
+
+            //重新实现的计算峰值上显示元素的计算方法
+            CalcKMLFPoint(in_list_showelementinfo);
+
+
+            this.Invalidate();
+        }
+
+        /// <summary>
+        /// 根据传入的2000个峰值点,计算出有效参与计算的峰值判定高点,和低点,两个点
+        /// </summary>
+        /// <param name="in_xray"></param>
+        /// <returns></returns>
+        private void GetKMLFPD_MAXANDMIN(uint[] in_xray)
+        {
+            float f_lsmax = 0;
+            //方法是,按50%为高点,10%为低点
+            for (int i = 0; i < in_xray.Count(); i++)
+            {
+                if (f_lsmax < in_xray[i])
+                {
+                    f_lsmax = in_xray[i];
+                }
+            }
+
+            m_f_kmlfzpd_max = (float)(f_lsmax * 0.3);//最顶点的峰
+            m_f_kmlfzpd_mix = (float)(f_lsmax * 0.1);
+            return ;
+        }
+
+        /// <summary>
+        /// 根据传入的值,及获取的范围,来判断,该值大概为是什么元素的
+        /// </summary>
+        /// <param name="kml_value">传入的峰值</param>
+        /// <param name="f_rect">范围</param>
+        /// <returns></returns>
+        private string GetElementNameByKMLRange(float kml_value, float f_rect)
+        {
+            string str_ret = "";
+            float ls_f_sx1 = 0;
+            float ls_f_sx2 = 0;
+            float ls_f_sx3 = 0;
+            for (int i = 0; i < m_list_periodic.Count(); i++)
+            {
+                //先对三个值进行转换,转出应有的值
+                if (m_list_periodic[i].SX1 != "" && m_list_periodic[i].SX1 != "-")
+                {
+                    ls_f_sx1 = (float)Convert.ToDouble(m_list_periodic[i].SX1);
+                }
+                if (m_list_periodic[i].SX2 != "" && m_list_periodic[i].SX2 != "-")
+                {
+                    ls_f_sx2 = (float)Convert.ToDouble(m_list_periodic[i].SX2);
+                }
+                if (m_list_periodic[i].SX3 != "" && m_list_periodic[i].SX3 != "-")
+                {
+                    ls_f_sx3 = (float)Convert.ToDouble(m_list_periodic[i].SX3);
+                }
+
+                //然后再对该值进行判断,如果在范围内,则判断为该元素
+                if (kml_value >= (ls_f_sx1 - f_rect) && kml_value < (ls_f_sx1 + f_rect))
+                {
+                    str_ret = m_list_periodic[i].FH;
+                    break;
+                }
+                if (kml_value >= (ls_f_sx2 - f_rect) && kml_value < (ls_f_sx2 + f_rect))
+                {
+                    str_ret = m_list_periodic[i].FH;
+                    break;
+                }
+                if (kml_value >= (ls_f_sx3 - f_rect) && kml_value < (ls_f_sx3 + f_rect))
+                {
+                    str_ret = m_list_periodic[i].FH;
+                    break;
+                }
+            }
+
+            return str_ret;
+        }
+
+
+        /// <summary>
+        /// 在循环遍历中,计算KML峰值中心点
+        /// </summary>
+        /// <param name="tp"></param>
+        private void CalcKMLFPoint(TwoPoint tp)
+        {
+            //大于平均点值 max时,开始记录,2018-10-23重新实现
+            if (tp.value > m_f_kmlfzpd_max)
+            {
+                m_kml_fz_top = tp.kmlf_value;
+            }
+            else if( tp.value < m_f_kmlfzpd_mix && m_kml_fz_top != 0)//平均小于平均峰值 min时,结束记录,并将峰值保存,记录峰值元素
+            {
+                //构造KML峰值list对象
+                KMLFPoint ls_lkmfpoint = new KMLFPoint();
+                ls_lkmfpoint.kml_x = m_kml_fz_top;
+
+                //查找出该峰值是什么元素的, 待完成
+                ls_lkmfpoint.ysm = GetElementNameByKMLRange(m_kml_fz_top, 0.2f);
+
+                //将该峰值保存到峰值上
+                m_list_kmlfpoint.Add(ls_lkmfpoint);
+                m_Y_MaxValue = m_kml_fz_top;
+                m_kml_fz_top = 0;
+            }
+
+            #region 该方法先保留,待重写观察效果
+            ////当峰值大于了 某值,判定值,同时,记录峰起点值是0时,为记录峰值开始
+            //if (tp.value >= f_kmlfzpd_mix && kml_fz_start == 0)
+            //{
+            //    kml_fz_start = tp.kmlf_value;//记录峰值起点
+            //}
+            //else
+            //{
+            //    //记录该阶段最高的峰值
+            //    if (kml_fz_top < tp.kmlf_value)
+            //        kml_fz_top = tp.kmlf_value;
+
+            //    //这里又记录的结束点,如果判断到了结束点,那么就用开始点和结束点,来计算峰值的中心位置在哪
+            //    if (tp.value < f_kmlfzpd_mix && kml_fz_start != 0)
+            //    {
+            //        //说明已经在峰值结束后,的区间了
+            //        //保存峰值end
+            //        kml_fz_end = tp.kmlf_value;//记录峰值结束点
+
+            //        //计算峰值中心点,起点+(结束点-起点=起止段长)/2,就是起点+半段长,为峰值中心
+            //        kml_fz_start = kml_fz_start + (kml_fz_end - kml_fz_start) / 2;
+
+            //        //构造KML峰值list对象
+            //        KMLFPoint ls_lkmfpoint = new KMLFPoint();
+            //        //ls_lkmfpoint.kml_x = kml_fz_start;//不再使用中间阶段
+            //        ls_lkmfpoint.kml_x = kml_fz_top;
+
+            //        //查找出该峰值是什么元素的, 待完成
+            //        ls_lkmfpoint.ysm = GetElementNameByKMLRange(kml_fz_start, 0.2f);
+            //        //ls_lkmfpoint.ysm = "元素名";
+
+            //        //将该峰值保存到峰值上
+            //        m_list_kmlfpoint.Add(ls_lkmfpoint);
+
+            //        //最后再将记录kml峰值的起和止,都新初始化一下
+            //        kml_fz_start = 0;
+            //        kml_fz_end = 0;
+            //        kml_fz_top = 0;
+            //    }
+            //}
+            #endregion
+        }
+
+        private void CalcKMLFPoint(List<ShowElementInfo> in_list_showelementinfo)
+        {
+            for (int i = 0; i < in_list_showelementinfo.Count; i++)
+            {
+                KMLFPoint ls_lkmfpoint = new KMLFPoint();
+                ls_lkmfpoint.ysm = in_list_showelementinfo[i].ElementName;
+                //ls_lkmfpoint.kml_x = (float)(in_list_showelementinfo[i].dKF * 1000 / 20);
+                ls_lkmfpoint.kml_x = (float)in_list_showelementinfo[i].dKF ;
+
+                //将该峰值保存到峰值上
+                m_list_kmlfpoint.Add(ls_lkmfpoint);
+            }
+        }
+
+        private void Control_XRayTable_Load(object sender, EventArgs e)
+        {
+            #region 设置背景透明及开启双缓冲
+            //设置Style支持透明背景色
+            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
+
+            SetStyle(ControlStyles.UserPaint, true);
+            SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
+            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); // 双缓冲
+            this.BackColor = Color.FromArgb(180, 255, 255, 255);
+            #endregion
+
+            //初始化变量,如果不初始化会在设计模式下报错
+            if (m_list_showelementinfo == null)
+            {
+                m_list_showelementinfo = new List<ShowElementInfo>();
+            }
+        }
+        #endregion
+
+        #region 绘制事件
+        protected override void OnPaint(PaintEventArgs e)
+        {
+            Graphics g = e.Graphics;
+
+            DrawXrayImage(g);
+        }
+
+        /// <summary>
+        /// 封装绘制能谱数据方法
+        /// </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);
+
+            //200个小刻度
+            for (int i = 0; i < m_i_smallkd_number; i++)
+            {
+                g.DrawLine(m_this_p, m_i_draw_start + (i * m_i_smalkd * f_js_width), m_f_rulerX_location, m_i_draw_start + (i * m_i_smalkd * f_js_width), m_f_rulerX_location + 5);
+            }
+
+            int i_count = 0;
+            //40个大刻度
+            for (int i = 0; i < m_i_bigkd_number; i++)
+            {
+                g.DrawLine(m_this_p, m_i_draw_start + (i * m_i_bigkd * f_js_width), m_f_rulerX_location, m_i_draw_start + (i * m_i_bigkd * f_js_width), m_f_rulerX_location + 10);
+                //每隔两刻度增长写字
+                if (i % 2 == 0)
+                {
+                    i_count++;
+                    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);
+                }
+            }
+
+            //补充输入文字,为了美观
+            //g.DrawString("kv", m_thisfont_bold, m_this_sb, 8, m_f_rulerX_location + 10);
+            #endregion
+
+            #region 绘制x-ray线的边框
+            //x-ray画线的左边线
+            g.DrawLine(m_this_p, m_i_draw_start, m_i_draw_start + m_Y_draw_TopDiff, m_i_draw_start * f_js_width, m_f_rulerX_location - 2);
+            //x-ray画线的底盘
+            //g.DrawLine(m_this_p, m_i_draw_start, m_f_rulerX_location - 2, m_i_draw_end* f_js_width, m_f_rulerX_location - 2);
+            #endregion
+
+            #region 图谱Y轴最高刻度
+            //g.DrawLine(m_this_p, m_Y_draw_start, m_Y_draw_start + m_Y_draw_TopDiff, m_Y_draw_Lenght, m_Y_draw_start + m_Y_draw_TopDiff);
+            //Font m_Yfont = new Font("微软雅黑", 7, FontStyle.Regular);
+            //if(m_kml_fz_top!= 0)
+            //{
+            //    m_Y_MaxValue = m_kml_fz_top;
+            //}
+            //double MaxValueTemp = Math.Round(Convert.ToDouble(m_Y_MaxValue));
+            ////判断四舍五入后的数值 是否小于原最高值
+            //if (MaxValueTemp < m_Y_MaxValue)
+            //{
+            //    g.DrawString("Y轴最高值:" + MaxValueTemp+1, m_Yfont, m_this_sb, 0, 0);
+            //}
+            //else
+            //{
+            //    g.DrawString("Y轴最高值:" + MaxValueTemp, m_Yfont, m_this_sb, 0, 0);
+            //}
+            #endregion
+
+            #endregion //--------------------------------------------------------------------------------------------------------
+
+            #region 绘制波浪线及线上文字--------------------------------------------------------------------------------------
+            if (m_b_show_searchxray == true)
+            {
+                //画波浪线----第一条线
+                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;
+                    PointF ls_pf2 = m_list_twopoint1[i].pf2;
+                    ls_pf2.X = ls_pf2.X * f_js_width;
+
+                    g.DrawLine(m_this_p, ls_pf1, ls_pf2);
+
+                    //找到最高值再输出的方式
+                    //if (list_twopoint1[i].pf2.Y < 60)
+                    //{
+                    //    g.DrawString(list_twopoint1[i].value.ToString() + "@ev", thisfont_bold, this_sb, ls_pf1.X + 3, ls_pf2.Y);
+                    //}
+
+                    //找到峰值,并将该峰值,标记出是什么元素
+
+                }
+            }
+            if (m_b_show_analysisxray == true)
+            {
+                //画波浪线----第二条线
+                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;
+                    PointF ls_pf2_2 = m_list_twopoint2[i].pf2;
+                    ls_pf2_2.X = ls_pf2_2.X * f_js_width;
+
+                    g.DrawLine(m_this_p_blue, ls_pf1_2, ls_pf2_2);
+
+                    //找到最高值再输出的方式
+                    //if (list_twopoint2[i].pf2.Y < 60)
+                    //{
+                    //    g.DrawString(list_twopoint2[i].value.ToString() + "@ev", thisfont_bold, this_sb_blue, list_twopoint2[i].pf2.X + 3, list_twopoint2[i].pf2.Y);
+                    //}
+                }
+            }
+
+            #endregion //----------------------------------------------------------------------------------------------------------------
+
+            #region //绘制峰值上的线-----------------------------------------------------------------------------------------------
+            if (m_list_kmlfpoint != null)
+            {
+                for (int i = 0; i < m_list_kmlfpoint.Count(); i++)
+                {
+                    //为了让元素标签不在同一高度显示,为了美观,也是防止会重叠,所以这里计算一下
+                    int i_py = 0;//设置元素标签的偏移
+                    if (i % 2 == 1)
+                        i_py = 0;
+                    else
+                        i_py = 20;
+
+                    //先把峰值上的文字去掉,因为这里与底层分析出的结果不太一致,为了不产生疑问所以这里去掉
+
+                    //绘制竖线
+                    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);
+                    //输出文字,并将字输出到线的上面
+                    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.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));
+                }
+            }
+            #endregion 
+
+            #region 绘制鼠标移动显示的线及线上文字---------------------------------------------------------------------------------------
+            ////再绘制鼠标所在位置的竖线---------------------第一条线
+            //g.DrawLine(m_mousemove_p, m_mouse_point.X, m_i_draw_start, m_mouse_point.X, m_f_rulerX_location - 3);
+
+            //string ls_label_str = "";
+            //for (int i = 0; i < m_list_twopoint2.Count(); i++)
+            //{
+            //    //判断要按条件进行显示,值大于200才进行显示,用循环i的位置进行判断,在不变动这些数组时,这种写法是正确的
+            //    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)
+            //        {
+            //            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)
+            //        {
+            //            ls_label_str = m_list_twopoint2[i].kmlf_value.ToString();
+            //        }
+            //    }
+            //}
+            //if (ls_label_str != "")
+            //    ls_label_str = Convert.ToDouble(ls_label_str).ToString("0.000");//显示浮点数,为了美观
+
+            ////绘制鼠标竖线上的定位文字
+            //SizeF sizeF = g.MeasureString(ls_label_str, m_thisfont);
+            //PointF pointF = new PointF(m_mouse_point.X - (sizeF.Width / 2), 2);
+            //g.FillRectangle(Brushes.SkyBlue, new RectangleF(pointF, sizeF));
+            //g.DrawString(ls_label_str, m_thisfont_bold, m_this_sb, pointF);
+            #endregion
+
+            #region //右上角输出文字设置-------------------------------------------------------------------------------------------------
+            m_i_rightdrawlabellocation_x = m_i_draw_end * f_js_width;
+           
+            ////显示国标相关信息
+            //g.DrawString(m_GBinfostr, m_thisfont_bold, m_this_sb, new PointF(m_i_rightdrawlabellocation_x, m_i_rightdrawlabellocation_y));
+            ////计算值显示,计数率
+            //g.DrawString(m_xraysum2.ToString(), m_thisfont_bold, m_this_sb, new PointF(m_i_rightdrawlabellocation_x + 50, m_i_rightdrawlabellocation_y + 20));
+            ////高度比例尺值显示
+            ////g.DrawString(m_xraytopixel_multiple.ToString("0.0"), m_thisfont_bold, m_this_sb, new PointF(m_i_rightdrawlabellocation_x + 50, m_i_rightdrawlabellocation_y + 20));
+            ////物质名显示
+            //g.DrawString(m_goodname, m_thisfont_bold, m_this_sb, new PointF(m_i_rightdrawlabellocation_x + 50, m_i_rightdrawlabellocation_y + 40));
+
+            //show element list information,using the elementlist number to make sure width,number take width 25 growth
+            if (m_list_showelementinfo != null)
+            {
+                PointF ls_pt = new PointF(m_i_rightdrawlabellocation_x - (m_list_showelementinfo.Count * 60), m_i_rightdrawlabellocation_y);
+                for (int i = 0; i < m_list_showelementinfo.Count; i++)
+                {
+                    string str_element = "" + m_list_showelementinfo[i].ElementName + "(" + m_list_showelementinfo[i].Percentage.ToString("0.00") + ")";
+                    SizeF out_testsizef = g.MeasureString(str_element, m_thisfont);
+                    g.DrawString(str_element, m_thisfont, new SolidBrush(Color.Blue), ls_pt);
+                    ls_pt.X = ls_pt.X + out_testsizef.Width + 2;
+                }
+            }
+            #endregion //------------------------------------------------------------------------------------------------------------------
+
+        }
+        #endregion
+
+        #region 导出绘制的XRay能谱方法
+        /// <summary>
+        /// 导出能谱的图像截图Bitmap对象
+        /// </summary>
+        /// <param name="in_str_path"></param>
+        /// <returns></returns>
+        public Bitmap ExportXRayImage()
+        {
+            Bitmap ret_bmp = new Bitmap(this.Width, this.Height);
+            //Graphics g = this.CreateGraphics();
+
+            //g.DrawImage(ret_bmp, new Point(0, 0));
+            //DrawXrayImage(g);
+
+            //Bitmap image = new Bitmap(this.Width, this.Height);
+            this.DrawToBitmap(ret_bmp, new Rectangle(0, 0, this.Width, this.Height));
+
+            return ret_bmp;
+        }
+
+
+
+        #endregion
+
+        #region 鼠标移动事件
+        protected override void OnMouseMove(MouseEventArgs e)
+        {
+            //记录鼠标移动到的点,用来绘制用
+            m_mouse_point = new Point(e.X, e.Y);
+            this.Invalidate();
+        }
+        #endregion
+
+        private void InitializeComponent()
+        {
+            this.SuspendLayout();
+            // 
+            // Control_XRayTable
+            // 
+            this.Name = "Control_XRayTable";
+            this.ResumeLayout(false);
+
+        }
+    }
+
+    #region 用来显示连接线封装的类
+    /// <summary>
+    /// 封装两个点的一个类
+    /// </summary>
+    [Serializable]
+    public class TwoPoint
+    {
+        public PointF pf1;
+        public PointF pf2;
+        public float value;
+        public float kmlf_value;
+    }
+
+    /// <summary>
+    /// 记录显示的KML峰值类,分别记录kml峰值的x坐标,和峰值对应的一左一右的元素名
+    /// </summary>
+    [Serializable]
+    public class KMLFPoint
+    {
+        public float kml_x;
+        public string ysm;
+    }
+
+    /// <summary>
+    /// show x-ray info with element list,the element information class
+    /// </summary>
+    [Serializable]
+    public class ShowElementInfo
+    {
+        public string ElementName;
+        public double Percentage;//实际能谱返回的质量百分比
+        public double dKF;//K峰,元素周期表中固定值
+    }
+    #endregion
+
+}

+ 25 - 0
MeasureThread/UserControls/Control_XRayTable.designer.cs

@@ -0,0 +1,25 @@
+namespace HOZProject
+{
+    partial class Control_XRayTable
+    {
+        /// <summary> 
+        /// 必需的设计器变量。
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// 清理所有正在使用的资源。
+        /// </summary>
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+      
+    }
+}

+ 120 - 0
MeasureThread/UserControls/Control_XRayTable.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 160 - 0
OxfordTest/OTSMeasureOutputNlog.Designer.cs

@@ -0,0 +1,160 @@
+namespace OxfordTest
+{
+    partial class OTSMeasureOutputNlog
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.richTextBox_Nlog = new System.Windows.Forms.RichTextBox();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.button1 = new System.Windows.Forms.Button();
+            this.button_Clear = new System.Windows.Forms.Button();
+            this.button_stop = new System.Windows.Forms.Button();
+            this.combox_NlogType = new System.Windows.Forms.ComboBox();
+            this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+            this.groupBox1.SuspendLayout();
+            this.tableLayoutPanel1.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // richTextBox_Nlog
+            // 
+            this.richTextBox_Nlog.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.richTextBox_Nlog.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.richTextBox_Nlog.Location = new System.Drawing.Point(4, 62);
+            this.richTextBox_Nlog.Margin = new System.Windows.Forms.Padding(4);
+            this.richTextBox_Nlog.Name = "richTextBox_Nlog";
+            this.richTextBox_Nlog.ReadOnly = true;
+            this.richTextBox_Nlog.Size = new System.Drawing.Size(504, 909);
+            this.richTextBox_Nlog.TabIndex = 0;
+            this.richTextBox_Nlog.Text = "";
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.button1);
+            this.groupBox1.Controls.Add(this.button_Clear);
+            this.groupBox1.Controls.Add(this.button_stop);
+            this.groupBox1.Controls.Add(this.combox_NlogType);
+            this.groupBox1.Location = new System.Drawing.Point(4, 4);
+            this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
+            this.groupBox1.Size = new System.Drawing.Size(504, 45);
+            this.groupBox1.TabIndex = 7;
+            this.groupBox1.TabStop = false;
+            // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(0, 12);
+            this.button1.Margin = new System.Windows.Forms.Padding(4);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(100, 29);
+            this.button1.TabIndex = 3;
+            this.button1.Text = "Test";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Visible = false;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // button_Clear
+            // 
+            this.button_Clear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.button_Clear.Location = new System.Drawing.Point(412, 12);
+            this.button_Clear.Margin = new System.Windows.Forms.Padding(4);
+            this.button_Clear.Name = "button_Clear";
+            this.button_Clear.Size = new System.Drawing.Size(84, 29);
+            this.button_Clear.TabIndex = 4;
+            this.button_Clear.Text = "close";
+            this.button_Clear.UseVisualStyleBackColor = true;
+            this.button_Clear.Click += new System.EventHandler(this.button_Clear_Click);
+            // 
+            // button_stop
+            // 
+            this.button_stop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.button_stop.Location = new System.Drawing.Point(292, 12);
+            this.button_stop.Margin = new System.Windows.Forms.Padding(4);
+            this.button_stop.Name = "button_stop";
+            this.button_stop.Size = new System.Drawing.Size(84, 29);
+            this.button_stop.TabIndex = 6;
+            this.button_stop.Text = "Stop";
+            this.button_stop.UseVisualStyleBackColor = true;
+            this.button_stop.Click += new System.EventHandler(this.button_stop_Click);
+            // 
+            // combox_NlogType
+            // 
+            this.combox_NlogType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.combox_NlogType.FormattingEnabled = true;
+            this.combox_NlogType.Location = new System.Drawing.Point(133, 15);
+            this.combox_NlogType.Margin = new System.Windows.Forms.Padding(4);
+            this.combox_NlogType.Name = "combox_NlogType";
+            this.combox_NlogType.Size = new System.Drawing.Size(104, 20);
+            this.combox_NlogType.TabIndex = 2;
+            this.combox_NlogType.SelectedIndexChanged += new System.EventHandler(this.combox_NlogType_SelectedIndexChanged);
+            // 
+            // tableLayoutPanel1
+            // 
+            this.tableLayoutPanel1.ColumnCount = 1;
+            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+            this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0);
+            this.tableLayoutPanel1.Controls.Add(this.richTextBox_Nlog, 0, 1);
+            this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
+            this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+            this.tableLayoutPanel1.RowCount = 2;
+            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5.948718F));
+            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 94.05128F));
+            this.tableLayoutPanel1.Size = new System.Drawing.Size(512, 975);
+            this.tableLayoutPanel1.TabIndex = 8;
+            // 
+            // OTSMeasureOutputNlog
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.AutoScroll = true;
+            this.AutoSize = true;
+            this.ClientSize = new System.Drawing.Size(512, 975);
+            this.Controls.Add(this.tableLayoutPanel1);
+            this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Margin = new System.Windows.Forms.Padding(4);
+            this.Name = "OTSMeasureOutputNlog";
+            this.ShowIcon = false;
+            this.ShowInTaskbar = false;
+            this.Load += new System.EventHandler(this.OTSMeasureOutputNlog_Load);
+            this.groupBox1.ResumeLayout(false);
+            this.tableLayoutPanel1.ResumeLayout(false);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.RichTextBox richTextBox_Nlog;
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.Button button_Clear;
+        private System.Windows.Forms.Button button_stop;
+        private System.Windows.Forms.ComboBox combox_NlogType;
+        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+    }
+}

+ 104 - 0
OxfordTest/OTSMeasureOutputNlog.cs

@@ -0,0 +1,104 @@
+using NLog;
+using NLog.Config;
+using NLog.Targets;
+//using OTS.WinFormsUI.Docking;
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+
+namespace OxfordTest
+{
+    public partial class OTSMeasureOutputNlog: Form
+    {
+        //OTSSysMgrTools.Language lan;
+        //Hashtable table;
+        protected static NLog.Logger log;
+        public OTSMeasureOutputNlog()
+        {
+            InitializeComponent();
+        }
+
+        private void OTSMeasureOutputNlog_Load(object sender, EventArgs e)
+        {
+            combox_NlogType.Items.Add("Trace");
+            combox_NlogType.Items.Add("Debug");
+            combox_NlogType.Items.Add("Info");
+            combox_NlogType.Items.Add("Warn");
+            combox_NlogType.Items.Add("Error");
+            combox_NlogType.Items.Add("Fatal");
+            combox_NlogType.SelectedIndex = 0;
+            log = NLog.LogManager.GetCurrentClassLogger();
+
+            //国际
+            //lan = new OTSSysMgrTools.Language(this);
+            //table = lan.GetNameTable(this.Name);
+            //label1.Text = table["label1"].ToString();
+            //button_Clear.Text = table["button_clear"].ToString();
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            log.Trace("Trace");
+            log.Debug("Debug");
+            log.Info("Info");
+            log.Warn("Warn");
+            log.Error("Error");
+            log.Fatal("Fatal THIS IS A LOG WHICH USED TO TEST THE LOG LENTH FIT TO THE FORM!");
+        }
+
+        private void button_Clear_Click(object sender, EventArgs e)
+        {
+            richTextBox_Nlog.Clear();
+        }
+
+        private void combox_NlogType_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            if (null == combox_NlogType.SelectedItem) return;
+            String str = combox_NlogType.SelectedItem.ToString();    // 获取日志级别.
+            LogLevel lv = LogLevel.Info;    // 若选择的值无效, 则当作 Info级.
+            lv = LogLevel.FromString(str);
+            LoggingRule lr = LogManager.Configuration.LoggingRules.FirstOrDefault(
+                                r => r.Targets.Any(
+                                    t => "control" == t.Name
+                                )
+                            );
+            if (lr != null)
+            {
+                lr.SetLoggingLevels(lv, LogLevel.Fatal);
+                LogManager.ReconfigExistingLoggers();    // 使配置生效.
+            }
+        }
+
+        private void button_stop_Click(object sender, EventArgs e)
+        {
+            if (button_stop.Text == "Stop")
+            {
+                LoggingRule lr = LogManager.Configuration.LoggingRules.FirstOrDefault(
+                                r => r.Targets.Any(
+                                    t => "control" == t.Name
+                                )
+                            ); 
+                LogManager.Configuration.LoggingRules.Remove(lr);
+                LogManager.ReconfigExistingLoggers(); 
+                button_stop.Text = "Start";
+            }
+            else
+            {
+                if (null == combox_NlogType.SelectedItem) return;
+                String str = combox_NlogType.SelectedItem.ToString();
+                LogManager.Configuration.AddRule(LogLevel.FromString(str), LogLevel.Fatal, "control");
+                LogManager.ReconfigExistingLoggers();    // 使配置生效.
+                button_stop.Text = "Stop";
+            }
+        }
+
+      
+    }
+}

+ 120 - 0
OxfordTest/OTSMeasureOutputNlog.resx

@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 0 - 11
SmartSEMControl/SmartSEMControl.csproj

@@ -67,17 +67,6 @@
     <None Include="App.config" />
     <None Include="packages.config" />
   </ItemGroup>
-  <ItemGroup>
-    <COMReference Include="APILib">
-      <Guid>{71BD42C1-EBD3-11D0-AB3A-444553540000}</Guid>
-      <VersionMajor>1</VersionMajor>
-      <VersionMinor>0</VersionMinor>
-      <Lcid>0</Lcid>
-      <WrapperTool>tlbimp</WrapperTool>
-      <Isolated>False</Isolated>
-      <EmbedInteropTypes>True</EmbedInteropTypes>
-    </COMReference>
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>