Browse Source

Merge branch 'master' of http://192.168.1.123:10080/SDD1/HOZ

HaoShuang 5 years ago
parent
commit
da90bdaad2

+ 120 - 0
AutoDo/FormAutoDo.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>

+ 246 - 0
HOZProject/FormShowImage.Designer.cs

@@ -0,0 +1,246 @@
+namespace HOZProject
+{
+    partial class FormShowImage
+    {
+        /// <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.pichide = new System.Windows.Forms.PictureBox();
+            this.picexit = new System.Windows.Forms.PictureBox();
+            this.pbImage = new System.Windows.Forms.PictureBox();
+            this.plImageInfo = new System.Windows.Forms.Panel();
+            this.lblContent = new System.Windows.Forms.Label();
+            this.lblMag = new System.Windows.Forms.Label();
+            this.lblKV = new System.Windows.Forms.Label();
+            this.panel1 = new System.Windows.Forms.Panel();
+            this.lblAutoContent = new System.Windows.Forms.Label();
+            this.lblAutoMag = new System.Windows.Forms.Label();
+            this.lblAutoKV = new System.Windows.Forms.Label();
+            this.pbAutoImage = new System.Windows.Forms.PictureBox();
+            ((System.ComponentModel.ISupportInitialize)(this.pichide)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.picexit)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.pbImage)).BeginInit();
+            this.plImageInfo.SuspendLayout();
+            this.panel1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.pbAutoImage)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // pichide
+            // 
+            this.pichide.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.pichide.BackColor = System.Drawing.Color.Transparent;
+            this.pichide.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.pichide.Image = global::HOZProject.Properties.Resources.Min_Gray;
+            this.pichide.Location = new System.Drawing.Point(1501, 14);
+            this.pichide.Margin = new System.Windows.Forms.Padding(6);
+            this.pichide.Name = "pichide";
+            this.pichide.Size = new System.Drawing.Size(20, 20);
+            this.pichide.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
+            this.pichide.TabIndex = 58;
+            this.pichide.TabStop = false;
+            this.pichide.Visible = false;
+            // 
+            // picexit
+            // 
+            this.picexit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.picexit.BackColor = System.Drawing.Color.Transparent;
+            this.picexit.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.picexit.Image = global::HOZProject.Properties.Resources.exit_Gray;
+            this.picexit.Location = new System.Drawing.Point(1525, 14);
+            this.picexit.Margin = new System.Windows.Forms.Padding(6);
+            this.picexit.Name = "picexit";
+            this.picexit.Size = new System.Drawing.Size(20, 20);
+            this.picexit.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
+            this.picexit.TabIndex = 57;
+            this.picexit.TabStop = false;
+            this.picexit.Click += new System.EventHandler(this.picexit_Click);
+            // 
+            // pbImage
+            // 
+            this.pbImage.BackColor = System.Drawing.Color.White;
+            this.pbImage.Location = new System.Drawing.Point(4, 44);
+            this.pbImage.Margin = new System.Windows.Forms.Padding(4);
+            this.pbImage.Name = "pbImage";
+            this.pbImage.Size = new System.Drawing.Size(768, 576);
+            this.pbImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
+            this.pbImage.TabIndex = 59;
+            this.pbImage.TabStop = false;
+            // 
+            // plImageInfo
+            // 
+            this.plImageInfo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(183)))), ((int)(((byte)(183)))), ((int)(((byte)(183)))));
+            this.plImageInfo.Controls.Add(this.lblContent);
+            this.plImageInfo.Controls.Add(this.lblMag);
+            this.plImageInfo.Controls.Add(this.lblKV);
+            this.plImageInfo.Location = new System.Drawing.Point(4, 620);
+            this.plImageInfo.Margin = new System.Windows.Forms.Padding(4);
+            this.plImageInfo.Name = "plImageInfo";
+            this.plImageInfo.Size = new System.Drawing.Size(768, 64);
+            this.plImageInfo.TabIndex = 60;
+            // 
+            // lblContent
+            // 
+            this.lblContent.AutoSize = true;
+            this.lblContent.Font = new System.Drawing.Font("宋体", 12F);
+            this.lblContent.ForeColor = System.Drawing.Color.White;
+            this.lblContent.Location = new System.Drawing.Point(532, 20);
+            this.lblContent.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.lblContent.Name = "lblContent";
+            this.lblContent.Size = new System.Drawing.Size(190, 24);
+            this.lblContent.TabIndex = 1;
+            this.lblContent.Text = "工作距离:8.2mm";
+            // 
+            // lblMag
+            // 
+            this.lblMag.AutoSize = true;
+            this.lblMag.Font = new System.Drawing.Font("宋体", 12F);
+            this.lblMag.ForeColor = System.Drawing.Color.White;
+            this.lblMag.Location = new System.Drawing.Point(258, 20);
+            this.lblMag.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.lblMag.Name = "lblMag";
+            this.lblMag.Size = new System.Drawing.Size(178, 24);
+            this.lblMag.TabIndex = 1;
+            this.lblMag.Text = "放大倍数:200X";
+            // 
+            // lblKV
+            // 
+            this.lblKV.AutoSize = true;
+            this.lblKV.Font = new System.Drawing.Font("宋体", 12F);
+            this.lblKV.ForeColor = System.Drawing.Color.White;
+            this.lblKV.Location = new System.Drawing.Point(32, 20);
+            this.lblKV.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.lblKV.Name = "lblKV";
+            this.lblKV.Size = new System.Drawing.Size(130, 24);
+            this.lblKV.TabIndex = 1;
+            this.lblKV.Text = "电压:20KV";
+            // 
+            // panel1
+            // 
+            this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(183)))), ((int)(((byte)(183)))), ((int)(((byte)(183)))));
+            this.panel1.Controls.Add(this.lblAutoContent);
+            this.panel1.Controls.Add(this.lblAutoMag);
+            this.panel1.Controls.Add(this.lblAutoKV);
+            this.panel1.Location = new System.Drawing.Point(775, 620);
+            this.panel1.Margin = new System.Windows.Forms.Padding(4);
+            this.panel1.Name = "panel1";
+            this.panel1.Size = new System.Drawing.Size(768, 64);
+            this.panel1.TabIndex = 62;
+            // 
+            // lblAutoContent
+            // 
+            this.lblAutoContent.AutoSize = true;
+            this.lblAutoContent.Font = new System.Drawing.Font("宋体", 12F);
+            this.lblAutoContent.ForeColor = System.Drawing.Color.White;
+            this.lblAutoContent.Location = new System.Drawing.Point(522, 20);
+            this.lblAutoContent.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.lblAutoContent.Name = "lblAutoContent";
+            this.lblAutoContent.Size = new System.Drawing.Size(190, 24);
+            this.lblAutoContent.TabIndex = 1;
+            this.lblAutoContent.Text = "工作距离:8.2mm";
+            // 
+            // lblAutoMag
+            // 
+            this.lblAutoMag.AutoSize = true;
+            this.lblAutoMag.Font = new System.Drawing.Font("宋体", 12F);
+            this.lblAutoMag.ForeColor = System.Drawing.Color.White;
+            this.lblAutoMag.Location = new System.Drawing.Point(258, 20);
+            this.lblAutoMag.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.lblAutoMag.Name = "lblAutoMag";
+            this.lblAutoMag.Size = new System.Drawing.Size(178, 24);
+            this.lblAutoMag.TabIndex = 1;
+            this.lblAutoMag.Text = "放大倍数:200X";
+            // 
+            // lblAutoKV
+            // 
+            this.lblAutoKV.AutoSize = true;
+            this.lblAutoKV.Font = new System.Drawing.Font("宋体", 12F);
+            this.lblAutoKV.ForeColor = System.Drawing.Color.White;
+            this.lblAutoKV.Location = new System.Drawing.Point(32, 20);
+            this.lblAutoKV.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.lblAutoKV.Name = "lblAutoKV";
+            this.lblAutoKV.Size = new System.Drawing.Size(130, 24);
+            this.lblAutoKV.TabIndex = 1;
+            this.lblAutoKV.Text = "电压:20KV";
+            // 
+            // pbAutoImage
+            // 
+            this.pbAutoImage.BackColor = System.Drawing.Color.White;
+            this.pbAutoImage.Location = new System.Drawing.Point(775, 44);
+            this.pbAutoImage.Margin = new System.Windows.Forms.Padding(4);
+            this.pbAutoImage.Name = "pbAutoImage";
+            this.pbAutoImage.Size = new System.Drawing.Size(768, 576);
+            this.pbAutoImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
+            this.pbAutoImage.TabIndex = 61;
+            this.pbAutoImage.TabStop = false;
+            // 
+            // FormShowImage
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.BackColor = System.Drawing.Color.Black;
+            this.ClientSize = new System.Drawing.Size(1550, 688);
+            this.Controls.Add(this.panel1);
+            this.Controls.Add(this.pbAutoImage);
+            this.Controls.Add(this.plImageInfo);
+            this.Controls.Add(this.pbImage);
+            this.Controls.Add(this.pichide);
+            this.Controls.Add(this.picexit);
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Margin = new System.Windows.Forms.Padding(4);
+            this.Name = "FormShowImage";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "FormShowImage";
+            this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.FormShowImage_MouseDown);
+            this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.FormShowImage_MouseMove);
+            this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.FormShowImage_MouseUp);
+            ((System.ComponentModel.ISupportInitialize)(this.pichide)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.picexit)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.pbImage)).EndInit();
+            this.plImageInfo.ResumeLayout(false);
+            this.plImageInfo.PerformLayout();
+            this.panel1.ResumeLayout(false);
+            this.panel1.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.pbAutoImage)).EndInit();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.PictureBox pichide;
+        private System.Windows.Forms.PictureBox picexit;
+        private System.Windows.Forms.Panel plImageInfo;
+        private System.Windows.Forms.Label lblKV;
+        private System.Windows.Forms.Label lblContent;
+        private System.Windows.Forms.Label lblMag;
+        private System.Windows.Forms.Panel panel1;
+        private System.Windows.Forms.Label lblAutoContent;
+        private System.Windows.Forms.Label lblAutoMag;
+        private System.Windows.Forms.Label lblAutoKV;
+        public System.Windows.Forms.PictureBox pbImage;
+        public System.Windows.Forms.PictureBox pbAutoImage;
+    }
+}

