| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152 | using System;using System.Collections.Generic;using System.Linq;using System.Windows.Forms;using System.Text.RegularExpressions;using System.Collections;using System.Diagnostics;using OTSDataType;using OTSModelSharp;using System.IO;using static OTSModelSharp.ResourceManage.ResourceData;using static OTSDataType.otsdataconst;using OTSModelSharp.Measure.GetStageInfo;using OTSMeasureApp._3_OTSDisplaySourceGridData;using OTSPeriodicTable;namespace OTSMeasureApp{    public partial class ProgMgrInfoForm :Form    {        #region 定义变量        //初始化函数功能类          public CStage m_cstage;                                      //样品台类        public CStageParam m_cstagefile;                              //样品台文件类        public COTSDefaultParam m_cotsprogmgrparamfile;          //参数类        public CSEMStageData m_csemstagedata;                        //SEM样品台处理类        public COTSImgScanPrm m_cotsimgscanprm;                      //图像扫描类        public COTSGeneralParam m_cgenparam;                                //一般参数类        public COTSImageProcParam m_cotsimgprocprm;                      //图像处理类        public COTSXRayParam m_cotsxrayprm;             public bool m_b_checkstagefile = false;        //定位程序管理路径用的变量        public string m_ParameterPath;        frmMeasureStopMode StopModeDialog;        _7_OTSProgMgrInfo.OtherSelectionForm otherSelectionForm;        //国际化        OTSCommon.Language lan;        Hashtable table;        NLog.Logger log ;        #endregion        /// <summary>        /// 样品台加载        /// </summary>        /// <returns></returns>        public bool StageLoad()        {            if (!m_cstagefile.Load( true, !m_b_checkstagefile))            {                log.Error("(OTSProgMgrInfoFun.StageLoad)  加载样品台信息失败");                return false;            }            return true;        }        #region 构造函数        /// <summary>        /// 默认构造函数        /// </summary>        public ProgMgrInfoForm()        {            log = NLog.LogManager.GetCurrentClassLogger();            m_cotsprogmgrparamfile = new COTSDefaultParam();            m_cstagefile = new CStageParam();                  InitializeComponent();            //国际化            lan = new OTSCommon.Language(this);            table = lan.GetNameTable(this.Name);        }         #endregion        #region 绑定各combobox控件        /// <summary>        /// 绑定各combobox控件下拉列表        /// </summary>        public void BindComboBox()        {            //样品台            if (!StageLoad())            {                this.Close();                return;//加载失败返回            }            //绑定样品台列表信息            BindStageCombobox();            //初始化选项,下拉框---------------------------------------------            //绑定标准库            IDC_COMBO_STDSelect.Items.Clear();            string STDLibFolderName = m_cgenparam.GetPartSTDLibFolderName();                        string[] files = System.IO.Directory.GetFiles(STDLibFolderName, "*.db");            System.IO.DirectoryInfo folder = new System.IO.DirectoryInfo(STDLibFolderName);            foreach (System.IO.FileInfo file in folder.GetFiles("*.db"))            {                ComboBoxItem cbi = new ComboBoxItem();                string FileNameWithoutExtension = Path.GetFileNameWithoutExtension(file.FullName);                cbi.Text = FileNameWithoutExtension;                //cbi.Value = (int)enum_one;                IDC_COMBO_STDSelect.Items.Add(cbi);            }            //添加下拉列表中null项            ComboBoxItem cbiNull = new ComboBoxItem();            cbiNull.Text = "NoSTDDB";            //cbi.Value = (int)enum_one;            IDC_COMBO_STDSelect.Items.Add(cbiNull);            this.IDC_COMBO_STDSelect.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_STDSelect_SelectedIndexChanged);            if (IDC_COMBO_STDSelect.Items.Count > 0)                IDC_COMBO_STDSelect.SelectedIndex = 0;            //----------------------------------------------------------------------            this.IDC_COMBO_STDSelect.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_STDSelect_SelectedIndexChanged);            //x轴方向            IDC_COMBO_XDIREC.Items.Clear();            foreach (otsdataconst.OTS_X_AXIS_DIRECTION enum_one in Enum.GetValues(typeof(otsdataconst.OTS_X_AXIS_DIRECTION)))            {                ComboBoxItem cbi = new ComboBoxItem();                cbi.Text = GetXAxisDirectionIdString(enum_one);                cbi.Value = (int)enum_one;                IDC_COMBO_XDIREC.Items.Add(cbi);            }            this.IDC_COMBO_XDIREC.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_XDIREC_SelectedIndexChanged);            if (IDC_COMBO_XDIREC.Items.Count > 0)                IDC_COMBO_XDIREC.SelectedIndex = 0;            this.IDC_COMBO_XDIREC.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_XDIREC_SelectedIndexChanged);            //y轴方向            IDC_COMBO_YDIRECT.Items.Clear();            foreach (otsdataconst.OTS_Y_AXIS_DIRECTION enum_one in Enum.GetValues(typeof(otsdataconst.OTS_Y_AXIS_DIRECTION)))            {                ComboBoxItem cbi = new ComboBoxItem();                cbi.Text = GetYAxisDirectionIdString(enum_one);                cbi.Value = (int)enum_one;                IDC_COMBO_YDIRECT.Items.Add(cbi);            }            this.IDC_COMBO_YDIRECT.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_YDIRECT_SelectedIndexChanged);            if (IDC_COMBO_YDIRECT.Items.Count > 0)                IDC_COMBO_YDIRECT.SelectedIndex = 0;            this.IDC_COMBO_YDIRECT.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_YDIRECT_SelectedIndexChanged);                 //取图方式            IDC_COMBO_FETCHIMGMODE.Items.Clear();            foreach (otsdataconst.OTS_GET_IMAGE_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_GET_IMAGE_MODE)))            {                ComboBoxItem cbi = new ComboBoxItem();                cbi.Text = GetImageModeString(enum_one);                cbi.Value = (int)enum_one;                IDC_COMBO_FETCHIMGMODE.Items.Add(cbi);            }            this.IDC_COMBO_FETCHIMGMODE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged);            if (IDC_COMBO_FETCHIMGMODE.Items.Count > 0)                IDC_COMBO_FETCHIMGMODE.SelectedIndex = 0;            this.IDC_COMBO_FETCHIMGMODE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged);            //扫描图精度            IDC_COMBO_IMGSCANSPEED.Items.Clear();            foreach (otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)))            {                ComboBoxItem cbi = new ComboBoxItem();                cbi.Text = GetScanSpeedString(enum_one);                cbi.Value = (int)enum_one;                IDC_COMBO_IMGSCANSPEED.Items.Add(cbi);            }            this.IDC_COMBO_IMGSCANSPEED.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged);            if (IDC_COMBO_IMGSCANSPEED.Items.Count > 0)                IDC_COMBO_IMGSCANSPEED.SelectedIndex = 0;            this.IDC_COMBO_IMGSCANSPEED.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged);            //扫描图尺寸            IDC_COMBO_IMGSIZE.Items.Clear();            foreach (otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS)))            {                ComboBoxItem cbi = new ComboBoxItem();                cbi.Text = enum_one.ToString();                cbi.Value = (int)enum_one;                IDC_COMBO_IMGSIZE.Items.Add(cbi);            }            this.IDC_COMBO_IMGSIZE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_IMGSIZE_SelectedIndexChanged);            if (IDC_COMBO_IMGSIZE.Items.Count > 0)                IDC_COMBO_IMGSIZE.SelectedIndex = 0;            this.IDC_COMBO_IMGSIZE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_IMGSIZE_SelectedIndexChanged);                       //去背景方式            IDC_COMBO_BGREMOVETYPE.Items.Clear();            foreach (otsdataconst.OTS_AUTOBGREMOVETYPE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_AUTOBGREMOVETYPE)))            {                ComboBoxItem cbi = new ComboBoxItem();                cbi.Text = GetBGREMOVETYPEString(enum_one);                cbi.Value = (int)enum_one;                IDC_COMBO_BGREMOVETYPE.Items.Add(cbi);            }            this.IDC_COMBO_BGREMOVETYPE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged);            if (IDC_COMBO_BGREMOVETYPE.Items.Count > 0)                IDC_COMBO_BGREMOVETYPE.SelectedIndex = 0;            this.IDC_COMBO_BGREMOVETYPE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged);            //自动去背景方式            IDC_COMBO_AUTOBGREMOVETYP.Items.Clear();            foreach (otsdataconst.OTS_IMAGE_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_MODE)))            {                ComboBoxItem cbi = new ComboBoxItem();                cbi.Text = GetAUTOBGREMOVETYPEString(enum_one);                cbi.Value = (int)enum_one;                IDC_COMBO_AUTOBGREMOVETYP.Items.Add(cbi);            }            this.IDC_COMBO_AUTOBGREMOVETYP.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged);            if (IDC_COMBO_AUTOBGREMOVETYP.Items.Count > 0)                IDC_COMBO_AUTOBGREMOVETYP.SelectedIndex = 0;            this.IDC_COMBO_AUTOBGREMOVETYP.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged);            //X-Ray扫描方式            IDC_COMBO_XRAYSCANMODE.Items.Clear();            foreach (otsdataconst.OTS_X_RAY_SCAN_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_X_RAY_SCAN_MODE)))            {                ComboBoxItem cbi = new ComboBoxItem();                cbi.Text = GetXRayScanModeIdString(enum_one);                cbi.Value = (int)enum_one;                             IDC_COMBO_XRAYSCANMODE.Items.Add(cbi);                           }            this.IDC_COMBO_XRAYSCANMODE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged);            if (IDC_COMBO_XRAYSCANMODE.Items.Count > 0)                IDC_COMBO_XRAYSCANMODE.SelectedIndex = 0;            this.IDC_COMBO_XRAYSCANMODE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged);                     //精炼工艺下拉框选项            IDC_COMBO_TECHNOLOGY.Items.Clear();            foreach (STEEL_TECHNOLOGY enum_one in Enum.GetValues(typeof(STEEL_TECHNOLOGY)))            {                ComboBoxItem cbi = new ComboBoxItem();                cbi.Text = GetSteelTechIdString((otsdataconst.STEEL_TECHNOLOGY)enum_one);                cbi.Value = (int)enum_one;                IDC_COMBO_TECHNOLOGY.Items.Add(cbi);            }            this.IDC_COMBO_TECHNOLOGY.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_TECHNOLOGY_SelectedIndexChanged);            if (IDC_COMBO_TECHNOLOGY.Items.Count > 0)                IDC_COMBO_TECHNOLOGY.SelectedIndex = 0;            this.IDC_COMBO_TECHNOLOGY.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_TECHNOLOGY_SelectedIndexChanged);            //测量区域形状            cBMeasShape.Items.Clear();            foreach (otsdataconst.MEASURE_SHAPE enum_one in Enum.GetValues(typeof(otsdataconst.MEASURE_SHAPE)))            {                ComboBoxItem cbi = new ComboBoxItem();                cbi.Text = GetAreaShapeString(enum_one);                cbi.Value = (int)enum_one;                cBMeasShape.Items.Add(cbi);            }            this.cBMeasShape.SelectedIndexChanged -= new System.EventHandler(this.cBMeasShape_SelectedIndexChanged);            if (cBMeasShape.Items.Count > 0)                cBMeasShape.SelectedIndex = 0;            this.cBMeasShape.SelectedIndexChanged += new System.EventHandler(this.cBMeasShape_SelectedIndexChanged);            //模式选择            IDC_COMBO_Model.Items.Clear();            foreach (otsdataconst.RunMode enum_one in Enum.GetValues(typeof(otsdataconst.RunMode)))            {                OTSPeriodicTable.ComboBoxItem cbi = new OTSPeriodicTable.ComboBoxItem();                cbi.Text = GetRunModeString(enum_one);                cbi.Value = (int)enum_one;                IDC_COMBO_Model.Items.Add(cbi);            }            this.IDC_COMBO_Model.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_Model_SelectedIndexChanged);            if (IDC_COMBO_Model.Items.Count > 0)                IDC_COMBO_Model.SelectedIndex = 0;            this.IDC_COMBO_Model.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_Model_SelectedIndexChanged);                    }               public CStage GetWorkingStage()        {            CStage ls_cstageclr = m_cstagefile.GetWorkingStage();            if (null == ls_cstageclr)            {                log.Error("(OTSProgMgrInfoFun.GetWorkingStage)  获取正在工作的样品台类失败");                return ls_cstageclr;            }            return ls_cstageclr;        }        /// <summary>        /// 获取正在工作的样品台ID        /// </summary>        /// <returns></returns>        public int GetWorkingStageId()        {            int stageid = m_cstagefile.GetWorkingStageId();            return stageid;        }        /// <summary>        /// 获取样品台信息列表        /// </summary>        /// <returns></returns>        public List<CStage> GetStageList()        {            List<CStage> l_cstageclr = m_cstagefile.GetStagesList();            if (null == l_cstageclr)            {                log.Error("(OTSProgMgrInfoFun.GetStageList)  获取样品台信息列表失败");                return l_cstageclr;            }            return l_cstageclr;        }        /// <summary>        /// 绑定样品台列表信息        /// </summary>        private void BindStageCombobox()        {            //先插入正在工作的样品台            int ls_workingstageid = 0;            IDC_COMBO_STAGE.Items.Clear();            CStage ls_cstageclr = GetWorkingStage();            ComboBoxItem ls_cbi = new ComboBoxItem();            ls_cbi.Text = ls_cstageclr.GetName();            ls_workingstageid = GetWorkingStageId();            ls_cbi.Value = ls_workingstageid;            IDC_COMBO_STAGE.Items.Add(ls_cbi);            //添加其它的样品台信息                    List<CStage> l_cstageclr = GetStageList();            for (int i = 0; i < l_cstageclr.Count(); i++)            {                if (ls_workingstageid != i)//将已经插入过的正在工作样品台信息跳过去                {                    ComboBoxItem cbi = new ComboBoxItem();                    cbi.Text = l_cstageclr[i].GetName().ToString();                    cbi.Value = i.ToString();                    IDC_COMBO_STAGE.Items.Add(cbi);                }            }            //防止进入窗体后,马上进入下拉项选择事件,先把事件去掉,一会再注册上            this.IDC_COMBO_STAGE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_STAGE_SelectedIndexChanged);            //默认选择上            if (IDC_COMBO_STAGE.Items.Count > 0)            {                IDC_COMBO_STAGE.SelectedIndex = 0;            }            this.IDC_COMBO_STAGE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_STAGE_SelectedIndexChanged);        }        #endregion        #region 参数相关方法封装        /// <summary>        /// 读取SEM样品台参数信息        /// </summary>        public void LoadSEMStageData()        {            //100倍时屏幕尺寸/mm            IDC_EDIT_SCREENWIDTH.Text = m_csemstagedata.GetScanFieldSize100().ToString();            //x轴方向            foreach (ComboBoxItem cbi in IDC_COMBO_XDIREC.Items)            {                if (cbi.Value.ToString() != "")                    if (Convert.ToInt32(cbi.Value) == (int)m_csemstagedata.GetXAxisDir())                    {                        IDC_COMBO_XDIREC.SelectedItem = cbi;                    }            }            //x轴行程/mm 起,取值时,乘1000            IDC_EDIT_XSTART.Text = (m_csemstagedata.GetXAxis().GetStart() / 1000).ToString();            //x轴行程/mm 始            IDC_EDIT_XEND.Text = (m_csemstagedata.GetXAxis().GetEnd() / 1000).ToString();            //y轴方向            foreach (ComboBoxItem cbi in IDC_COMBO_YDIRECT.Items)            {                if (cbi.Value.ToString() != "")                    if (Convert.ToInt32(cbi.Value) == (int)m_csemstagedata.GetYAxisDir())                    {                        IDC_COMBO_YDIRECT.SelectedItem = cbi;                    }            }            //y轴行程/mm 起            IDC_EDIT_YSTART.Text = (m_csemstagedata.GetYAxis().GetStart() / 1000).ToString();            //y轴行程/mm 始            IDC_EDIT_YEND.Text = (m_csemstagedata.GetYAxis().GetEnd() / 1000).ToString();            //最小放大倍数            IDC_EDIT_MINMAG.Text = m_csemstagedata.GetMinMag().ToString();        }        /// <summary>        /// 加载图像扫描参数        /// </summary>        public void LoadImageScanPrm()        {            //测量终止方式            tB_StopMode.Text = m_cotsimgscanprm.GetStopMode().ToString();            if (StopModeDialog == null)            {                StopModeDialog = new frmMeasureStopMode();                StopModeDialog.FieldMode = m_cotsimgscanprm.GetStopParamFields();                StopModeDialog.TimeMode = m_cotsimgscanprm.GetStopParamMeasTime();                StopModeDialog.ParticleMode = m_cotsimgscanprm.GetStopParamParticles();                StopModeDialog.AreaMode = m_cotsimgscanprm.GetStopParamArea();                StopModeDialog.StopMode = tB_StopMode.Text;            }            //取图方式            foreach (ComboBoxItem cbi in IDC_COMBO_FETCHIMGMODE.Items)            {                if (cbi.Value.ToString() != "")                    if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetFieldStartMode())                    {                        IDC_COMBO_FETCHIMGMODE.SelectedItem = cbi;                    }            }            //扫描图精度            foreach (ComboBoxItem cbi in IDC_COMBO_IMGSCANSPEED.Items)            {                if (cbi.Value.ToString() != "")                    if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetScanImageSpeed())                    {                        IDC_COMBO_IMGSCANSPEED.SelectedItem = cbi;                    }            }            //扫描图尺寸            foreach (ComboBoxItem cbi in IDC_COMBO_IMGSIZE.Items)            {                if (cbi.Value.ToString() != "")                    if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetImageResulotion())                    {                        IDC_COMBO_IMGSIZE.SelectedItem = cbi;                    }            }                   }        /// <summary>        /// 加载一般常规参数        /// </summary>        public void LoadCGenParam()        {            //样品名            IDC_EDIT_SAMPLENAME.Text = m_cgenparam.GetSampleName().ToString();            //执行开关            IDC_MEAS_SWITCH.Checked = m_cgenparam.GetMeasurementSwitch();            //是否使用系统库开关            IDC_SYS_LIB.Checked = m_cgenparam.GetSysSTD();                       //精炼工艺选项            foreach (ComboBoxItem cbi in IDC_COMBO_TECHNOLOGY.Items)            {                if (cbi.Value.ToString() != "")                    if (Convert.ToInt32(cbi.Value) == m_cgenparam.GetSteelTechnology())                    {                        IDC_COMBO_TECHNOLOGY.SelectedItem = cbi;                    }            }            //测量区域形状            foreach (ComboBoxItem cbi in cBMeasShape.Items)            {                if (cbi.Value.ToString() != "")                    if (Convert.ToInt32(cbi.Value) == (int)m_cgenparam.GetShape())                    {                        cBMeasShape.SelectedItem = cbi;                    }            }            //测量区域面积            tBMeasArea.Text = m_cgenparam.GetArea().ToString();            //标准库选择            foreach (ComboBoxItem cbi in IDC_COMBO_STDSelect.Items)            {                if (cbi.Text.ToString() != "")                    if (cbi.Text.ToString() == m_cgenparam.GetSTDSelect())                    {                        IDC_COMBO_STDSelect.SelectedItem = cbi;                    }            }                    }        /// <summary>        /// 加载默认参数        /// </summary>        public void LoadDefaultParam()        {            //模式            foreach (OTSPeriodicTable.ComboBoxItem cbi in IDC_COMBO_Model.Items)            {                if (cbi.Value.ToString() != "")                    if (Convert.ToInt32(cbi.Value) == (int)m_cotsprogmgrparamfile.GetRunMode())                    {                        IDC_COMBO_Model.SelectedItem = cbi;                    }            }        }        /// <summary>        /// 加载图像处理参数        /// </summary>        public void LoadImageProc()        {                   //颗粒面积范围 最小            IDC_EDIT_PARTAREAMIN.Text = m_cotsimgprocprm.GetIncAreaRange().GetStart().ToString();            //颗粒面积范围 最大            IDC_EDIT_PARTAREAMAX.Text = m_cotsimgprocprm.GetIncAreaRange().GetEnd().ToString();            //背景灰度范围 最小            IDC_EDIT_BACKMIN.Text = m_cotsimgprocprm.GetBGGray().GetStart().ToString();            //背景灰度范围 最大            IDC_EDIT_BACKMAX.Text = m_cotsimgprocprm.GetBGGray().GetEnd().ToString();            //颗粒灰度范围 最小            IDC_EDIT_PARTMIN.Text = m_cotsimgprocprm.GetParticleGray().GetStart().ToString();            //颗粒灰度范围 最大            IDC_EDIT_PARTMAX.Text = m_cotsimgprocprm.GetParticleGray().GetEnd().ToString();            //腐蚀膨胀系数            //IDC_COMBO_CorrosionExpansionCoefficient.Text = m_cotsimgprocprm.GetErrodDilateParam().ToString();            //重叠尺寸            IDC_EDIT_Overlap.Text = m_cotsimgprocprm.GetOverlapParam().ToString();            //去背景方式            foreach (ComboBoxItem cbi in IDC_COMBO_BGREMOVETYPE.Items)            {                if (cbi.Value.ToString() != "")                {                    if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgprocprm.GetBGRemoveType())                    {                        IDC_COMBO_BGREMOVETYPE.SelectedItem = cbi;                        break;                    }                }            }            foreach (ComboBoxItem cbi in IDC_COMBO_AUTOBGREMOVETYP.Items)            {                if (cbi.Value.ToString() != "")                {                    if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgprocprm.GetAutoBGRemoveType())                    {                        IDC_COMBO_AUTOBGREMOVETYP.SelectedItem = cbi;                        break;                    }                }            }            //重叠尺寸            IDC_EDIT_Overlap.Text = m_cotsimgprocprm.GetOverlapParam().ToString();            if (m_cotsimgprocprm.GetParticleSelectCondition().ToString() == "")            {                IDC_EDIT_OTHERSELECTION.Text = "NoFilter";            }            else            {                IDC_EDIT_OTHERSELECTION.Text = m_cotsimgprocprm.GetParticleSelectCondition().ToString();            }        }        /// <summary>        /// 加载X-Ray参数        /// </summary>        public void LoadXRayParam()        {                                foreach (ComboBoxItem cbi in IDC_COMBO_XRAYSCANMODE.Items)            {                if (cbi.Value.ToString() != "")                    if (Convert.ToInt32(cbi.Value) == (int)m_cotsxrayprm.GetScanMode())                    {                        IDC_COMBO_XRAYSCANMODE.SelectedItem = cbi;                    }            }            //是否使用电镜            IDC_USINGXRAY_LIB.Checked = m_cotsxrayprm.GetUsingXray();                       //分析X-ray精度对应的时间            IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text = m_cotsxrayprm.GetMidAnalyAQTime().ToString();            //分析X-ray计数期望值            IDC_EDIT_ANALYXRAYAIMVALUE.Text = m_cotsxrayprm.GetAnalyExpCount().ToString();            IDC_EDIT_QuantifyMinSize.Text = m_cotsxrayprm.GetFeatureModeMinSize().ToString();            IDC_EDIT_SmallPartAQTime.Text = m_cotsxrayprm.GetSmallPartXrayTime().ToString();            IDC_EDIT_XrayLimit.Text = m_cotsxrayprm.GetXrayLimit().ToString();            if (m_cotsxrayprm.IfAutoId)            {                radioButton1.Checked =true;            }            else            {                radioButton2.Checked = true;            }                       tb_xsys.Text = m_cotsxrayprm.AnalysisElements;                  }        /// <summary>        /// 保存SEM样品台参数        /// </summary>        public void SaveSEMStageData()        {            //100倍时屏幕尺寸/mm            m_csemstagedata.SetScanFieldSize100(Convert.ToInt32(IDC_EDIT_SCREENWIDTH.Text));            //x轴方向            ComboBoxItem cbi_x = (ComboBoxItem)IDC_COMBO_XDIREC.SelectedItem;            m_csemstagedata.SetXAxisDir((otsdataconst.OTS_X_AXIS_DIRECTION)Convert.ToInt32(cbi_x.Value));            //x轴行程/mm 起,始            CIntRange crc_x = new CIntRange(Convert.ToInt32(IDC_EDIT_XSTART.Text) * 1000, Convert.ToInt32(IDC_EDIT_XEND.Text) * 1000);            m_csemstagedata.SetXAxis(crc_x);            //y轴方向            ComboBoxItem cbi_y = (ComboBoxItem)IDC_COMBO_YDIRECT.SelectedItem;            m_csemstagedata.SetYAxisDir((otsdataconst.OTS_Y_AXIS_DIRECTION)Convert.ToInt32(cbi_y.Value));            //y轴行程/mm 起,始            CIntRange crc_y = new CIntRange(Convert.ToInt32(IDC_EDIT_YSTART.Text) * 1000, Convert.ToInt32(IDC_EDIT_YEND.Text) * 1000);            m_csemstagedata.SetYAxis(crc_y);            //最小放大倍数            m_csemstagedata.SetMinMag(Convert.ToDouble(IDC_EDIT_MINMAG.Text));        }        /// <summary>        /// 保存图像扫描参数        /// </summary>        public void SaveImageScanPrm()        {            //  保存图像扫描参数");            //测量终止方式            m_cotsimgscanprm.SetStopMode(tB_StopMode.Text);            //终止时间            m_cotsimgscanprm.SetStopParamMeasTime(StopModeDialog.TimeMode);            ////终止帧图数            m_cotsimgscanprm.SetStopParamFields(StopModeDialog.FieldMode);            ////终止夹杂物数            m_cotsimgscanprm.SetStopParamParticles(StopModeDialog.ParticleMode);            ////终止面积            m_cotsimgscanprm.SetStopParamArea(StopModeDialog.AreaMode);            //取图方式            ComboBoxItem enum_fetchimgmode = (ComboBoxItem)IDC_COMBO_FETCHIMGMODE.SelectedItem;            m_cotsimgscanprm.SetStartImageMode((otsdataconst.OTS_GET_IMAGE_MODE)Convert.ToInt32(enum_fetchimgmode.Value));            //扫描图精度            ComboBoxItem enum_imgscanspeed = (ComboBoxItem)IDC_COMBO_IMGSCANSPEED.SelectedItem;            m_cotsimgscanprm.SetScanImageSpeed((otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)Convert.ToInt32(enum_imgscanspeed.Value));            //扫描图尺寸            ComboBoxItem enum_imgsize = (ComboBoxItem)IDC_COMBO_IMGSIZE.SelectedItem;            m_cotsimgscanprm.SetImageResulotion((otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS)Convert.ToInt32(enum_imgsize.Value));                  }        /// <summary>        /// 保存一般常规参数        /// </summary>        public void SaveCGenParam()        {            //样品名            m_cgenparam.SetSampleName(IDC_EDIT_SAMPLENAME.Text);            //执行开关            m_cgenparam.SetMeasurementSwitch(IDC_MEAS_SWITCH.Checked);            //是否使用系统库            m_cgenparam.SetSysSTD(IDC_SYS_LIB.Checked);            //获取精炼工艺索引            ComboBoxItem cbiTECH = new ComboBoxItem();            cbiTECH = (ComboBoxItem)IDC_COMBO_TECHNOLOGY.SelectedItem;            //设置参数文件类中精炼工艺索引值            m_cgenparam.SetSteelTechnology((int)cbiTECH.Value);            //测量区域形状            ComboBoxItem enum_Shape = (ComboBoxItem)cBMeasShape.SelectedItem;            m_cgenparam.SetShape((otsdataconst.DOMAIN_SHAPE)Convert.ToInt32(enum_Shape.Value));            //测量区域大小            m_cgenparam.SetArea(Convert.ToDouble(tBMeasArea.Text));            //标准库选择            ComboBoxItem enum_STDLIBSELECT = (ComboBoxItem)IDC_COMBO_STDSelect.SelectedItem;            m_cgenparam.SetSTDSelect(enum_STDLIBSELECT.Text.ToString());        }        /// <summary>        /// 保存图像处理参数        /// </summary>        public void SaveImageProc()        {            //颗粒面积范围 最小 最大            CDoubleRange crc_partareamin = new CDoubleRange(Math.Round(Convert.ToDouble(IDC_EDIT_PARTAREAMIN.Text), 2), Math.Round(Convert.ToDouble(IDC_EDIT_PARTAREAMAX.Text), 2));            m_cotsimgprocprm.SetIncAreaRange(crc_partareamin);            //背景灰度范围 最小  最大            CIntRange crc_backmin = new CIntRange(Convert.ToInt32(IDC_EDIT_BACKMIN.Text), Convert.ToInt32(IDC_EDIT_BACKMAX.Text));            m_cotsimgprocprm.SetBGGray(crc_backmin);            //颗粒灰度范围 最小  最大            CIntRange crc_partmin = new CIntRange(Convert.ToInt32(IDC_EDIT_PARTMIN.Text), Convert.ToInt32(IDC_EDIT_PARTMAX.Text));            m_cotsimgprocprm.SetParticleGray(crc_partmin);            //去背景方式            ComboBoxItem enum_BGREMOVETYPE = (ComboBoxItem)IDC_COMBO_BGREMOVETYPE.SelectedItem;            m_cotsimgprocprm.SetBGRemoveType((otsdataconst.OTS_BGREMOVE_TYPE)enum_BGREMOVETYPE.Value);            //去背景方式            ComboBoxItem enum_AUTOBGREMOVETYP = (ComboBoxItem)IDC_COMBO_AUTOBGREMOVETYP.SelectedItem;            m_cotsimgprocprm.SetAutoBGRemoveType((otsdataconst.OTS_AUTOBGREMOVE_TYPE)enum_AUTOBGREMOVETYP.Value);            //重叠像素            m_cotsimgprocprm.SetOverlapParam(Convert.ToInt32(IDC_EDIT_Overlap.Text));            if (IDC_EDIT_OTHERSELECTION.Text != "NoFilter")            {                m_cotsimgprocprm.SetParticleSelectCondition(IDC_EDIT_OTHERSELECTION.Text);            }            else            {                m_cotsimgprocprm.SetParticleSelectCondition("");            }        }        /// <summary>        /// 保存X-Ray参数        /// </summary>        public void SaveXRayParam()        {                       //X-ray扫描方式            ComboBoxItem enum_xrayscanmode = (ComboBoxItem)IDC_COMBO_XRAYSCANMODE.SelectedItem;            m_cotsxrayprm.SetScanMode((otsdataconst.OTS_X_RAY_SCAN_MODE)Convert.ToInt32(enum_xrayscanmode.Value));            //是否使用X-ray            m_cotsxrayprm.SetUsingXray(IDC_USINGXRAY_LIB.Checked);                  //分析X-ray精度对应的时间            m_cotsxrayprm.SetMidAnalyAQTime(Convert.ToInt32(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()));            //分析X-ray计数期望值            m_cotsxrayprm.SetAnalyExpCount(Convert.ToInt32(IDC_EDIT_ANALYXRAYAIMVALUE.Text));            m_cotsxrayprm.SetFeatureModeMinSize(Convert.ToDouble(IDC_EDIT_QuantifyMinSize.Text));            m_cotsxrayprm.SetSmallPartXrayTime(Convert.ToInt32(IDC_EDIT_SmallPartAQTime.Text));            m_cotsxrayprm.SetXrayLimit(Convert.ToInt32(IDC_EDIT_XrayLimit.Text));             m_cotsxrayprm.IfAutoId=radioButton1.Checked ;            m_cotsxrayprm.AnalysisElements=tb_xsys.Text ;        }        /// <summary>        /// 将参数保存到文件        /// </summary>        /// <param name="a_nPackId"></param>        /// <param name="a_pStageData"></param>        /// <param name="a_pGenParam"></param>        /// <param name="a_pImageScanParam"></param>        /// <param name="a_pImageProcParam"></param>        /// <param name="a_pXRayParam"></param>        /// <returns></returns>        public bool SaveInfoToProgMgrFile()        {            //SaveInfoToProgMgrFile()            if (false == m_cotsprogmgrparamfile.SaveInfoToProgMgrFile())            {                log.Error("(OTSProgMgrInfoFun.SaveInfoToProgMgrFile)  Failed to save parameters to file");                return false;            }            return true;        }        /// <summary>        /// 加载参数各个类        /// </summary>        public bool LoadParamFun()        {            bool result = m_cotsprogmgrparamfile.LoadInfoFromProgMgrFile();            if (!result)            {                log.Error("(OTSProgMgrInfoFun.LoadParamFun)  LoadInfoFromProgMgrFile Failed");                return false;            }            m_csemstagedata = m_cotsprogmgrparamfile.GetStageDataParam();            if (null == m_csemstagedata)            {                log.Error("(OTSProgMgrInfoFun.LoadParamFun)  GetStageData Failed");                return false;            }            m_cotsimgscanprm = m_cotsprogmgrparamfile.GetImageScanParam();            if (null == m_cotsimgscanprm)            {                log.Error("(OTSProgMgrInfoFun.LoadParamFun)  GetImageScanParam Failed");                return false;            }            m_cgenparam = m_cotsprogmgrparamfile.GetGenParam();            if (null == m_cgenparam)            {                log.Error("(OTSProgMgrInfoFun.LoadParamFun)  GetGenParam Failed");                return false;            }            m_cotsimgprocprm = m_cotsprogmgrparamfile.GetImageProcParam();            if (null == m_cotsimgprocprm)            {                log.Error("(OTSProgMgrInfoFun.LoadParamFun)  GetImageProcParam Failed");                return false;            }            m_cotsxrayprm = m_cotsprogmgrparamfile.GetXRayParam();            if (null == m_cotsxrayprm)            {                log.Error("(OTSProgMgrInfoFun.LoadParamFun)  GetXRayParam Failed");                return false;            }            return true;        }        #endregion               #region 窗体加载        private void ProgMgrInfoForm_Load(object sender, EventArgs e)        {            //加载各参数类            LoadParamFun();            //初始化combobox下拉框列表            BindComboBox();            //加载相关参数信息            LoadDefaultParam();            LoadSEMStageData();            LoadImageScanPrm();            LoadCGenParam();            LoadImageProc();            LoadXRayParam();            if (m_b_checkstagefile == false)                btnok.Enabled = true;            else                btnok.Enabled = false;                                if(m_cotsprogmgrparamfile.GetSysTypeName() == "IncA")            {                label42.Visible = true;                IDC_COMBO_TECHNOLOGY.Visible = true;            }            else            {                label42.Visible = false;                IDC_COMBO_TECHNOLOGY.Visible = false;            }        }        #endregion        #region 各按钮控件点击事件        private void IDC_BUTTON_KLFX_Click(object sender, EventArgs e)        {            try            {                if (IDC_COMBO_STDSelect.Text != "NoSTDDB")                {                    Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", Application.StartupPath + "\\Config\\SysData\\" + IDC_COMBO_STDSelect.Text+".db");                    p.WaitForExit();                }                else                {                    string message = table["message55"].ToString();                    MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                }            }            catch (Exception ex)            {                log.Error("OTSPartA_STDEditor:" + ex.ToString());            }        }        /// <summary>        /// 弹出样品台管理窗体        /// </summary>        /// <param name="a_nPackId"></param>        /// <param name="a_pStageFile"></param>        /// <returns></returns>        public void ShowStageDialogExport()        {                 DlgStageMgr dlgStageMgr = new DlgStageMgr(m_cstagefile);             dlgStageMgr.ShowDialog();            return;        }        /// <summary>        /// 保存样品台信息        /// </summary>        /// <returns></returns>        public bool CStageFileClrSave()        {            if (m_cstagefile == null)            {                //报错                log.Error("(OTSProgMgrInfoFun.CStageFileClrSave) Error saving sample station information!");            }            else            {                bool b_ret = m_cstagefile.Save();                if (false == b_ret)                {                    log.Error("(OTSProgMgrInfoFun.CStageFileClrSave) Error saving sample table information!");                }            }            return false;        }        private void IDC_BUTTON_STAGE_Click(object sender, EventArgs e)        {                        //弹出管理样品台管理窗体            ShowStageDialogExport();            //弹出后再保存样品台信息            CStageFileClrSave();            //刷新绑定样品台列表            BindStageCombobox();            //检测是否已经有修改            ThisSetIsModify();        }        /// <summary>        /// 判断各控件值是否正确        /// </summary>        /// <returns></returns>        private bool CheckSetupValues(int bz)        {            if ("" == IDC_COMBO_STAGE.Text)            {                string message = table["message1"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_COMBO_STAGE.Focus();                IDC_COMBO_STAGE.SelectAll();                return false;            }            if ("" == IDC_EDIT_SCREENWIDTH.Text)            {                string message = table["message2"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_SCREENWIDTH.Focus();                IDC_EDIT_SCREENWIDTH.SelectAll();                return false;            }            if ("" == IDC_COMBO_XDIREC.Text)            {                string message = table["message3"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_COMBO_XDIREC.Focus();                IDC_COMBO_XDIREC.SelectAll();                return false;            }            if ("" == IDC_EDIT_XSTART.Text)            {                string message = table["message4"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_XSTART.Focus();                IDC_EDIT_XSTART.SelectAll();                return false;            }            if ("" == IDC_EDIT_XEND.Text)            {                string message = table["message4"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_XEND.Focus();                IDC_EDIT_XEND.SelectAll();                return false;            }            if ("" == IDC_COMBO_YDIRECT.Text)            {                string message = table["message5"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_COMBO_YDIRECT.Focus();                IDC_COMBO_YDIRECT.SelectAll();                return false;            }            if ("" == IDC_EDIT_YSTART.Text)            {                string message = table["message6"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_YSTART.Focus();                IDC_EDIT_YSTART.SelectAll();                return false;            }            if ("" == IDC_EDIT_YEND.Text)            {                string message = table["message6"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_YEND.Focus();                IDC_EDIT_YEND.SelectAll();                return false;            }            if ("" == tB_StopMode.Text)            {                string message = table["message7"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                //IDC_EDIT_STOP_TIME.Focus();                //IDC_EDIT_STOP_TIME.SelectAll();                return false;            }            if ("" == IDC_COMBO_FETCHIMGMODE.Text)            {                string message = table["message10"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_COMBO_FETCHIMGMODE.Focus();                IDC_COMBO_FETCHIMGMODE.SelectAll();                return false;            }            if ("" == IDC_COMBO_IMGSCANSPEED.Text)            {                string message = table["message11"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_COMBO_IMGSCANSPEED.Focus();                IDC_COMBO_IMGSCANSPEED.SelectAll();                return false;            }            if ("" == IDC_COMBO_IMGSIZE.Text)            {                string message = table["message12"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_COMBO_IMGSIZE.Focus();                IDC_COMBO_IMGSIZE.SelectAll();                return false;            }            if ("" == IDC_EDIT_MINMAG.Text)            {                string message = table["message13"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_MINMAG.Focus();                IDC_EDIT_MINMAG.SelectAll();                return false;            }            if ("" == IDC_EDIT_PARTAREAMIN.Text)            {                string message = table["message14"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_PARTAREAMIN.Focus();                IDC_EDIT_PARTAREAMIN.SelectAll();                return false;            }            if ("" == IDC_EDIT_PARTAREAMAX.Text)            {                string message = table["message15"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_PARTAREAMAX.Focus();                IDC_EDIT_PARTAREAMAX.SelectAll();                return false;            }            if ("" == IDC_EDIT_BACKMIN.Text)            {                string message = table["message16"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_BACKMIN.Focus();                IDC_EDIT_BACKMIN.SelectAll();                return false;            }            if ("" == IDC_EDIT_BACKMAX.Text)            {                string message = table["message17"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_BACKMAX.Focus();                IDC_EDIT_BACKMAX.SelectAll();                return false;            }            if ("" == IDC_EDIT_PARTMIN.Text)            {                string message = table["message18"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_PARTMIN.Focus();                IDC_EDIT_PARTMIN.SelectAll();                return false;            }            if ("" == IDC_EDIT_PARTMAX.Text)            {                string message = table["message19"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_PARTMAX.Focus();                IDC_EDIT_PARTMAX.SelectAll();                return false;            }            if ("" == IDC_COMBO_XRAYSCANMODE.Text)            {                string message = table["message20"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_COMBO_XRAYSCANMODE.Focus();                IDC_COMBO_XRAYSCANMODE.SelectAll();                return false;            }                      if ("" == IDC_EDIT_ANALYXRAYAIMVALUE.Text)            {                string message = table["message22"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                IDC_EDIT_ANALYXRAYAIMVALUE.Focus();                IDC_EDIT_ANALYXRAYAIMVALUE.SelectAll();                return false;            }            if ("" == tBMeasArea.Text)            {                string message = table["message62"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                tBMeasArea.Focus();                tBMeasArea.SelectAll();                return false;            }                 //string pat = @"^(-|\+)?\d{1,8}$";//只能输入1到3位的正负整数            string pat = @"^-?[0-9]\d*$";//只能限定正负整数,包含0            string scope = @"^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$";            string PositiveDecimals = @"^(([1-9]\d*)(\.\d+)?)$|^0\.\d*[1-9]$";  //正浮点数            string positiveInteger = @"^?[0-9]\d*$";//只能限定正整数,包含0            string positiveOddNumber = @"[^1,3,5,7,9]";//只能限定正奇数            Regex rg = new Regex(pat);            Regex rgScope = new Regex(scope);            Regex rgPositiveDecimals = new Regex(PositiveDecimals);            Regex rgpositiveInteger = new Regex(positiveInteger);            Regex rgpositiveOddNumber = new Regex(positiveOddNumber);                    //100倍时屏幕尺寸            if (false == rg.Match(IDC_EDIT_SCREENWIDTH.Text.Trim()).Success)            {                IDC_EDIT_SCREENWIDTH.Focus();                IDC_EDIT_SCREENWIDTH.SelectAll();                string message = table["message23"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //x轴行程/mm 起            if (false == rg.Match(IDC_EDIT_XSTART.Text.Trim()).Success)            {                IDC_EDIT_XSTART.Focus();                IDC_EDIT_XSTART.SelectAll();                string message = table["message24"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //x轴行程/mm 止            if (false == rg.Match(IDC_EDIT_XEND.Text.Trim()).Success)            {                IDC_EDIT_XEND.Focus();                IDC_EDIT_XEND.SelectAll();                string message = table["message25"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //y轴行程/mm 起            if (false == rg.Match(IDC_EDIT_YSTART.Text.Trim()).Success)            {                IDC_EDIT_YSTART.Focus();                IDC_EDIT_YSTART.SelectAll();                string message = table["message26"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //y轴行程/mm 止            if (false == rg.Match(IDC_EDIT_YEND.Text.Trim()).Success)            {                IDC_EDIT_YEND.Focus();                IDC_EDIT_YEND.SelectAll();                string message = table["message27"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //颗粒面积范围 最小            if (false == rgPositiveDecimals.Match(IDC_EDIT_PARTAREAMIN.Text.Trim()).Success)            {                IDC_EDIT_PARTAREAMIN.Focus();                IDC_EDIT_PARTAREAMIN.SelectAll();                string message = table["message31"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //颗粒面积范围 最大            if (false == rgPositiveDecimals.Match(IDC_EDIT_PARTAREAMAX.Text.Trim()).Success)            {                IDC_EDIT_PARTAREAMAX.Focus();                IDC_EDIT_PARTAREAMAX.SelectAll();                string message = table["message32"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //背景灰度范围 最小            if (false == rg.Match(IDC_EDIT_BACKMIN.Text.Trim()).Success)            {                IDC_EDIT_BACKMIN.Focus();                IDC_EDIT_BACKMIN.SelectAll();                string message = table["message33"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            else            {                if (false == rgScope.Match(IDC_EDIT_BACKMIN.Text.Trim()).Success)                {                    IDC_EDIT_BACKMIN.Focus();                    IDC_EDIT_BACKMIN.SelectAll();                    string message = table["message34"].ToString();                    MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                    return false;                }            }            //背景灰度范围 最大            if (false == rg.Match(IDC_EDIT_BACKMAX.Text.Trim()).Success)            {                IDC_EDIT_BACKMAX.Focus();                IDC_EDIT_BACKMAX.SelectAll();                string message = table["message35"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            else            {                if (false == rgScope.Match(IDC_EDIT_BACKMAX.Text.Trim()).Success)                {                    IDC_EDIT_BACKMAX.Focus();                    IDC_EDIT_BACKMAX.SelectAll();                    string message = table["message36"].ToString();                    MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                    return false;                }            }            //颗粒灰度范围 最小            if (false == rg.Match(IDC_EDIT_PARTMIN.Text.Trim()).Success)            {                IDC_EDIT_PARTMIN.Focus();                IDC_EDIT_PARTMIN.SelectAll();                string message = table["message37"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            else            {                if (false == rgScope.Match(IDC_EDIT_PARTMIN.Text.Trim()).Success)                {                    IDC_EDIT_PARTMIN.Focus();                    IDC_EDIT_PARTMIN.SelectAll();                    string message = table["message38"].ToString();                    MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                    return false;                }            }            //颗粒灰度范围 最大            if (false == rg.Match(IDC_EDIT_PARTMAX.Text.Trim()).Success)            {                IDC_EDIT_PARTMAX.Focus();                IDC_EDIT_PARTMAX.SelectAll();                string message = table["message39"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            else            {                if (false == rgScope.Match(IDC_EDIT_PARTMAX.Text.Trim()).Success)                {                    IDC_EDIT_PARTMAX.Focus();                    IDC_EDIT_PARTMAX.SelectAll();                    string message = table["message40"].ToString();                    MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                    return false;                }            }            //分析X-ray计数期望值 最大            if (false == rg.Match(IDC_EDIT_ANALYXRAYAIMVALUE.Text.Trim()).Success)            {                IDC_EDIT_ANALYXRAYAIMVALUE.Focus();                IDC_EDIT_ANALYXRAYAIMVALUE.SelectAll();                string message = table["message41"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //分析X-ray精度对应的时间            if (false == rg.Match(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()).Success)            {                IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Focus();                IDC_TEXTBOX_ANALYXRAYSPEED_TIME.SelectAll();                string message = table["message42"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }                                         pat = @"^[0-9]+(\.[0-9]{1,3})?$";  //只能输入,1到3位小数的正数            rg = new Regex(pat);            //最小放大倍数            if (false == rg.Match(IDC_EDIT_MINMAG.Text.Trim()).Success)            {                IDC_EDIT_MINMAG.Focus();                IDC_EDIT_MINMAG.SelectAll();                string message = table["message43"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }                   //再限制,x轴,y轴,的起止的,输入长度,因为现在已经有在mm和um之间的转换,所以这里要限制一下            //x轴行程/mm 起            if (IDC_EDIT_XSTART.Text.Length > 4)            {                IDC_EDIT_XSTART.Focus();                IDC_EDIT_XSTART.SelectAll();                string message = table["message44"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //x轴行程/mm 止            if (IDC_EDIT_XEND.Text.Length > 4)            {                IDC_EDIT_XEND.Focus();                IDC_EDIT_XEND.SelectAll();                string message = table["message45"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //y轴行程/mm 起            if (IDC_EDIT_YSTART.Text.Length > 4)            {                IDC_EDIT_YSTART.Focus();                IDC_EDIT_YSTART.SelectAll();                string message = table["message46"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //y轴行程/mm 止            if (IDC_EDIT_YEND.Text.Length > 4)            {                IDC_EDIT_YEND.Focus();                IDC_EDIT_YEND.SelectAll();                string message = table["message47"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            if (Convert.ToInt32(IDC_EDIT_XSTART.Text.Trim()) > Convert.ToInt32(IDC_EDIT_XEND.Text.Trim()))            {                IDC_EDIT_XEND.Focus();                IDC_EDIT_XEND.SelectAll();                string message = table["message50"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            if (Convert.ToInt32(IDC_EDIT_YSTART.Text.Trim()) > Convert.ToInt32(IDC_EDIT_YEND.Text.Trim()))            {                IDC_EDIT_YEND.Focus();                IDC_EDIT_YEND.SelectAll();                string message = table["message53"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //颗粒尺寸范围            if (Convert.ToDouble(IDC_EDIT_PARTAREAMIN.Text.Trim()) > Convert.ToDouble(IDC_EDIT_PARTAREAMAX.Text.Trim()))            {                IDC_EDIT_PARTAREAMIN.Focus();                IDC_EDIT_PARTAREAMIN.SelectAll();                string message = table["message56"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //背景灰度范围            if (Convert.ToInt32(IDC_EDIT_BACKMIN.Text.Trim()) > Convert.ToInt32(IDC_EDIT_BACKMAX.Text.Trim()))            {                IDC_EDIT_BACKMIN.Focus();                IDC_EDIT_BACKMIN.SelectAll();                string message = table["message57"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //颗粒灰度范围            if (Convert.ToInt32(IDC_EDIT_PARTMIN.Text.Trim()) > Convert.ToInt32(IDC_EDIT_PARTMAX.Text.Trim()))            {                IDC_EDIT_PARTMIN.Focus();                IDC_EDIT_PARTMIN.SelectAll();                string message = table["message58"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            //最小放大倍数            if (false == rgpositiveInteger.Match(IDC_EDIT_XrayLimit.Text.Trim()).Success)            {                IDC_EDIT_XrayLimit.Focus();                IDC_EDIT_XrayLimit.SelectAll();                string message = table["message64"].ToString();                MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);                return false;            }            return true;        }        /// <summary>        /// 判断当前样品台是否在被修改        /// </summary>        /// <returns></returns>        public bool IsModified()        {            return m_cstagefile.IsModified();        }        /// <summary>        /// 样品台保存        /// </summary>        /// <returns></returns>        public bool StageSave()        {            if (!m_cstagefile.Save())            {                log.Error("(OTSProgMgrInfoFun.StageLoad)  Failed to save sample station information!");                return false;            }            return true;        }        private void btnok_Click(object sender, EventArgs e)        {            //先判断            if (false == CheckSetupValues(1))            {                return;            }            //先把各个值都保存到各类            m_cotsprogmgrparamfile.m_runmode = (RunMode)IDC_COMBO_Model.SelectedIndex;             SaveSEMStageData();            SaveImageScanPrm();            SaveCGenParam();            SaveImageProc();            SaveXRayParam();            //然后再把各类传入到SaveInfoToProgMgrFile函数中            if (false == SaveInfoToProgMgrFile())            {                return;            }            //保存样品台到文件,在被修改时进行保存            if (true == IsModified())            {                if (true == StageSave())                {                    this.DialogResult = DialogResult.OK;                    this.Close();                    return;                }                else                {                    string message = table["message54"].ToString();                    log.Error("(ProgMgrInfoForm.btnok_Click) " + message);                    this.Close();                    return;                }            }        }        //关闭窗体        private void btncancel_Click(object sender, EventArgs e)        {            this.Close();        }        #endregion        #region 选择样品台事件        private void IDC_COMBO_STAGE_SelectedIndexChanged(object sender, EventArgs e)        {            //样品台            if (!StageLoad())            {                this.Close();                return;//加载失败返回            }            ThisSetIsModify();                   }        /// <summary>        /// 通过id设置当前正在工作的样品台        /// </summary>        /// <param name="id"></param>        public void SetWorkingStageId(int id)        {            m_cstagefile.SetWorkingStageId(id);        }        /// <summary>        /// 设置当前样品台正在被修改中        /// </summary>        /// <param name="yn"></param>        public void SetModify(bool yn)        {            m_cstagefile.SetModify(true);        }        /// <summary>        /// 设置当前窗体可以保存了        /// </summary>        private void ThisSetIsModify()        {            ComboBoxItem cbi = new ComboBoxItem();            if (IDC_COMBO_STAGE.Items.Count > 0)                if (null != IDC_COMBO_STAGE.SelectedItem)                {                    cbi = (ComboBoxItem)IDC_COMBO_STAGE.SelectedItem;                    SetWorkingStageId(Convert.ToInt32(cbi.Value));                    SetModify(true);                    btnok.Enabled = true;                }        }        #endregion        #region 监视控件改变状态事件        private void IDC_EDIT_SCREENWIDTH_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_XDIREC_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_XSTART_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_XEND_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_YDIRECT_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_YSTART_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_YEND_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_MINMAG_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_STOPMODE_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_STOP_TIME_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_STOP_FIELD_NUM_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_STOP_INCA_NUM_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_IMGSIZE_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_SAMPLENAME_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_MEAS_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_MEASUREPARAMPATH_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_ANALYSESTDLIBPATH_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_STDLIBNAME_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_PARTAREAMIN_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_PARTAREAMAX_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_BACKMIN_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_BACKMAX_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_PARTMIN_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_PARTMAX_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged(object sender, EventArgs e)        {            ComboBox cbBGREMOVETYPE = (ComboBox)sender;            int selectValue=Convert.ToInt32(((OTSMeasureApp.ComboBoxItem)cbBGREMOVETYPE.Items[cbBGREMOVETYPE.SelectedIndex]).Value);            if (selectValue == (int)otsdataconst.OTS_AUTOBGREMOVETYPE.MANUAL)            {                IDC_COMBO_AUTOBGREMOVETYP.Enabled = false;            }            else            {                IDC_COMBO_AUTOBGREMOVETYP.Enabled = true;            }            ThisSetIsModify();        }        private void IDC_COMBO_SEARCHXRAYSPEED_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_SEARCHXRAYCOUNTLIMIT_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_ANALYXRAYSPEED_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_EDIT_ANALYXRAYAIMVALUE_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_TECHNOLOGY_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_STOP_MODE_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_STOP_TIME_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_STOP_FIELD_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_STOP_PARTICAL_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_FETCH_IMAGE_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_SCAN_SPEED_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_IMAGE_SIZE_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_PART_MIN_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_PART_MAX_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_BACK_MIN_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_BACK_MAX_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_PART_GRAY_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_PART_GRAY_MAX_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_XRAY_MODE_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_XRAY_TIME_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_XRAY_COUNT_SWITCH_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void cBMeasShape_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void tBMeasArea_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_SYS_LIB_CheckedChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        #endregion        private void IDC_COMBO_STDSelect_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_USINGXRAYS_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void IDC_COMBO_Model_SelectedIndexChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void btn_StopMode_Click(object sender, EventArgs e)        {            if (StopModeDialog == null)            {                StopModeDialog = new frmMeasureStopMode();                StopModeDialog.FieldMode = m_cotsimgscanprm.GetStopParamFields();                StopModeDialog.TimeMode = m_cotsimgscanprm.GetStopParamMeasTime();                StopModeDialog.ParticleMode = m_cotsimgscanprm.GetStopParamParticles();                StopModeDialog.AreaMode = m_cotsimgscanprm.GetStopParamArea();                StopModeDialog.StopMode = tB_StopMode.Text;            }            DialogResult result = StopModeDialog.ShowDialog();            if (result == DialogResult.OK)            {                string[] rst = StopModeDialog.StopMode.Split(',');                string str = "";                for (int k = 0; k < rst.Length; k++)                {                    str += rst[k].Split(':')[0] + " + ";                }                tB_StopMode.Text = str.Substring(0, str.Length - 3);                }        }        private void IDC_COMBO_CorrosionExpansionCoefficient_TextChanged(object sender, EventArgs e)        {            ThisSetIsModify();        }        private void button_SpPart_Click(object sender, EventArgs e)        {                }        private void checkBox_Run_CheckedChanged(object sender, EventArgs e)        {          }        private void btn_otherselection_Click(object sender, EventArgs e)        {            if (otherSelectionForm == null)            {                otherSelectionForm = new _7_OTSProgMgrInfo.OtherSelectionForm();                otherSelectionForm.OtherSelection = m_cotsimgprocprm.GetParticleSelectCondition();            }            DialogResult result = otherSelectionForm.ShowDialog();            if (result == DialogResult.OK)            {                m_cotsimgprocprm.SetParticleSelectCondition(otherSelectionForm.OtherSelection);                if (otherSelectionForm.OtherSelection == "")                {                    IDC_EDIT_OTHERSELECTION.Text = "NoFilter";                }                else                {                    IDC_EDIT_OTHERSELECTION.Text = otherSelectionForm.OtherSelection;                }            }        }        private void radioButton1_CheckedChanged(object sender, EventArgs e)        {            if (radioButton1.Checked)            {                elementchoose.Enabled = false;            }                   }        int ReturnsAtomicNumberByElementName(string ElementName)        {            switch (ElementName)            {                case "H": return 1;                case "He": return 2;                case "Li": return 3;                case "Be": return 4;                case "B": return 5;                case "C": return 6;                case "N": return 7;                case "O": return 8;                case "F": return 9;                case "Ne": return 10;                case "Na": return 11;                case "Mg": return 12;                case "Al": return 13;                case "Si": return 14;                case "P": return 15;                case "S": return 16;                case "Cl": return 17;                case "Ar": return 18;                case "K": return 19;                case "Ca": return 20;                case "Sc": return 21;                case "Ti": return 22;                case "V": return 23;                case "Cr": return 24;                case "Mn": return 25;                case "Fe": return 26;                case "Co": return 27;                case "Ni": return 28;                case "Cu": return 29;                case "Zn": return 30;                case "Ga": return 31;                case "Ge": return 32;                case "As": return 33;                case "Se": return 34;                case "Br": return 35;                case "Kr": return 36;                case "Rb": return 37;                case "Sr": return 38;                case "Y": return 39;                case "Zr": return 40;                case "Nb": return 41;                case "Mo": return 42;                case "Tc": return 43;                case "Ru": return 44;                case "Rh": return 45;                case "Pd": return 46;                case "Ag": return 47;                case "Cd": return 48;                case "In": return 49;                case "Sn": return 50;                case "Sb": return 51;                case "Te": return 52;                case "I": return 53;                case "Xe": return 54;                case "Cs": return 55;                case "Ba": return 56;                case "La": return 57;                case "Ce": return 58;                case "Pr": return 59;                case "Nd": return 60;                case "Pm": return 61;                case "Sm": return 62;                case "Eu": return 63;                case "Gd": return 64;                case "Tb": return 65;                case "Dy": return 66;                case "Ho": return 67;                case "Er": return 68;                case "Tm": return 69;                case "Yb": return 70;                case "Lu": return 71;                case "Hf": return 72;                case "Ta": return 73;                case "W": return 74;                case "Re": return 75;                case "Os": return 76;                case "Ir": return 77;                case "Pt": return 78;                case "Au": return 79;                case "Hq": return 80;                case "TI": return 81;                case "Pb": return 82;                case "Bi": return 83;                case "Po": return 84;                case "At": return 85;                case "Rn": return 86;                case "Fr": return 87;                case "Ra": return 88;                case "Ac": return 89;                case "Th": return 90;                case "Pa": return 91;                case "U": return 92;                case "Np": return 93;                case "Pu": return 94;                case "Am": return 95;                case "Cm": return 96;                case "Bk": return 97;                case "Cf": return 98;                case "Es": return 99;                case "Fm": return 100;                case "Mc": return 101;                case "No": return 102;                case "Lr": return 103;                case "Rf": return 104;                case "Db": return 105;                case "Sg": return 106;                case "Bh": return 107;                case "Hs": return 108;                case "Mt": return 109;                case "Ds": return 110;                case "Rg": return 111;                case "Unb": return 112;                default: return 1000;            }        }        private void button1_Click(object sender, EventArgs e)        {            OTSPeriodicTable.OTSPeriodicTableForm_Small opts = new OTSPeriodicTable.OTSPeriodicTableForm_Small();            //获取需要显示的元素列表,并转换成元素周期表窗体可接受的格式,传入----------------------            string str_xsys = tb_xsys.Text.Trim();            List<string> list_str = new List<string>();            string[] strs = str_xsys.Split(',');            for (int i = 0; i < strs.Length; i++)            {                list_str.Add(strs[i]);            }            //清除元素周期表中所有的记录            opts.m_List_Periodic.Clear();            //将该分类下的元素添加到元素周期表窗体的List_periodic中            for (int i = 0; i < strs.Length; i++)            {                string str_ysm = strs[i];                Periodic ls_periodic = new Periodic();                ls_periodic = CListPeriodic.GetPeriodicByEleName(str_ysm);                opts.m_List_Periodic.Add(ls_periodic);            }            //----------------------------------------------------------------------------------------            opts.StartPosition = FormStartPosition.CenterScreen;            opts.ShowDialog();            List<string> PeriodicFH = new List<string>();            for (int j = 0; j < opts.m_List_Periodic.Count; j++)            {                PeriodicFH.Add(opts.m_List_Periodic[j].Symbol);            }            PeriodicFH.Sort(delegate (string a, string b) { return ReturnsAtomicNumberByElementName(a).CompareTo(ReturnsAtomicNumberByElementName(b)); });//排序 从小到大原子序数            list_str = list_str.FindAll(delegate (string a) { return PeriodicFH.Contains(a); });            PeriodicFH = PeriodicFH.FindAll(delegate (string a) { return !list_str.Contains(a); });            //先清空元素            str_xsys = "";            //然后再将选择的元素,组合起来,返回显示到该窗体上            for (int i = 0; i < list_str.Count; i++)            {                if (str_xsys == "")                {                    str_xsys = list_str[i];                }                else                {                    str_xsys = str_xsys + "," + list_str[i];                }            }            for (int i = 0; i < PeriodicFH.Count; i++)            {                if (str_xsys == "")                {                    str_xsys = PeriodicFH[i];                }                else                {                    str_xsys = str_xsys + "," + PeriodicFH[i];                }            }            //再对选择的元素进行显示            tb_xsys.Text = str_xsys;        }        private void radioButton2_CheckedChanged(object sender, EventArgs e)        {            if (radioButton2.Checked)            {                elementchoose.Enabled = true;            }        }    }    public class ComboBoxItem    {        private string _text = null;        private object _value = null;        public string Text { get { return this._text; } set { this._text = value; } }        public object Value { get { return this._value; } set { this._value = value; } }        public override string ToString()        {            return this._text;        }    }}
 |