+ 119 - 0
HOZProject/FormShowImage.cs

@@ -0,0 +1,119 @@
+using System;
+using System.Collections.Generic;
+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 FormShowImage : Form
+    {
+        #region 属性
+        /// <summary>
+        /// 显示的图像
+        /// </summary>
+        private Image showImg;
+        public Image ShowImg { get => showImg; set => showImg = value; }
+        /// <summary>
+        /// 电压
+        /// </summary>
+        private string kv;
+        public string Kv { get => kv; set => kv = value; }
+        /// <summary>
+        /// 放大倍数
+        /// </summary>
+        private string mag;
+        public string Mag { get => mag; set => mag = value; }
+        /// <summary>
+        /// 属性信息(工作距离、消像散、亮度、对比度)
+        /// </summary>
+        private string content;
+        public string Content { get => content; set => content = value; }
+
+        /// <summary>
+        /// Auto后显示的图像
+        /// </summary>
+        private Image showAutoImg;
+        public Image ShowAutoImg { get => showAutoImg; set => showAutoImg = value; }
+        /// <summary>
+        /// Auto后电压
+        /// </summary>
+        private string autoKv;
+        public string AutoKv { get => autoKv; set => autoKv = value; }
+        /// <summary>
+        /// Auto后放大倍数
+        /// </summary>
+        private string autoMag;
+        public string AutoMag { get => autoMag; set => autoMag = value; }
+        /// <summary>
+        /// Auto后属性信息(工作距离、消像散、亮度、对比度)
+        /// </summary>
+        private string autoContent;
+        public string AutoContent { get => autoContent; set => autoContent = value; }
+        #endregion
+
+
+        public FormShowImage()
+        {
+            InitializeComponent();
+        }
+
+        #region 拖动窗体
+        private Point mouseOff;//鼠标移动位置变量
+        private bool leftFlag;//标签是否为左键
+        private void FormShowImage_MouseDown(object sender, MouseEventArgs e)
+        {
+            if (e.Button == MouseButtons.Left)
+            {
+                mouseOff = new Point(-e.X, -e.Y); //得到变量的值
+                leftFlag = true;                  //点击左键按下时标注为true;
+            }
+        }
+        private void FormShowImage_MouseMove(object sender, MouseEventArgs e)
+        {
+            if (leftFlag)
+            {
+                Point mouseSet = Control.MousePosition;
+                mouseSet.Offset(mouseOff.X, mouseOff.Y);  //设置移动后的位置
+                Location = mouseSet;
+            }
+        }
+        private void FormShowImage_MouseUp(object sender, MouseEventArgs e)
+        {
+            if (leftFlag)
+            {
+                leftFlag = false;//释放鼠标后标注为false;
+            }
+        }
+        #endregion
+
+        private void picexit_Click(object sender, EventArgs e)
+        {
+            this.Close();
+        }
+
+        #region 设置当前图像参数
+        public void SetParaInfo()
+        {
+            lblKV.Text = Kv;
+            lblMag.Text = Mag;
+            lblContent.Text = Content;
+
+            lblAutoKV.Text = "";
+            lblAutoMag.Text = "";
+            lblAutoContent.Text = "";
+        }
+
+        public void SetAutoParaInfo()
+        {
+            lblAutoKV.Text = AutoKv;
+            lblAutoMag.Text = AutoMag;
+            lblAutoContent.Text = AutoContent;
+        } 
+        #endregion
+    }
+}

+ 120 - 0
HOZProject/FormShowImage.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>

File diff suppressed because it is too large
+ 176 - 215
HOZProject/FormUCMain.Designer.cs


+ 890 - 2
HOZProject/FormUCMain.cs

@@ -1,10 +1,12 @@
-using System;
+using SmartSEMControl;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
 using System.Drawing;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 
@@ -12,14 +14,152 @@ namespace HOZProject
 {
     public partial class FormUCMain : Form
     {
+        #region 全局变量定义
+        //全局只有一个fatorySEM
+        //static FactoryHardware factorySEM = FactoryHardware.Instance;
+        ISEMControl iSEM = null;//factorySEM.ISEM;
+        //电镜连接状态变量
+        bool m_SEMConnectState = false;
+        //自动状态变量
+        bool m_AutoState = false;
+        //电压状态变量
+        bool m_HTState = false;
+        //样品台状态变量
+        bool m_StageStage = false;
+        int m_ThreadTime = 1000;
+        int m_ThreadCount = 5;
+        string m_ImgFileSavePath = "D://tempImage.tif";
+        string m_ImgAutoFileSavePath = "D://tempAutoImage.tif";
+        short m_ImgWidth = 1024;
+        short m_ImgHeight = 768;
+        #endregion
+
+        #region 构造
         public FormUCMain()
         {
             InitializeComponent();
+        } 
+        #endregion
+
+        #region 窗体事件
+        private void FormUCMain_Load(object sender, EventArgs e)
+        {
+            ////获取初始状态(电镜连接状态、自动函数的状态、样品台状态)
+            //Thread thread = new Thread(new ThreadStart(GetInitState));
+            //thread.Start();
         }
+        #endregion
 
-        private void FormUCMain_LocationChanged(object sender, EventArgs e)
+        #region 获取初始状态
+        public void GetInitState()
         {
+            if (iSEM != null)
+            {
+                //电镜连接状态
+                GetSEMConnectState();
+                //自动函数的状态
+                GetAutoFUNCState();
+                //样品台状态
+                GetStageState();
+            }
         }
+        #endregion
+
+        #region 获取状态(电镜连接状态、自动函数的状态、样品台状态)
+        public bool GetSEMConnectState()
+        {
+            bool result = GetAllState(StateType.SEMConnectState);
+            if (result)
+            {
+                //已连接,设置按钮图像
+                btnConnect.BackgroundImage = Properties.Resources.CloseImg;
+                btnConnect.Invalidate();
+            }
+            else
+            {
+                btnConnect.BackgroundImage = Properties.Resources.ConnectImg;
+                btnConnect.Invalidate();
+            }
+            //设置电镜连接状态:True
+            m_SEMConnectState = result;
+            return result;
+        }
+        public bool GetAutoFUNCState()
+        {
+            bool result = GetAllState(StateType.AutoFUNCState);
+            m_AutoState = result;
+            return result;
+        }
+        public bool GetStageState()
+        {
+            bool result = GetAllState(StateType.StageState);
+            if (result)
+            {
+                btnConnect.BackgroundImage = Properties.Resources.CloseImg;
+            }
+            else
+            {
+                btnConnect.BackgroundImage = Properties.Resources.ConnectImg;
+            }
+            m_StageStage = result;
+            return result;
+        }
+        public bool GetAllState(StateType stateType)
+        {
+            //线程循环计数器
+            int threadCount = 0;
+            bool bResult = false;
+            float fResult = 0;
+            while (true)
+            {
+                if (threadCount <= m_ThreadCount)
+                {
+                    switch (stateType)
+                    {
+                        case StateType.SEMConnectState:
+                            bResult = iSEM.ConnectStatus();
+                            if (bResult)
+                            {
+                                return bResult;
+                            }
+                            break;
+                        case StateType.AutoFUNCState:
+                            fResult = iSEM.GetAutoFunction();
+                            if (fResult == 0)
+                            {
+                                bResult = true;
+                                return bResult;
+                            }
+                            break;
+                        case StateType.StageState:
+
+                            fResult = iSEM.GetStageIs();
+                            if (fResult == 0)
+                            {
+                                bResult = true;
+                                return bResult;
+                            }
+                            break;
+                    }
+                }
+                else
+                {
+                    return false;
+                }
+                threadCount++;
+                Thread.Sleep(m_ThreadTime);
+            }
+        }
+        /// <summary>
+        /// 状态枚举
+        /// </summary>
+        public enum StateType
+        {
+            SEMConnectState = 0,
+            AutoFUNCState = 1,
+            StageState = 2
+        }
+        #endregion
 
         #region 关闭与最小化按钮事件
         private void pichide_MouseEnter(object sender, EventArgs e)
@@ -81,5 +221,753 @@ namespace HOZProject
             }
         }
         #endregion
+
+        #region SEM功能按钮读写事件
+        #region 连接、关闭设备
+        /// <summary>
+        /// 初始化连接设备
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void btnConnect_Click(object sender, EventArgs e)
+        {
+            //1.判断当前连接状态
+            if (m_SEMConnectState)
+            {
+                if (iSEM != null)
+                {
+                    iSEM.Dispose();
+                }
+            }
+        }
+
+        #endregion
+
+        #region 获取与设置缩放参数
+        /// <summary>
+        /// 获取缩放参数
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void btnenlargeGet_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetMagnification();
+            if (float.IsNaN(ret))
+            {
+                txtenlarge.Enabled = false;
+                btnenlargeSet.Enabled = false;
+            }
+            else
+            {
+                txtenlarge.Text = ret.ToString();
+                btnenlargeSet.Enabled = true;
+            }
+        }
+        /// <summary>
+        /// 获取缩放参数
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void btnenlargeSet_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtenlarge.Text, out set))
+            {
+                iSEM.SetMagnification(set);
+            }
+        }
+        #endregion
+
+        #region 获取与设置亮度参数
+        private void btnBrightnessGet_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetBrightness();
+            if (float.IsNaN(ret))
+            {
+                txtBrightness.Enabled = false;
+                btnBrightnessSet.Enabled = false;
+            }
+            else
+            {
+                txtBrightness.Text = ret.ToString();
+                btnBrightnessSet.Enabled = true;
+            }
+        }
+
+        private void btnBrightnessSet_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtBrightness.Text, out set))
+            {
+                iSEM.SetBrightness(set);
+            }
+        }
+        #endregion
+
+        #region 获取与设置焦距参数
+        private void btnWDGet_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetWorkingDistance();
+            if (float.IsNaN(ret))
+            {
+                txtWD.Enabled = false;
+                btnWDSet.Enabled = false;
+            }
+            else
+            {
+                txtWD.Text = ret.ToString();
+                btnWDSet.Enabled = true;
+            }
+        }
+
+        private void btnWDSet_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtWD.Text, out set))
+            {
+                iSEM.SetWorkingDistance(set);
+            }
+        }
+        #endregion
+
+        #region 获取与设置对比度参数
+        private void btnContrastGet_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetContrast();
+            if (float.IsNaN(ret))
+            {
+                txtContrast.Enabled = false;
+                btnContrastSet.Enabled = false;
+            }
+            else
+            {
+                txtContrast.Text = ret.ToString();
+                btnContrastSet.Enabled = true;
+            }
+        }
+
+        private void btnContrastSet_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtContrast.Text, out set))
+            {
+                iSEM.SetContrast(set);
+            }
+        }
+        #endregion
+
+        #region 获取与设置倾斜矫正参数
+        private void btnTiltAngleGet_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetTiltAngle();
+            if (float.IsNaN(ret))
+            {
+                txtTiltAngle.Enabled = false;
+                btnTiltAngleSet.Enabled = false;
+            }
+            else
+            {
+                txtTiltAngle.Text = ret.ToString();
+                btnTiltAngleSet.Enabled = true;
+            }
+        }
+
+        private void btnTiltAngleSet_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtTiltAngle.Text, out set))
+            {
+                iSEM.SetTiltAngle(set);
+            }
+        }
+        #endregion
+
+        #region 获取与设置旋转角度参数
+        private void btnScanRotationGet_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetScanRotation();
+            if (float.IsNaN(ret))
+            {
+                txtScanRotation.Enabled = false;
+                btnScanRotationSet.Enabled = false;
+            }
+            else
+            {
+                txtScanRotation.Text = ret.ToString();
+                btnScanRotationSet.Enabled = true;
+            }
+        }
+
+        private void btnScanRotationSet_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtScanRotation.Text, out set))
+            {
+
+                iSEM.SetScanRotation(set);
+            }
+        }
+        #endregion
+
+        #region 获取与设置像散Y参数
+        private void btnAstigmatismXGet_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetAstigmatismX();
+            if (float.IsNaN(ret))
+            {
+                txtAstigmatismX.Enabled = false;
+                btnAstigmatismXSet.Enabled = false;
+            }
+            else
+            {
+                txtAstigmatismX.Text = ret.ToString();
+                btnAstigmatismXSet.Enabled = true;
+            }
+        }
+
+        private void btnAstigmatismXSet_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtAstigmatismX.Text, out set))
+            {
+                iSEM.SetAstigmatismX(set);
+            }
+        }
+        #endregion
+
+        #region 获取与设置像散Y参数
+        private void btnAstigmatismYGet_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetAstigmatismY();
+            if (float.IsNaN(ret))
+            {
+                txtAstigmatismY.Enabled = false;
+                btnAstigmatismYSet.Enabled = false;
+            }
+            else
+            {
+                txtAstigmatismY.Text = ret.ToString();
+                btnAstigmatismYSet.Enabled = true;
+            }
+        }
+
+        private void btnAstigmatismYSet_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtAstigmatismY.Text, out set))
+            {
+                iSEM.SetAstigmatismY(set);
+            }
+        }
+        #endregion
+
+        #region 获取像素尺寸
+        private void btnPixelSizeGet_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetPixelSize();
+            if (float.IsNaN(ret))
+            {
+                txtPixelSize.Text = "NaN";
+            }
+            else
+            {
+                txtPixelSize.Text = ret.ToString();
+            }
+        }
+        #endregion
+
+        #region 切换电压状态
+        private void pbHT_Click(object sender, EventArgs e)
+        {
+            bool result = true;
+            if (!m_HTState)
+            {
+                //打开电压
+                result = iSEM.CmdOpenVoltage();
+                if (result)
+                {
+                    m_HTState = true;
+                    pbHT.Image = Properties.Resources.OFF;
+                    pbHT.Invalidate();
+                }
+            }
+            else
+            {
+                //关闭电压
+                result = iSEM.CmdCloseVoltage();
+                if (result)
+                {
+                    m_HTState = false;
+                    pbHT.Image = Properties.Resources.ON;
+                    pbHT.Invalidate();
+                }
+            }
+        }
+        #endregion
+
+        #region 获取样品台六轴位置信息
+        private void btnGetStagePosition_Click(object sender, EventArgs e)
+        {
+            if (iSEM == null)
+            {
+                return;
+            }
+            try
+            {
+                float[] pt = iSEM.GetStagePosition();
+                if (!float.IsNaN(pt[0]))
+                {
+                    txtStageX.Text = pt[0].ToString();
+                }
+                if (!float.IsNaN(pt[1]))
+                {
+                    txtStageY.Text = pt[1].ToString();
+                }
+                if (!float.IsNaN(pt[2]))
+                {
+                    txtStageZ.Text = pt[2].ToString();
+                }
+                if (!float.IsNaN(pt[3]))
+                {
+                    txtStageT.Text = pt[3].ToString();
+                }
+                if (!float.IsNaN(pt[4]))
+                {
+                    txtStageR.Text = pt[4].ToString();
+                }
+                if (!float.IsNaN(pt[5]))
+                {
+                    txtStageM.Text = pt[5].ToString();
+                }
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+        }
+        #endregion
+
+        #region 获取与设置样品台X轴参数
+        private void btnStageGetX_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetStageAtX();
+            if (float.IsNaN(ret))
+            {
+                txtStageX.Text = "NaN";
+            }
+            else
+            {
+                txtStageX.Text = ret.ToString();
+            }
+        }
+
+        private void btnStageSetX_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtStageX.Text, out set))
+            {
+                iSEM.SetStageGotoX(set);
+            }
+        }
+        #endregion
+
+        #region 获取与设置样品台T轴参数
+        private void btnStageGetT_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetStageAtT();
+            if (float.IsNaN(ret))
+            {
+                txtStageT.Text = "NaN";
+            }
+            else
+            {
+                txtStageT.Text = ret.ToString();
+            }
+        }
+
+        private void btnStageSetT_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtStageT.Text, out set))
+            {
+                iSEM.SetStageGotoT(set);
+            }
+        }
+        #endregion
+
+        #region 获取与设置样品台Y轴参数
+        private void btnStageGetY_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetStageAtY();
+            if (float.IsNaN(ret))
+            {
+                txtStageY.Text = "NaN";
+            }
+            else
+            {
+                txtStageY.Text = ret.ToString();
+            }
+        }
+
+        private void btnStageSetY_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtStageY.Text, out set))
+            {
+                iSEM.SetStageGotoY(set);
+            }
+        }
+        #endregion
+
+        #region 获取与设置样品台R轴参数
+        private void btnStageGetR_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetStageAtR();
+            if (float.IsNaN(ret))
+            {
+                txtStageR.Text = "NaN";
+            }
+            else
+            {
+                txtStageR.Text = ret.ToString();
+            }
+        }
+
+        private void btnStageSetR_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtStageR.Text, out set))
+            {
+                iSEM.SetStageGotoR(set);
+            }
+        }
+        #endregion
+
+        #region 获取与设置样品台Z轴参数
+        private void btnStageGetZ_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetStageAtZ();
+            if (float.IsNaN(ret))
+            {
+                txtStageZ.Text = "NaN";
+            }
+            else
+            {
+                txtStageZ.Text = ret.ToString();
+            }
+        }
+
+        private void btnStageSetZ_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtStageZ.Text, out set))
+            {
+                iSEM.SetStageGotoZ(set);
+            }
+        }
+        #endregion
+
+        #region 获取与设置样品台M轴参数
+        private void btnStageGetM_Click(object sender, EventArgs e)
+        {
+            float ret = iSEM.GetStageAtM();
+            if (float.IsNaN(ret))
+            {
+                txtStageM.Text = "NaN";
+            }
+            else
+            {
+                txtStageM.Text = ret.ToString();
+            }
+        }
+
+        private void btnStageSetM_Click(object sender, EventArgs e)
+        {
+            float set = 0;
+            if (float.TryParse(txtStageM.Text, out set))
+            {
+                iSEM.SetStageGotoM(set);
+            }
+        }
+        #endregion
+
+        #region 移动当前位置至SEM中心
+        private void btnMoveSEMCenter_Click(object sender, EventArgs e)
+        {
+            if (iSEM == null)
+            {
+                return;
+            }
+            //设置当前样品台状态
+            m_StageStage = false;
+            float setX = 0;
+            float setY = 0;
+            bool GotoResult = false;
+            //判断X、Y轴信息
+            if (float.TryParse(txtMoveStageX.Text, out setX) && float.TryParse(txtMoveStageY.Text, out setY))
+            {
+                GotoResult = iSEM.MoveStageXY(setX, setY);
+            }
+        }
+        #endregion
+
+        #region 停止
+        /// <summary>
+        /// 停止
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void btnStop_Click(object sender, EventArgs e)
+        {
+            if (iSEM != null)
+            {
+                //停止
+                iSEM.CmdStageAbort();
+            }
+        }
+        #endregion
+        #endregion
+        
+        #region 自动函数处理
+        FormShowImage fShowImage = null;
+        #region 获取图像
+        /// <summary>
+        /// 获取图像
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void btnGetImage_Click(object sender, EventArgs e)
+        {
+            if (iSEM == null)
+            {
+                return;
+            }
+            fShowImage = new FormShowImage();
+            //获取当前图像以及当前电镜参数
+            //放大倍数
+            float f_Mag = iSEM.GetMagnification();
+            //焦距
+            float f_WD = iSEM.GetWorkingDistance();
+            bool imageResult = iSEM.GrabImage(m_ImgFileSavePath, 0, 0, m_ImgWidth, m_ImgHeight, 0);
+            if (imageResult)
+            {
+                Bitmap bitmap = new Bitmap(m_ImgFileSavePath);
+                fShowImage.Width = fShowImage.Width / 2;
+                //设置当前图像与参数
+                fShowImage.pbImage.Image = (Image)bitmap;
+                fShowImage.Mag = "放大倍数:" + f_Mag;
+                fShowImage.Content = "焦距:" + f_WD;
+                fShowImage.SetParaInfo();
+                fShowImage.Show();
+            }
+        }
+        #endregion
+
+        #region 自动对焦
+        private void btnAutoWD_Click(object sender, EventArgs e)
+        {
+            if (iSEM == null)
+            {
+                return;
+            }
+            fShowImage = new FormShowImage();
+            //获取图像尺寸
+            int[] imageSize = iSEM.GetImageStore();
+            m_ImgWidth = Convert.ToInt16(imageSize[0]);
+            m_ImgHeight = Convert.ToInt16(imageSize[1]);
+            //放大倍数
+            float f_Mag = iSEM.GetMagnification();
+            //焦距
+            float f_WD = iSEM.GetWorkingDistance();
+            //获取当前图像以及当前电镜参数
+            bool imageResult = iSEM.GrabImage(m_ImgFileSavePath, 0, 0, m_ImgWidth, m_ImgHeight, 0);
+            if (imageResult)
+            {
+                Bitmap bitmap = new Bitmap(m_ImgFileSavePath);
+                //设置当前图像与参数
+                fShowImage.pbImage.Image = (Image)bitmap;
+                fShowImage.Mag = "放大倍数:" + f_Mag;
+                fShowImage.Content = "焦距:" + f_WD;
+                fShowImage.SetParaInfo();
+                fShowImage.Show();
+                float result = iSEM.GetAutoVideo();
+                if (result > 0)
+                {
+                    Thread threadImg = new Thread(new ThreadStart(GetAutoWDImage));
+                    threadImg.Start();
+                }
+            }
+        }
+        /// <summary>
+        /// 获取自动状态后
+        /// </summary>
+        private void GetAutoWDImage()
+        {
+            if (fShowImage != null)
+            {
+                //获取当前自动状态
+                bool result = GetAllState(StateType.AutoFUNCState);
+                if (result)
+                { 
+                    //放大倍数
+                    float f_Mag = iSEM.GetMagnification();
+                    //焦距
+                    float f_WD = iSEM.GetWorkingDistance();
+                    //获取自动对焦后图像以及电镜参数
+                    bool imageResult = iSEM.GrabImage(m_ImgAutoFileSavePath, 0, 0, m_ImgWidth, m_ImgHeight, 0);
+                    Bitmap bitmap = new Bitmap(m_ImgAutoFileSavePath);
+                    fShowImage.pbImage.Image = (Image)bitmap;
+                    //自动后设置图像与参数
+                    fShowImage.pbAutoImage.Image = Properties.Resources.UCMain;
+                    fShowImage.AutoMag = "放大倍数:" + f_Mag;
+                    fShowImage.AutoContent = "焦距:" + f_WD;
+                    fShowImage.SetAutoParaInfo();
+                    fShowImage.Invalidate();
+                }
+            }
+        }
+        #endregion
+
+        #region 自动亮度
+        private void btnAutoBrightness_Click(object sender, EventArgs e)
+        {
+            if (iSEM == null)
+            {
+                return;
+            }
+            fShowImage = new FormShowImage();
+            //获取图像尺寸
+            int[] imageSize = iSEM.GetImageStore();
+            m_ImgWidth = Convert.ToInt16(imageSize[0]);
+            m_ImgHeight = Convert.ToInt16(imageSize[1]);
+            //放大倍数
+            float f_Mag = iSEM.GetMagnification();
+            //亮度
+            float f_Brightness = iSEM.GetBrightness();
+            //对比度
+            float f_Contrast = iSEM.GetContrast();
+            //获取当前图像以及当前电镜参数
+            bool imageResult = iSEM.GrabImage(m_ImgFileSavePath, 0, 0, m_ImgWidth, m_ImgHeight, 0);
+            if (imageResult)
+            {
+                Bitmap bitmap = new Bitmap(m_ImgFileSavePath);
+                fShowImage.pbImage.Image = (Image)bitmap;
+                fShowImage.Mag = "放大倍数:" + f_Mag;
+                fShowImage.Content = "亮度:"+f_Brightness+"对比度:"+ f_Contrast;
+                fShowImage.SetParaInfo();
+                fShowImage.Show();
+                float result = iSEM.GetAutoVideo();
+                if (result== 0)
+                {
+                    Thread threadImg = new Thread(new ThreadStart(GetAutoBrightness));
+                    threadImg.Start();
+                }
+            }
+        }
+        /// <summary>
+        /// 获取自动状态后
+        /// </summary>
+        private void GetAutoBrightness()
+        {
+            if (fShowImage != null)
+            {
+                //获取当前自动状态
+                bool result = GetAllState(StateType.AutoFUNCState);
+                if (result)
+                {
+                    //放大倍数
+                    float f_Mag = iSEM.GetMagnification();
+                    //亮度
+                    float f_Brightness = iSEM.GetBrightness();
+                    //对比度
+                    float f_Contrast = iSEM.GetContrast();
+                    //获取自动对焦后图像以及电镜参数
+                    bool imageResult = iSEM.GrabImage(m_ImgAutoFileSavePath, 0, 0, m_ImgWidth, m_ImgHeight, 0);
+                    Bitmap bitmap = new Bitmap(m_ImgFileSavePath);
+                    fShowImage.pbAutoImage.Image = (Image)bitmap;
+                    fShowImage.AutoMag = "放大倍数:" + f_Mag;
+                    fShowImage.AutoContent = "亮度:" + f_Brightness + "对比度:" + f_Contrast;
+                    fShowImage.SetAutoParaInfo();
+                    fShowImage.Invalidate();
+                }
+            }
+        }
+        #endregion
+
+        #region 自动消像散
+        private void btnAutoAstigmatism_Click(object sender, EventArgs e)
+        {
+            if (iSEM == null)
+            {
+                return;
+            }
+            fShowImage = new FormShowImage();
+            //获取图像尺寸
+            int[] imageSize = iSEM.GetImageStore();
+            m_ImgWidth = Convert.ToInt16(imageSize[0]);
+            m_ImgHeight = Convert.ToInt16(imageSize[1]);
+            //放大倍数
+            float f_Mag = iSEM.GetMagnification();
+            //消像散X
+            float f_AstigmatismX = iSEM.GetAstigmatismX();
+            //消像散Y
+            float f_AstigmatismY = iSEM.GetAstigmatismY();
+            //获取当前图像以及当前电镜参数
+            bool imageResult = iSEM.GrabImage(m_ImgFileSavePath, 0, 0, m_ImgWidth, m_ImgHeight, 0);
+            if (imageResult)
+            {
+                Bitmap bitmap = new Bitmap(m_ImgFileSavePath);
+                fShowImage.pbImage.Image = (Image)bitmap;
+                fShowImage.Mag = "放大倍数:" + f_Mag;
+                fShowImage.Content = "消像散X:" + f_AstigmatismX + "消像散Y:" + f_AstigmatismY;
+                fShowImage.SetParaInfo();
+                fShowImage.Show();
+                float result = iSEM.GetAutoVideo();
+                if (result == 0)
+                {
+                    Thread threadImg = new Thread(new ThreadStart(GetAutoAstigmatism));
+                    threadImg.Start();
+                }
+            }
+        }
+        /// <summary>
+        /// 获取自动状态后
+        /// </summary>
+        private void GetAutoAstigmatism()
+        {
+            if (fShowImage != null)
+            {
+                //获取当前自动状态
+                bool result = GetAllState(StateType.AutoFUNCState);
+                if (result)
+                {
+                    //放大倍数
+                    float f_Mag = iSEM.GetMagnification();
+                    //消像散X
+                    float f_AstigmatismX = iSEM.GetAstigmatismX();
+                    //消像散Y
+                    float f_AstigmatismY = iSEM.GetAstigmatismY();
+                    //获取自动对焦后图像以及电镜参数
+                    bool imageResult = iSEM.GrabImage(m_ImgAutoFileSavePath, 0, 0, m_ImgWidth, m_ImgHeight, 0);
+                    Bitmap bitmap = new Bitmap(m_ImgFileSavePath);
+                    fShowImage.pbAutoImage.Image = (Image)bitmap;
+                    fShowImage.AutoMag = "放大倍数:" + f_Mag;
+                    fShowImage.AutoContent = "消像散X:" + f_AstigmatismX + "消像散Y:" + f_AstigmatismY;
+                    fShowImage.SetAutoParaInfo();
+                    fShowImage.Invalidate();
+                }
+            }
+        }
+        #endregion
+
+        #endregion
+
+        private void btnContrast_Click(object sender, EventArgs e)
+        {
+            if (iSEM == null)
+            {
+                return;
+            }
+        }
     }
 }

+ 3 - 3
HOZProject/FormUnitControl.Designer.cs

@@ -140,7 +140,7 @@
             this.btnInit.TabIndex = 1;
             this.btnInit.Text = "初始化设备";
             this.btnInit.UseVisualStyleBackColor = true;
-            this.btnInit.Click += new System.EventHandler(this.btnInit_Click);
+            //this.btnInit.Click += new System.EventHandler(this.btnInit_Click);
             // 
             // btnCloseCtrl
             // 
@@ -152,7 +152,7 @@
             this.btnCloseCtrl.TabIndex = 2;
             this.btnCloseCtrl.Text = "关闭设备";
             this.btnCloseCtrl.UseVisualStyleBackColor = true;
-            this.btnCloseCtrl.Click += new System.EventHandler(this.btnCloseCtrl_Click);
+            //this.btnCloseCtrl.Click += new System.EventHandler(this.btnCloseCtrl_Click);
             // 
             // btnSetNotify
             // 
@@ -164,7 +164,7 @@
             this.btnSetNotify.TabIndex = 3;
             this.btnSetNotify.Text = "设置通知";
             this.btnSetNotify.UseVisualStyleBackColor = true;
-            this.btnSetNotify.Click += new System.EventHandler(this.btnSetNotify_Click);
+            //this.btnSetNotify.Click += new System.EventHandler(this.btnSetNotify_Click);
             // 
             // btnenlargeGet
             // 

+ 1 - 4
HOZProject/FormUnitControl.cs

@@ -57,7 +57,6 @@ namespace HOZProject
         }
         #endregion
 		
-		
         #region 设备关闭按键
         private void btnCloseCtrl_Click(object sender, EventArgs e)
         {
@@ -188,9 +187,7 @@ namespace HOZProject
             // }
         }
         #endregion
-
-
-
+        
         #region 缩放Get
         private void btnenlargeGet_Click(object sender, EventArgs e)
         {

+ 30 - 0
HOZProject/Properties/Resources.Designer.cs

@@ -70,6 +70,26 @@ namespace HOZProject.Properties {
             }
         }
         
+        /// <summary>
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
+        /// </summary>
+        internal static System.Drawing.Bitmap CloseImg {
+            get {
+                object obj = ResourceManager.GetObject("CloseImg", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
+        /// </summary>
+        internal static System.Drawing.Bitmap ConnectImg {
+            get {
+                object obj = ResourceManager.GetObject("ConnectImg", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         /// <summary>
         ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
@@ -110,6 +130,16 @@ namespace HOZProject.Properties {
             }
         }
         
+        /// <summary>
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
+        /// </summary>
+        internal static System.Drawing.Bitmap GetImage {
+            get {
+                object obj = ResourceManager.GetObject("GetImage", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+        
         /// <summary>
         ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>

+ 9 - 0
HOZProject/Properties/Resources.resx

@@ -154,4 +154,13 @@
   <data name="GetLocationBG" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Resources\GetLocationBG.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
+  <data name="CloseImg" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\CloseImg.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
+  <data name="ConnectImg" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\ConnectImg.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
+  <data name="GetImage" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\GetImage.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
 </root>

BIN
HOZProject/Resources/CloseImg.jpg


BIN
HOZProject/Resources/ConnectImg.jpg


BIN
HOZProject/Resources/GetImage.jpg


BIN
HOZProject/Resources/UCMain.png


+ 18 - 0
HOZProject/UnitControl.csproj

@@ -47,6 +47,12 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="FormShowImage.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FormShowImage.Designer.cs">
+      <DependentUpon>FormShowImage.cs</DependentUpon>
+    </Compile>
     <Compile Include="FormUCMain.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -61,6 +67,9 @@
     </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <EmbeddedResource Include="FormShowImage.resx">
+      <DependentUpon>FormShowImage.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="FormUCMain.resx">
       <DependentUpon>FormUCMain.cs</DependentUpon>
     </EmbeddedResource>
@@ -129,8 +138,17 @@
   <ItemGroup>
     <None Include="Resources\buttonBG.jpg" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\CloseImg.jpg" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\ConnectImg.jpg" />
+  </ItemGroup>
   <ItemGroup>
     <None Include="Resources\UCMain.png" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\GetImage.jpg" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 8 - 6
SmartSEMControl/SmartSEM.cs

@@ -1014,23 +1014,25 @@ namespace SmartSEMControl
         public Boolean MoveStageXY(float x,float y)
         {
             //先取范围
-            object varMin = new VariantWrapper((float)0.0f);
-            object varMax = new VariantWrapper((float)0.0f);
-            long lrt = CZEMApi.GetLimits(AP_STAGE_GOTO_X, ref varMin, ref varMax);
+            object xMin = new VariantWrapper((float)0.0f);
+            object xMax = new VariantWrapper((float)0.0f);
+            long lrt = CZEMApi.GetLimits(AP_STAGE_GOTO_X, ref xMin, ref xMax);
             if (lrt != 0)
             {
                 return false;
             }
-            if (x > Convert.ToSingle(varMax) || x < Convert.ToSingle(varMin))
+            if (x > Convert.ToSingle(xMax) || x < Convert.ToSingle(xMin))
             {
                 return false;
             }
-            lrt = CZEMApi.GetLimits(AP_STAGE_GOTO_Y, ref varMin, ref varMax);
+            object yMin = new VariantWrapper((float)0.0f);
+            object yMax = new VariantWrapper((float)0.0f);
+            lrt = CZEMApi.GetLimits(AP_STAGE_GOTO_Y, ref yMin, ref yMax);
             if (lrt != 0)
             {
                 return false;
             }
-            if (y > Convert.ToSingle(varMax) || y < Convert.ToSingle(varMin))
+            if (y > Convert.ToSingle(yMax) || y < Convert.ToSingle(yMin))
             {
                 return false;
             }

Some files were not shown because too many files changed in this diff