ProgMgrInfoForm.cs 80 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using System.Text.RegularExpressions;
  6. using System.Collections;
  7. using System.Diagnostics;
  8. using OTSDataType;
  9. using OTSModelSharp;
  10. using System.IO;
  11. using static OTSModelSharp.ResourceManage.ResourceData;
  12. using static OTSDataType.otsdataconst;
  13. using OTSModelSharp.Measure.GetStageInfo;
  14. using OTSMeasureApp._3_OTSDisplaySourceGridData;
  15. using OTSPeriodicTable;
  16. namespace OTSMeasureApp
  17. {
  18. public partial class ProgMgrInfoForm :Form
  19. {
  20. #region 定义变量
  21. //初始化函数功能类
  22. public CStage m_cstage; //样品台类
  23. public CStageParam m_cstagefile; //样品台文件类
  24. public COTSDefaultParam m_cotsprogmgrparamfile; //参数类
  25. public CSEMStageData m_csemstagedata; //SEM样品台处理类
  26. public COTSImgScanPrm m_cotsimgscanprm; //图像扫描类
  27. public COTSGeneralParam m_cgenparam; //一般参数类
  28. public COTSImageProcParam m_cotsimgprocprm; //图像处理类
  29. public COTSXRayParam m_cotsxrayprm;
  30. public bool m_b_checkstagefile = false;
  31. //定位程序管理路径用的变量
  32. public string m_ParameterPath;
  33. frmMeasureStopMode StopModeDialog;
  34. _7_OTSProgMgrInfo.OtherSelectionForm otherSelectionForm;
  35. //国际化
  36. OTSCommon.Language lan;
  37. Hashtable table;
  38. NLog.Logger log ;
  39. #endregion
  40. /// <summary>
  41. /// 样品台加载
  42. /// </summary>
  43. /// <returns></returns>
  44. public bool StageLoad()
  45. {
  46. if (!m_cstagefile.Load( true, !m_b_checkstagefile))
  47. {
  48. log.Error("(OTSProgMgrInfoFun.StageLoad) 加载样品台信息失败");
  49. return false;
  50. }
  51. return true;
  52. }
  53. #region 构造函数
  54. /// <summary>
  55. /// 默认构造函数
  56. /// </summary>
  57. public ProgMgrInfoForm()
  58. {
  59. log = NLog.LogManager.GetCurrentClassLogger();
  60. m_cotsprogmgrparamfile = new COTSDefaultParam();
  61. m_cstagefile = new CStageParam();
  62. InitializeComponent();
  63. //国际化
  64. lan = new OTSCommon.Language(this);
  65. table = lan.GetNameTable(this.Name);
  66. }
  67. #endregion
  68. #region 绑定各combobox控件
  69. /// <summary>
  70. /// 绑定各combobox控件下拉列表
  71. /// </summary>
  72. public void BindComboBox()
  73. {
  74. //样品台
  75. if (!StageLoad())
  76. {
  77. this.Close();
  78. return;//加载失败返回
  79. }
  80. //绑定样品台列表信息
  81. BindStageCombobox();
  82. //初始化选项,下拉框---------------------------------------------
  83. //绑定标准库
  84. IDC_COMBO_STDSelect.Items.Clear();
  85. string STDLibFolderName = m_cgenparam.GetPartSTDLibFolderName();
  86. string[] files = System.IO.Directory.GetFiles(STDLibFolderName, "*.db");
  87. System.IO.DirectoryInfo folder = new System.IO.DirectoryInfo(STDLibFolderName);
  88. foreach (System.IO.FileInfo file in folder.GetFiles("*.db"))
  89. {
  90. ComboBoxItem cbi = new ComboBoxItem();
  91. string FileNameWithoutExtension = Path.GetFileNameWithoutExtension(file.FullName);
  92. cbi.Text = FileNameWithoutExtension;
  93. //cbi.Value = (int)enum_one;
  94. IDC_COMBO_STDSelect.Items.Add(cbi);
  95. }
  96. //添加下拉列表中null项
  97. ComboBoxItem cbiNull = new ComboBoxItem();
  98. cbiNull.Text = "NoSTDDB";
  99. //cbi.Value = (int)enum_one;
  100. IDC_COMBO_STDSelect.Items.Add(cbiNull);
  101. this.IDC_COMBO_STDSelect.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_STDSelect_SelectedIndexChanged);
  102. if (IDC_COMBO_STDSelect.Items.Count > 0)
  103. IDC_COMBO_STDSelect.SelectedIndex = 0;
  104. //----------------------------------------------------------------------
  105. this.IDC_COMBO_STDSelect.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_STDSelect_SelectedIndexChanged);
  106. //x轴方向
  107. IDC_COMBO_XDIREC.Items.Clear();
  108. foreach (otsdataconst.OTS_X_AXIS_DIRECTION enum_one in Enum.GetValues(typeof(otsdataconst.OTS_X_AXIS_DIRECTION)))
  109. {
  110. ComboBoxItem cbi = new ComboBoxItem();
  111. cbi.Text = GetXAxisDirectionIdString(enum_one);
  112. cbi.Value = (int)enum_one;
  113. IDC_COMBO_XDIREC.Items.Add(cbi);
  114. }
  115. this.IDC_COMBO_XDIREC.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_XDIREC_SelectedIndexChanged);
  116. if (IDC_COMBO_XDIREC.Items.Count > 0)
  117. IDC_COMBO_XDIREC.SelectedIndex = 0;
  118. this.IDC_COMBO_XDIREC.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_XDIREC_SelectedIndexChanged);
  119. //y轴方向
  120. IDC_COMBO_YDIRECT.Items.Clear();
  121. foreach (otsdataconst.OTS_Y_AXIS_DIRECTION enum_one in Enum.GetValues(typeof(otsdataconst.OTS_Y_AXIS_DIRECTION)))
  122. {
  123. ComboBoxItem cbi = new ComboBoxItem();
  124. cbi.Text = GetYAxisDirectionIdString(enum_one);
  125. cbi.Value = (int)enum_one;
  126. IDC_COMBO_YDIRECT.Items.Add(cbi);
  127. }
  128. this.IDC_COMBO_YDIRECT.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_YDIRECT_SelectedIndexChanged);
  129. if (IDC_COMBO_YDIRECT.Items.Count > 0)
  130. IDC_COMBO_YDIRECT.SelectedIndex = 0;
  131. this.IDC_COMBO_YDIRECT.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_YDIRECT_SelectedIndexChanged);
  132. //取图方式
  133. IDC_COMBO_FETCHIMGMODE.Items.Clear();
  134. foreach (otsdataconst.OTS_GET_IMAGE_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_GET_IMAGE_MODE)))
  135. {
  136. ComboBoxItem cbi = new ComboBoxItem();
  137. cbi.Text = GetGetImageIdString(enum_one);
  138. cbi.Value = (int)enum_one;
  139. IDC_COMBO_FETCHIMGMODE.Items.Add(cbi);
  140. }
  141. this.IDC_COMBO_FETCHIMGMODE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged);
  142. if (IDC_COMBO_FETCHIMGMODE.Items.Count > 0)
  143. IDC_COMBO_FETCHIMGMODE.SelectedIndex = 0;
  144. this.IDC_COMBO_FETCHIMGMODE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged);
  145. //扫描图精度
  146. IDC_COMBO_IMGSCANSPEED.Items.Clear();
  147. foreach (otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)))
  148. {
  149. ComboBoxItem cbi = new ComboBoxItem();
  150. cbi.Text = GetScanSpeedString(enum_one);
  151. cbi.Value = (int)enum_one;
  152. IDC_COMBO_IMGSCANSPEED.Items.Add(cbi);
  153. }
  154. this.IDC_COMBO_IMGSCANSPEED.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged);
  155. if (IDC_COMBO_IMGSCANSPEED.Items.Count > 0)
  156. IDC_COMBO_IMGSCANSPEED.SelectedIndex = 0;
  157. this.IDC_COMBO_IMGSCANSPEED.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged);
  158. //扫描图尺寸
  159. IDC_COMBO_IMGSIZE.Items.Clear();
  160. foreach (otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS)))
  161. {
  162. ComboBoxItem cbi = new ComboBoxItem();
  163. cbi.Text = GetImageSizeIdString(enum_one);
  164. cbi.Value = (int)enum_one;
  165. IDC_COMBO_IMGSIZE.Items.Add(cbi);
  166. }
  167. this.IDC_COMBO_IMGSIZE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_IMGSIZE_SelectedIndexChanged);
  168. if (IDC_COMBO_IMGSIZE.Items.Count > 0)
  169. IDC_COMBO_IMGSIZE.SelectedIndex = 0;
  170. this.IDC_COMBO_IMGSIZE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_IMGSIZE_SelectedIndexChanged);
  171. //去背景方式
  172. IDC_COMBO_BGREMOVETYPE.Items.Clear();
  173. foreach (otsdataconst.OTS_AUTOBGREMOVETYPE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_AUTOBGREMOVETYPE)))
  174. {
  175. ComboBoxItem cbi = new ComboBoxItem();
  176. cbi.Text = GetBGREMOVETYPEString(enum_one);
  177. cbi.Value = (int)enum_one;
  178. IDC_COMBO_BGREMOVETYPE.Items.Add(cbi);
  179. }
  180. this.IDC_COMBO_BGREMOVETYPE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged);
  181. if (IDC_COMBO_BGREMOVETYPE.Items.Count > 0)
  182. IDC_COMBO_BGREMOVETYPE.SelectedIndex = 0;
  183. this.IDC_COMBO_BGREMOVETYPE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged);
  184. //自动去背景方式
  185. IDC_COMBO_AUTOBGREMOVETYP.Items.Clear();
  186. foreach (otsdataconst.OTS_IMAGE_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_IMAGE_MODE)))
  187. {
  188. ComboBoxItem cbi = new ComboBoxItem();
  189. cbi.Text = GetAUTOBGREMOVETYPEString(enum_one);
  190. cbi.Value = (int)enum_one;
  191. IDC_COMBO_AUTOBGREMOVETYP.Items.Add(cbi);
  192. }
  193. this.IDC_COMBO_AUTOBGREMOVETYP.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged);
  194. if (IDC_COMBO_AUTOBGREMOVETYP.Items.Count > 0)
  195. IDC_COMBO_AUTOBGREMOVETYP.SelectedIndex = 0;
  196. this.IDC_COMBO_AUTOBGREMOVETYP.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged);
  197. //X-Ray扫描方式
  198. IDC_COMBO_XRAYSCANMODE.Items.Clear();
  199. foreach (otsdataconst.OTS_X_RAY_SCAN_MODE enum_one in Enum.GetValues(typeof(otsdataconst.OTS_X_RAY_SCAN_MODE)))
  200. {
  201. ComboBoxItem cbi = new ComboBoxItem();
  202. cbi.Text = GetXRayScanModeIdString(enum_one);
  203. cbi.Value = (int)enum_one;
  204. IDC_COMBO_XRAYSCANMODE.Items.Add(cbi);
  205. }
  206. this.IDC_COMBO_XRAYSCANMODE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged);
  207. if (IDC_COMBO_XRAYSCANMODE.Items.Count > 0)
  208. IDC_COMBO_XRAYSCANMODE.SelectedIndex = 0;
  209. this.IDC_COMBO_XRAYSCANMODE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged);
  210. //精炼工艺下拉框选项
  211. IDC_COMBO_TECHNOLOGY.Items.Clear();
  212. foreach (STEEL_TECHNOLOGY enum_one in Enum.GetValues(typeof(STEEL_TECHNOLOGY)))
  213. {
  214. ComboBoxItem cbi = new ComboBoxItem();
  215. cbi.Text = GetSteelTechIdString((otsdataconst.STEEL_TECHNOLOGY)enum_one);
  216. cbi.Value = (int)enum_one;
  217. IDC_COMBO_TECHNOLOGY.Items.Add(cbi);
  218. }
  219. this.IDC_COMBO_TECHNOLOGY.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_TECHNOLOGY_SelectedIndexChanged);
  220. if (IDC_COMBO_TECHNOLOGY.Items.Count > 0)
  221. IDC_COMBO_TECHNOLOGY.SelectedIndex = 0;
  222. this.IDC_COMBO_TECHNOLOGY.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_TECHNOLOGY_SelectedIndexChanged);
  223. //测量区域形状
  224. cBMeasShape.Items.Clear();
  225. foreach (otsdataconst.MEASURE_SHAPE enum_one in Enum.GetValues(typeof(otsdataconst.MEASURE_SHAPE)))
  226. {
  227. ComboBoxItem cbi = new ComboBoxItem();
  228. cbi.Text = GetAreaShapeString(enum_one);
  229. cbi.Value = (int)enum_one;
  230. cBMeasShape.Items.Add(cbi);
  231. }
  232. this.cBMeasShape.SelectedIndexChanged -= new System.EventHandler(this.cBMeasShape_SelectedIndexChanged);
  233. if (cBMeasShape.Items.Count > 0)
  234. cBMeasShape.SelectedIndex = 0;
  235. this.cBMeasShape.SelectedIndexChanged += new System.EventHandler(this.cBMeasShape_SelectedIndexChanged);
  236. //模式选择
  237. IDC_COMBO_Model.Items.Clear();
  238. foreach (otsdataconst.RunMode enum_one in Enum.GetValues(typeof(otsdataconst.RunMode)))
  239. {
  240. OTSPeriodicTable.ComboBoxItem cbi = new OTSPeriodicTable.ComboBoxItem();
  241. cbi.Text = GetRunModeString(enum_one);
  242. cbi.Value = (int)enum_one;
  243. IDC_COMBO_Model.Items.Add(cbi);
  244. }
  245. this.IDC_COMBO_Model.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_Model_SelectedIndexChanged);
  246. if (IDC_COMBO_Model.Items.Count > 0)
  247. IDC_COMBO_Model.SelectedIndex = 0;
  248. this.IDC_COMBO_Model.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_Model_SelectedIndexChanged);
  249. }
  250. public CStage GetWorkingStage()
  251. {
  252. CStage ls_cstageclr = m_cstagefile.GetWorkingStage();
  253. if (null == ls_cstageclr)
  254. {
  255. log.Error("(OTSProgMgrInfoFun.GetWorkingStage) 获取正在工作的样品台类失败");
  256. return ls_cstageclr;
  257. }
  258. return ls_cstageclr;
  259. }
  260. /// <summary>
  261. /// 获取正在工作的样品台ID
  262. /// </summary>
  263. /// <returns></returns>
  264. public int GetWorkingStageId()
  265. {
  266. int stageid = m_cstagefile.GetWorkingStageId();
  267. return stageid;
  268. }
  269. /// <summary>
  270. /// 获取样品台信息列表
  271. /// </summary>
  272. /// <returns></returns>
  273. public List<CStage> GetStageList()
  274. {
  275. List<CStage> l_cstageclr = m_cstagefile.GetStagesList();
  276. if (null == l_cstageclr)
  277. {
  278. log.Error("(OTSProgMgrInfoFun.GetStageList) 获取样品台信息列表失败");
  279. return l_cstageclr;
  280. }
  281. return l_cstageclr;
  282. }
  283. /// <summary>
  284. /// 绑定样品台列表信息
  285. /// </summary>
  286. private void BindStageCombobox()
  287. {
  288. //先插入正在工作的样品台
  289. int ls_workingstageid = 0;
  290. IDC_COMBO_STAGE.Items.Clear();
  291. CStage ls_cstageclr = GetWorkingStage();
  292. ComboBoxItem ls_cbi = new ComboBoxItem();
  293. ls_cbi.Text = ls_cstageclr.GetName();
  294. ls_workingstageid = GetWorkingStageId();
  295. ls_cbi.Value = ls_workingstageid;
  296. IDC_COMBO_STAGE.Items.Add(ls_cbi);
  297. //添加其它的样品台信息
  298. List<CStage> l_cstageclr = GetStageList();
  299. for (int i = 0; i < l_cstageclr.Count(); i++)
  300. {
  301. if (ls_workingstageid != i)//将已经插入过的正在工作样品台信息跳过去
  302. {
  303. ComboBoxItem cbi = new ComboBoxItem();
  304. cbi.Text = l_cstageclr[i].GetName().ToString();
  305. cbi.Value = i.ToString();
  306. IDC_COMBO_STAGE.Items.Add(cbi);
  307. }
  308. }
  309. //防止进入窗体后,马上进入下拉项选择事件,先把事件去掉,一会再注册上
  310. this.IDC_COMBO_STAGE.SelectedIndexChanged -= new System.EventHandler(this.IDC_COMBO_STAGE_SelectedIndexChanged);
  311. //默认选择上
  312. if (IDC_COMBO_STAGE.Items.Count > 0)
  313. {
  314. IDC_COMBO_STAGE.SelectedIndex = 0;
  315. }
  316. this.IDC_COMBO_STAGE.SelectedIndexChanged += new System.EventHandler(this.IDC_COMBO_STAGE_SelectedIndexChanged);
  317. }
  318. #endregion
  319. #region 参数相关方法封装
  320. /// <summary>
  321. /// 读取SEM样品台参数信息
  322. /// </summary>
  323. public void LoadSEMStageData()
  324. {
  325. //100倍时屏幕尺寸/mm
  326. IDC_EDIT_SCREENWIDTH.Text = m_csemstagedata.GetScanFieldSize100().ToString();
  327. //x轴方向
  328. foreach (ComboBoxItem cbi in IDC_COMBO_XDIREC.Items)
  329. {
  330. if (cbi.Value.ToString() != "")
  331. if (Convert.ToInt32(cbi.Value) == (int)m_csemstagedata.GetXAxisDir())
  332. {
  333. IDC_COMBO_XDIREC.SelectedItem = cbi;
  334. }
  335. }
  336. //x轴行程/mm 起,取值时,乘1000
  337. IDC_EDIT_XSTART.Text = (m_csemstagedata.GetXAxis().GetStart() / 1000).ToString();
  338. //x轴行程/mm 始
  339. IDC_EDIT_XEND.Text = (m_csemstagedata.GetXAxis().GetEnd() / 1000).ToString();
  340. //y轴方向
  341. foreach (ComboBoxItem cbi in IDC_COMBO_YDIRECT.Items)
  342. {
  343. if (cbi.Value.ToString() != "")
  344. if (Convert.ToInt32(cbi.Value) == (int)m_csemstagedata.GetYAxisDir())
  345. {
  346. IDC_COMBO_YDIRECT.SelectedItem = cbi;
  347. }
  348. }
  349. //y轴行程/mm 起
  350. IDC_EDIT_YSTART.Text = (m_csemstagedata.GetYAxis().GetStart() / 1000).ToString();
  351. //y轴行程/mm 始
  352. IDC_EDIT_YEND.Text = (m_csemstagedata.GetYAxis().GetEnd() / 1000).ToString();
  353. //最小放大倍数
  354. IDC_EDIT_MINMAG.Text = m_csemstagedata.GetMinMag().ToString();
  355. }
  356. /// <summary>
  357. /// 加载图像扫描参数
  358. /// </summary>
  359. public void LoadImageScanPrm()
  360. {
  361. //测量终止方式
  362. tB_StopMode.Text = m_cotsimgscanprm.GetStopMode().ToString();
  363. if (StopModeDialog == null)
  364. {
  365. StopModeDialog = new frmMeasureStopMode();
  366. StopModeDialog.FieldMode = m_cotsimgscanprm.GetStopParamFields();
  367. StopModeDialog.TimeMode = m_cotsimgscanprm.GetStopParamMeasTime();
  368. StopModeDialog.ParticleMode = m_cotsimgscanprm.GetStopParamParticles();
  369. StopModeDialog.AreaMode = m_cotsimgscanprm.GetStopParamArea();
  370. StopModeDialog.StopMode = tB_StopMode.Text;
  371. }
  372. //取图方式
  373. foreach (ComboBoxItem cbi in IDC_COMBO_FETCHIMGMODE.Items)
  374. {
  375. if (cbi.Value.ToString() != "")
  376. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetFieldStartMode())
  377. {
  378. IDC_COMBO_FETCHIMGMODE.SelectedItem = cbi;
  379. }
  380. }
  381. //扫描图精度
  382. foreach (ComboBoxItem cbi in IDC_COMBO_IMGSCANSPEED.Items)
  383. {
  384. if (cbi.Value.ToString() != "")
  385. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetScanImageSpeed())
  386. {
  387. IDC_COMBO_IMGSCANSPEED.SelectedItem = cbi;
  388. }
  389. }
  390. //扫描图尺寸
  391. foreach (ComboBoxItem cbi in IDC_COMBO_IMGSIZE.Items)
  392. {
  393. if (cbi.Value.ToString() != "")
  394. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgscanprm.GetImageResulotion())
  395. {
  396. IDC_COMBO_IMGSIZE.SelectedItem = cbi;
  397. }
  398. }
  399. }
  400. /// <summary>
  401. /// 加载一般常规参数
  402. /// </summary>
  403. public void LoadCGenParam()
  404. {
  405. //样品名
  406. IDC_EDIT_SAMPLENAME.Text = m_cgenparam.GetSampleName().ToString();
  407. //执行开关
  408. IDC_MEAS_SWITCH.Checked = m_cgenparam.GetMeasurementSwitch();
  409. //是否使用系统库开关
  410. IDC_SYS_LIB.Checked = m_cgenparam.GetSysSTD();
  411. //精炼工艺选项
  412. foreach (ComboBoxItem cbi in IDC_COMBO_TECHNOLOGY.Items)
  413. {
  414. if (cbi.Value.ToString() != "")
  415. if (Convert.ToInt32(cbi.Value) == m_cgenparam.GetSteelTechnology())
  416. {
  417. IDC_COMBO_TECHNOLOGY.SelectedItem = cbi;
  418. }
  419. }
  420. //测量区域形状
  421. foreach (ComboBoxItem cbi in cBMeasShape.Items)
  422. {
  423. if (cbi.Value.ToString() != "")
  424. if (Convert.ToInt32(cbi.Value) == (int)m_cgenparam.GetShape())
  425. {
  426. cBMeasShape.SelectedItem = cbi;
  427. }
  428. }
  429. //测量区域面积
  430. tBMeasArea.Text = m_cgenparam.GetArea().ToString();
  431. //标准库选择
  432. foreach (ComboBoxItem cbi in IDC_COMBO_STDSelect.Items)
  433. {
  434. if (cbi.Text.ToString() != "")
  435. if (cbi.Text.ToString() == m_cgenparam.GetSTDSelect())
  436. {
  437. IDC_COMBO_STDSelect.SelectedItem = cbi;
  438. }
  439. }
  440. }
  441. /// <summary>
  442. /// 加载默认参数
  443. /// </summary>
  444. public void LoadDefaultParam()
  445. {
  446. //模式
  447. foreach (OTSPeriodicTable.ComboBoxItem cbi in IDC_COMBO_Model.Items)
  448. {
  449. if (cbi.Value.ToString() != "")
  450. if (Convert.ToInt32(cbi.Value) == (int)m_cotsprogmgrparamfile.GetRunMode())
  451. {
  452. IDC_COMBO_Model.SelectedItem = cbi;
  453. }
  454. }
  455. }
  456. /// <summary>
  457. /// 加载图像处理参数
  458. /// </summary>
  459. public void LoadImageProc()
  460. {
  461. //颗粒面积范围 最小
  462. IDC_EDIT_PARTAREAMIN.Text = m_cotsimgprocprm.GetIncAreaRange().GetStart().ToString();
  463. //颗粒面积范围 最大
  464. IDC_EDIT_PARTAREAMAX.Text = m_cotsimgprocprm.GetIncAreaRange().GetEnd().ToString();
  465. //背景灰度范围 最小
  466. IDC_EDIT_BACKMIN.Text = m_cotsimgprocprm.GetBGGray().GetStart().ToString();
  467. //背景灰度范围 最大
  468. IDC_EDIT_BACKMAX.Text = m_cotsimgprocprm.GetBGGray().GetEnd().ToString();
  469. //颗粒灰度范围 最小
  470. IDC_EDIT_PARTMIN.Text = m_cotsimgprocprm.GetParticleGray().GetStart().ToString();
  471. //颗粒灰度范围 最大
  472. IDC_EDIT_PARTMAX.Text = m_cotsimgprocprm.GetParticleGray().GetEnd().ToString();
  473. //腐蚀膨胀系数
  474. //IDC_COMBO_CorrosionExpansionCoefficient.Text = m_cotsimgprocprm.GetErrodDilateParam().ToString();
  475. //重叠尺寸
  476. IDC_EDIT_Overlap.Text = m_cotsimgprocprm.GetOverlapParam().ToString();
  477. //去背景方式
  478. foreach (ComboBoxItem cbi in IDC_COMBO_BGREMOVETYPE.Items)
  479. {
  480. if (cbi.Value.ToString() != "")
  481. {
  482. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgprocprm.GetBGRemoveType())
  483. {
  484. IDC_COMBO_BGREMOVETYPE.SelectedItem = cbi;
  485. break;
  486. }
  487. }
  488. }
  489. foreach (ComboBoxItem cbi in IDC_COMBO_AUTOBGREMOVETYP.Items)
  490. {
  491. if (cbi.Value.ToString() != "")
  492. {
  493. if (Convert.ToInt32(cbi.Value) == (int)m_cotsimgprocprm.GetAutoBGRemoveType())
  494. {
  495. IDC_COMBO_AUTOBGREMOVETYP.SelectedItem = cbi;
  496. break;
  497. }
  498. }
  499. }
  500. //重叠尺寸
  501. IDC_EDIT_Overlap.Text = m_cotsimgprocprm.GetOverlapParam().ToString();
  502. if (m_cotsimgprocprm.GetParticleSelectCondition().ToString() == "")
  503. {
  504. IDC_EDIT_OTHERSELECTION.Text = "NoFilter";
  505. }
  506. else
  507. {
  508. IDC_EDIT_OTHERSELECTION.Text = m_cotsimgprocprm.GetParticleSelectCondition().ToString();
  509. }
  510. }
  511. /// <summary>
  512. /// 加载X-Ray参数
  513. /// </summary>
  514. public void LoadXRayParam()
  515. {
  516. //搜索X-ray精度对应的时间
  517. //IDC_TEXTBOX_SEARCHXRAYSPEED_TIME.Text = m_cotsxrayprm.GetMidSearchAQTime().ToString();
  518. foreach (ComboBoxItem cbi in IDC_COMBO_XRAYSCANMODE.Items)
  519. {
  520. if (cbi.Value.ToString() != "")
  521. if (Convert.ToInt32(cbi.Value) == (int)m_cotsxrayprm.GetScanMode())
  522. {
  523. IDC_COMBO_XRAYSCANMODE.SelectedItem = cbi;
  524. }
  525. }
  526. //是否使用电镜
  527. IDC_USINGXRAY_LIB.Checked = m_cotsxrayprm.GetUsingXray();
  528. //分析X-ray精度对应的时间
  529. IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text = m_cotsxrayprm.GetMidAnalyAQTime().ToString();
  530. //分析X-ray计数期望值
  531. IDC_EDIT_ANALYXRAYAIMVALUE.Text = m_cotsxrayprm.GetAnalyExpCount().ToString();
  532. IDC_EDIT_QuantifyMinSize.Text = m_cotsxrayprm.GetFeatureModeMinSize().ToString();
  533. IDC_EDIT_SmallPartAQTime.Text = m_cotsxrayprm.GetSmallPartXrayTime().ToString();
  534. IDC_EDIT_XrayLimit.Text = m_cotsxrayprm.GetXrayLimit().ToString();
  535. if (m_cotsxrayprm.IfAutoId)
  536. {
  537. radioButton1.Checked =true;
  538. }
  539. else
  540. {
  541. radioButton2.Checked = true;
  542. }
  543. tb_xsys.Text = m_cotsxrayprm.AnalysisElements;
  544. }
  545. /// <summary>
  546. /// 保存SEM样品台参数
  547. /// </summary>
  548. public void SaveSEMStageData()
  549. {
  550. //100倍时屏幕尺寸/mm
  551. m_csemstagedata.SetScanFieldSize100(Convert.ToInt32(IDC_EDIT_SCREENWIDTH.Text));
  552. //x轴方向
  553. ComboBoxItem cbi_x = (ComboBoxItem)IDC_COMBO_XDIREC.SelectedItem;
  554. m_csemstagedata.SetXAxisDir((otsdataconst.OTS_X_AXIS_DIRECTION)Convert.ToInt32(cbi_x.Value));
  555. //x轴行程/mm 起,始
  556. CIntRange crc_x = new CIntRange(Convert.ToInt32(IDC_EDIT_XSTART.Text) * 1000, Convert.ToInt32(IDC_EDIT_XEND.Text) * 1000);
  557. m_csemstagedata.SetXAxis(crc_x);
  558. //y轴方向
  559. ComboBoxItem cbi_y = (ComboBoxItem)IDC_COMBO_YDIRECT.SelectedItem;
  560. m_csemstagedata.SetYAxisDir((otsdataconst.OTS_Y_AXIS_DIRECTION)Convert.ToInt32(cbi_y.Value));
  561. //y轴行程/mm 起,始
  562. CIntRange crc_y = new CIntRange(Convert.ToInt32(IDC_EDIT_YSTART.Text) * 1000, Convert.ToInt32(IDC_EDIT_YEND.Text) * 1000);
  563. m_csemstagedata.SetYAxis(crc_y);
  564. //最小放大倍数
  565. m_csemstagedata.SetMinMag(Convert.ToDouble(IDC_EDIT_MINMAG.Text));
  566. }
  567. /// <summary>
  568. /// 保存图像扫描参数
  569. /// </summary>
  570. public void SaveImageScanPrm()
  571. {
  572. // 保存图像扫描参数");
  573. //测量终止方式
  574. m_cotsimgscanprm.SetStopMode(tB_StopMode.Text);
  575. //终止时间
  576. m_cotsimgscanprm.SetStopParamMeasTime(StopModeDialog.TimeMode);
  577. ////终止帧图数
  578. m_cotsimgscanprm.SetStopParamFields(StopModeDialog.FieldMode);
  579. ////终止夹杂物数
  580. m_cotsimgscanprm.SetStopParamParticles(StopModeDialog.ParticleMode);
  581. ////终止面积
  582. m_cotsimgscanprm.SetStopParamArea(StopModeDialog.AreaMode);
  583. //取图方式
  584. ComboBoxItem enum_fetchimgmode = (ComboBoxItem)IDC_COMBO_FETCHIMGMODE.SelectedItem;
  585. m_cotsimgscanprm.SetStartImageMode((otsdataconst.OTS_GET_IMAGE_MODE)Convert.ToInt32(enum_fetchimgmode.Value));
  586. //扫描图精度
  587. ComboBoxItem enum_imgscanspeed = (ComboBoxItem)IDC_COMBO_IMGSCANSPEED.SelectedItem;
  588. m_cotsimgscanprm.SetScanImageSpeed((otsdataconst.OTS_IMAGE_SCANSPEED_OPTIONS)Convert.ToInt32(enum_imgscanspeed.Value));
  589. //扫描图尺寸
  590. ComboBoxItem enum_imgsize = (ComboBoxItem)IDC_COMBO_IMGSIZE.SelectedItem;
  591. m_cotsimgscanprm.SetImageResulotion((otsdataconst.OTS_IMAGE_RESULOTION_OPTIONS)Convert.ToInt32(enum_imgsize.Value));
  592. }
  593. /// <summary>
  594. /// 保存一般常规参数
  595. /// </summary>
  596. public void SaveCGenParam()
  597. {
  598. //样品名
  599. m_cgenparam.SetSampleName(IDC_EDIT_SAMPLENAME.Text);
  600. //执行开关
  601. m_cgenparam.SetMeasurementSwitch(IDC_MEAS_SWITCH.Checked);
  602. //是否使用系统库
  603. m_cgenparam.SetSysSTD(IDC_SYS_LIB.Checked);
  604. //获取精炼工艺索引
  605. ComboBoxItem cbiTECH = new ComboBoxItem();
  606. cbiTECH = (ComboBoxItem)IDC_COMBO_TECHNOLOGY.SelectedItem;
  607. //设置参数文件类中精炼工艺索引值
  608. m_cgenparam.SetSteelTechnology((int)cbiTECH.Value);
  609. //测量区域形状
  610. ComboBoxItem enum_Shape = (ComboBoxItem)cBMeasShape.SelectedItem;
  611. m_cgenparam.SetShape((otsdataconst.DOMAIN_SHAPE)Convert.ToInt32(enum_Shape.Value));
  612. //测量区域大小
  613. m_cgenparam.SetArea(Convert.ToDouble(tBMeasArea.Text));
  614. //标准库选择
  615. ComboBoxItem enum_STDLIBSELECT = (ComboBoxItem)IDC_COMBO_STDSelect.SelectedItem;
  616. m_cgenparam.SetSTDSelect(enum_STDLIBSELECT.Text.ToString());
  617. }
  618. /// <summary>
  619. /// 保存图像处理参数
  620. /// </summary>
  621. public void SaveImageProc()
  622. {
  623. //颗粒面积范围 最小 最大
  624. CDoubleRange crc_partareamin = new CDoubleRange(Math.Round(Convert.ToDouble(IDC_EDIT_PARTAREAMIN.Text), 2), Math.Round(Convert.ToDouble(IDC_EDIT_PARTAREAMAX.Text), 2));
  625. m_cotsimgprocprm.SetIncAreaRange(crc_partareamin);
  626. //背景灰度范围 最小 最大
  627. CIntRange crc_backmin = new CIntRange(Convert.ToInt32(IDC_EDIT_BACKMIN.Text), Convert.ToInt32(IDC_EDIT_BACKMAX.Text));
  628. m_cotsimgprocprm.SetBGGray(crc_backmin);
  629. //颗粒灰度范围 最小 最大
  630. CIntRange crc_partmin = new CIntRange(Convert.ToInt32(IDC_EDIT_PARTMIN.Text), Convert.ToInt32(IDC_EDIT_PARTMAX.Text));
  631. m_cotsimgprocprm.SetParticleGray(crc_partmin);
  632. //去背景方式
  633. ComboBoxItem enum_BGREMOVETYPE = (ComboBoxItem)IDC_COMBO_BGREMOVETYPE.SelectedItem;
  634. m_cotsimgprocprm.SetBGRemoveType((otsdataconst.OTS_BGREMOVE_TYPE)enum_BGREMOVETYPE.Value);
  635. //去背景方式
  636. ComboBoxItem enum_AUTOBGREMOVETYP = (ComboBoxItem)IDC_COMBO_AUTOBGREMOVETYP.SelectedItem;
  637. m_cotsimgprocprm.SetAutoBGRemoveType((otsdataconst.OTS_AUTOBGREMOVE_TYPE)enum_AUTOBGREMOVETYP.Value);
  638. //重叠像素
  639. m_cotsimgprocprm.SetOverlapParam(Convert.ToInt32(IDC_EDIT_Overlap.Text));
  640. if (IDC_EDIT_OTHERSELECTION.Text != "NoFilter")
  641. {
  642. m_cotsimgprocprm.SetParticleSelectCondition(IDC_EDIT_OTHERSELECTION.Text);
  643. }
  644. else
  645. {
  646. m_cotsimgprocprm.SetParticleSelectCondition("");
  647. }
  648. }
  649. /// <summary>
  650. /// 保存X-Ray参数
  651. /// </summary>
  652. public void SaveXRayParam()
  653. {
  654. //X-ray扫描方式
  655. ComboBoxItem enum_xrayscanmode = (ComboBoxItem)IDC_COMBO_XRAYSCANMODE.SelectedItem;
  656. m_cotsxrayprm.SetScanMode((otsdataconst.OTS_X_RAY_SCAN_MODE)Convert.ToInt32(enum_xrayscanmode.Value));
  657. //是否使用X-ray
  658. m_cotsxrayprm.SetUsingXray(IDC_USINGXRAY_LIB.Checked);
  659. //分析X-ray精度对应的时间
  660. m_cotsxrayprm.SetMidAnalyAQTime(Convert.ToInt32(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()));
  661. //分析X-ray计数期望值
  662. m_cotsxrayprm.SetAnalyExpCount(Convert.ToInt32(IDC_EDIT_ANALYXRAYAIMVALUE.Text));
  663. m_cotsxrayprm.SetFeatureModeMinSize(Convert.ToDouble(IDC_EDIT_QuantifyMinSize.Text));
  664. m_cotsxrayprm.SetSmallPartXrayTime(Convert.ToInt32(IDC_EDIT_SmallPartAQTime.Text));
  665. m_cotsxrayprm.SetXrayLimit(Convert.ToInt32(IDC_EDIT_XrayLimit.Text));
  666. m_cotsxrayprm.IfAutoId=radioButton1.Checked ;
  667. m_cotsxrayprm.AnalysisElements=tb_xsys.Text ;
  668. }
  669. /// <summary>
  670. /// 将参数保存到文件
  671. /// </summary>
  672. /// <param name="a_nPackId"></param>
  673. /// <param name="a_pStageData"></param>
  674. /// <param name="a_pGenParam"></param>
  675. /// <param name="a_pImageScanParam"></param>
  676. /// <param name="a_pImageProcParam"></param>
  677. /// <param name="a_pXRayParam"></param>
  678. /// <returns></returns>
  679. public bool SaveInfoToProgMgrFile()
  680. {
  681. //SaveInfoToProgMgrFile()
  682. if (false == m_cotsprogmgrparamfile.SaveInfoToProgMgrFile())
  683. {
  684. log.Error("(OTSProgMgrInfoFun.SaveInfoToProgMgrFile) Failed to save parameters to file");
  685. return false;
  686. }
  687. return true;
  688. }
  689. /// <summary>
  690. /// 加载参数各个类
  691. /// </summary>
  692. public bool LoadParamFun()
  693. {
  694. bool result = m_cotsprogmgrparamfile.LoadInfoFromProgMgrFile();
  695. if (!result)
  696. {
  697. log.Error("(OTSProgMgrInfoFun.LoadParamFun) LoadInfoFromProgMgrFile Failed");
  698. return false;
  699. }
  700. m_csemstagedata = m_cotsprogmgrparamfile.GetStageDataParam();
  701. if (null == m_csemstagedata)
  702. {
  703. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetStageData Failed");
  704. return false;
  705. }
  706. m_cotsimgscanprm = m_cotsprogmgrparamfile.GetImageScanParam();
  707. if (null == m_cotsimgscanprm)
  708. {
  709. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetImageScanParam Failed");
  710. return false;
  711. }
  712. m_cgenparam = m_cotsprogmgrparamfile.GetGenParam();
  713. if (null == m_cgenparam)
  714. {
  715. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetGenParam Failed");
  716. return false;
  717. }
  718. m_cotsimgprocprm = m_cotsprogmgrparamfile.GetImageProcParam();
  719. if (null == m_cotsimgprocprm)
  720. {
  721. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetImageProcParam Failed");
  722. return false;
  723. }
  724. m_cotsxrayprm = m_cotsprogmgrparamfile.GetXRayParam();
  725. if (null == m_cotsxrayprm)
  726. {
  727. log.Error("(OTSProgMgrInfoFun.LoadParamFun) GetXRayParam Failed");
  728. return false;
  729. }
  730. return true;
  731. }
  732. #endregion
  733. #region 窗体加载
  734. private void ProgMgrInfoForm_Load(object sender, EventArgs e)
  735. {
  736. //加载各参数类
  737. LoadParamFun();
  738. //初始化combobox下拉框列表
  739. BindComboBox();
  740. //加载相关参数信息
  741. LoadDefaultParam();
  742. LoadSEMStageData();
  743. LoadImageScanPrm();
  744. LoadCGenParam();
  745. LoadImageProc();
  746. LoadXRayParam();
  747. if (m_b_checkstagefile == false)
  748. btnok.Enabled = true;
  749. else
  750. btnok.Enabled = false;
  751. if(m_cotsprogmgrparamfile.GetSysTypeName() == "IncA")
  752. {
  753. label42.Visible = true;
  754. IDC_COMBO_TECHNOLOGY.Visible = true;
  755. }
  756. else
  757. {
  758. label42.Visible = false;
  759. IDC_COMBO_TECHNOLOGY.Visible = false;
  760. }
  761. }
  762. #endregion
  763. #region 各按钮控件点击事件
  764. private void IDC_BUTTON_KLFX_Click(object sender, EventArgs e)
  765. {
  766. try
  767. {
  768. if (IDC_COMBO_STDSelect.Text != "NoSTDDB")
  769. {
  770. Process p = System.Diagnostics.Process.Start(".\\OTSPartA_STDEditor.exe", Application.StartupPath + "\\Config\\SysData\\" + IDC_COMBO_STDSelect.Text+".db");
  771. p.WaitForExit();
  772. }
  773. else
  774. {
  775. string message = table["message55"].ToString();
  776. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  777. }
  778. }
  779. catch (Exception ex)
  780. {
  781. log.Error("OTSPartA_STDEditor:" + ex.ToString());
  782. }
  783. }
  784. /// <summary>
  785. /// 弹出样品台管理窗体
  786. /// </summary>
  787. /// <param name="a_nPackId"></param>
  788. /// <param name="a_pStageFile"></param>
  789. /// <returns></returns>
  790. public void ShowStageDialogExport()
  791. {
  792. DlgStageMgr dlgStageMgr = new DlgStageMgr(m_cstagefile);
  793. dlgStageMgr.ShowDialog();
  794. return;
  795. }
  796. /// <summary>
  797. /// 保存样品台信息
  798. /// </summary>
  799. /// <returns></returns>
  800. public bool CStageFileClrSave()
  801. {
  802. if (m_cstagefile == null)
  803. {
  804. //报错
  805. log.Error("(OTSProgMgrInfoFun.CStageFileClrSave) Error saving sample station information!");
  806. }
  807. else
  808. {
  809. bool b_ret = m_cstagefile.Save();
  810. if (false == b_ret)
  811. {
  812. log.Error("(OTSProgMgrInfoFun.CStageFileClrSave) Error saving sample table information!");
  813. }
  814. }
  815. return false;
  816. }
  817. private void IDC_BUTTON_STAGE_Click(object sender, EventArgs e)
  818. {
  819. //弹出管理样品台管理窗体
  820. ShowStageDialogExport();
  821. //弹出后再保存样品台信息
  822. CStageFileClrSave();
  823. //刷新绑定样品台列表
  824. BindStageCombobox();
  825. //检测是否已经有修改
  826. ThisSetIsModify();
  827. }
  828. /// <summary>
  829. /// 判断各控件值是否正确
  830. /// </summary>
  831. /// <returns></returns>
  832. private bool CheckSetupValues(int bz)
  833. {
  834. if ("" == IDC_COMBO_STAGE.Text)
  835. {
  836. string message = table["message1"].ToString();
  837. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  838. IDC_COMBO_STAGE.Focus();
  839. IDC_COMBO_STAGE.SelectAll();
  840. return false;
  841. }
  842. if ("" == IDC_EDIT_SCREENWIDTH.Text)
  843. {
  844. string message = table["message2"].ToString();
  845. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  846. IDC_EDIT_SCREENWIDTH.Focus();
  847. IDC_EDIT_SCREENWIDTH.SelectAll();
  848. return false;
  849. }
  850. if ("" == IDC_COMBO_XDIREC.Text)
  851. {
  852. string message = table["message3"].ToString();
  853. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  854. IDC_COMBO_XDIREC.Focus();
  855. IDC_COMBO_XDIREC.SelectAll();
  856. return false;
  857. }
  858. if ("" == IDC_EDIT_XSTART.Text)
  859. {
  860. string message = table["message4"].ToString();
  861. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  862. IDC_EDIT_XSTART.Focus();
  863. IDC_EDIT_XSTART.SelectAll();
  864. return false;
  865. }
  866. if ("" == IDC_EDIT_XEND.Text)
  867. {
  868. string message = table["message4"].ToString();
  869. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  870. IDC_EDIT_XEND.Focus();
  871. IDC_EDIT_XEND.SelectAll();
  872. return false;
  873. }
  874. if ("" == IDC_COMBO_YDIRECT.Text)
  875. {
  876. string message = table["message5"].ToString();
  877. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  878. IDC_COMBO_YDIRECT.Focus();
  879. IDC_COMBO_YDIRECT.SelectAll();
  880. return false;
  881. }
  882. if ("" == IDC_EDIT_YSTART.Text)
  883. {
  884. string message = table["message6"].ToString();
  885. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  886. IDC_EDIT_YSTART.Focus();
  887. IDC_EDIT_YSTART.SelectAll();
  888. return false;
  889. }
  890. if ("" == IDC_EDIT_YEND.Text)
  891. {
  892. string message = table["message6"].ToString();
  893. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  894. IDC_EDIT_YEND.Focus();
  895. IDC_EDIT_YEND.SelectAll();
  896. return false;
  897. }
  898. if ("" == tB_StopMode.Text)
  899. {
  900. string message = table["message7"].ToString();
  901. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  902. //IDC_EDIT_STOP_TIME.Focus();
  903. //IDC_EDIT_STOP_TIME.SelectAll();
  904. return false;
  905. }
  906. if ("" == IDC_COMBO_FETCHIMGMODE.Text)
  907. {
  908. string message = table["message10"].ToString();
  909. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  910. IDC_COMBO_FETCHIMGMODE.Focus();
  911. IDC_COMBO_FETCHIMGMODE.SelectAll();
  912. return false;
  913. }
  914. if ("" == IDC_COMBO_IMGSCANSPEED.Text)
  915. {
  916. string message = table["message11"].ToString();
  917. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  918. IDC_COMBO_IMGSCANSPEED.Focus();
  919. IDC_COMBO_IMGSCANSPEED.SelectAll();
  920. return false;
  921. }
  922. if ("" == IDC_COMBO_IMGSIZE.Text)
  923. {
  924. string message = table["message12"].ToString();
  925. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  926. IDC_COMBO_IMGSIZE.Focus();
  927. IDC_COMBO_IMGSIZE.SelectAll();
  928. return false;
  929. }
  930. if ("" == IDC_EDIT_MINMAG.Text)
  931. {
  932. string message = table["message13"].ToString();
  933. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  934. IDC_EDIT_MINMAG.Focus();
  935. IDC_EDIT_MINMAG.SelectAll();
  936. return false;
  937. }
  938. if ("" == IDC_EDIT_PARTAREAMIN.Text)
  939. {
  940. string message = table["message14"].ToString();
  941. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  942. IDC_EDIT_PARTAREAMIN.Focus();
  943. IDC_EDIT_PARTAREAMIN.SelectAll();
  944. return false;
  945. }
  946. if ("" == IDC_EDIT_PARTAREAMAX.Text)
  947. {
  948. string message = table["message15"].ToString();
  949. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  950. IDC_EDIT_PARTAREAMAX.Focus();
  951. IDC_EDIT_PARTAREAMAX.SelectAll();
  952. return false;
  953. }
  954. if ("" == IDC_EDIT_BACKMIN.Text)
  955. {
  956. string message = table["message16"].ToString();
  957. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  958. IDC_EDIT_BACKMIN.Focus();
  959. IDC_EDIT_BACKMIN.SelectAll();
  960. return false;
  961. }
  962. if ("" == IDC_EDIT_BACKMAX.Text)
  963. {
  964. string message = table["message17"].ToString();
  965. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  966. IDC_EDIT_BACKMAX.Focus();
  967. IDC_EDIT_BACKMAX.SelectAll();
  968. return false;
  969. }
  970. if ("" == IDC_EDIT_PARTMIN.Text)
  971. {
  972. string message = table["message18"].ToString();
  973. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  974. IDC_EDIT_PARTMIN.Focus();
  975. IDC_EDIT_PARTMIN.SelectAll();
  976. return false;
  977. }
  978. if ("" == IDC_EDIT_PARTMAX.Text)
  979. {
  980. string message = table["message19"].ToString();
  981. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  982. IDC_EDIT_PARTMAX.Focus();
  983. IDC_EDIT_PARTMAX.SelectAll();
  984. return false;
  985. }
  986. if ("" == IDC_COMBO_XRAYSCANMODE.Text)
  987. {
  988. string message = table["message20"].ToString();
  989. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  990. IDC_COMBO_XRAYSCANMODE.Focus();
  991. IDC_COMBO_XRAYSCANMODE.SelectAll();
  992. return false;
  993. }
  994. if ("" == IDC_EDIT_ANALYXRAYAIMVALUE.Text)
  995. {
  996. string message = table["message22"].ToString();
  997. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  998. IDC_EDIT_ANALYXRAYAIMVALUE.Focus();
  999. IDC_EDIT_ANALYXRAYAIMVALUE.SelectAll();
  1000. return false;
  1001. }
  1002. if ("" == tBMeasArea.Text)
  1003. {
  1004. string message = table["message62"].ToString();
  1005. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1006. tBMeasArea.Focus();
  1007. tBMeasArea.SelectAll();
  1008. return false;
  1009. }
  1010. //string pat = @"^(-|\+)?\d{1,8}$";//只能输入1到3位的正负整数
  1011. string pat = @"^-?[0-9]\d*$";//只能限定正负整数,包含0
  1012. string scope = @"^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])$";
  1013. string PositiveDecimals = @"^(([1-9]\d*)(\.\d+)?)$|^0\.\d*[1-9]$"; //正浮点数
  1014. string positiveInteger = @"^?[0-9]\d*$";//只能限定正整数,包含0
  1015. string positiveOddNumber = @"[^1,3,5,7,9]";//只能限定正奇数
  1016. Regex rg = new Regex(pat);
  1017. Regex rgScope = new Regex(scope);
  1018. Regex rgPositiveDecimals = new Regex(PositiveDecimals);
  1019. Regex rgpositiveInteger = new Regex(positiveInteger);
  1020. Regex rgpositiveOddNumber = new Regex(positiveOddNumber);
  1021. //100倍时屏幕尺寸
  1022. if (false == rg.Match(IDC_EDIT_SCREENWIDTH.Text.Trim()).Success)
  1023. {
  1024. IDC_EDIT_SCREENWIDTH.Focus();
  1025. IDC_EDIT_SCREENWIDTH.SelectAll();
  1026. string message = table["message23"].ToString();
  1027. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1028. return false;
  1029. }
  1030. //x轴行程/mm 起
  1031. if (false == rg.Match(IDC_EDIT_XSTART.Text.Trim()).Success)
  1032. {
  1033. IDC_EDIT_XSTART.Focus();
  1034. IDC_EDIT_XSTART.SelectAll();
  1035. string message = table["message24"].ToString();
  1036. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1037. return false;
  1038. }
  1039. //x轴行程/mm 止
  1040. if (false == rg.Match(IDC_EDIT_XEND.Text.Trim()).Success)
  1041. {
  1042. IDC_EDIT_XEND.Focus();
  1043. IDC_EDIT_XEND.SelectAll();
  1044. string message = table["message25"].ToString();
  1045. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1046. return false;
  1047. }
  1048. //y轴行程/mm 起
  1049. if (false == rg.Match(IDC_EDIT_YSTART.Text.Trim()).Success)
  1050. {
  1051. IDC_EDIT_YSTART.Focus();
  1052. IDC_EDIT_YSTART.SelectAll();
  1053. string message = table["message26"].ToString();
  1054. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1055. return false;
  1056. }
  1057. //y轴行程/mm 止
  1058. if (false == rg.Match(IDC_EDIT_YEND.Text.Trim()).Success)
  1059. {
  1060. IDC_EDIT_YEND.Focus();
  1061. IDC_EDIT_YEND.SelectAll();
  1062. string message = table["message27"].ToString();
  1063. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1064. return false;
  1065. }
  1066. //颗粒面积范围 最小
  1067. if (false == rgPositiveDecimals.Match(IDC_EDIT_PARTAREAMIN.Text.Trim()).Success)
  1068. {
  1069. IDC_EDIT_PARTAREAMIN.Focus();
  1070. IDC_EDIT_PARTAREAMIN.SelectAll();
  1071. string message = table["message31"].ToString();
  1072. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1073. return false;
  1074. }
  1075. //颗粒面积范围 最大
  1076. if (false == rgPositiveDecimals.Match(IDC_EDIT_PARTAREAMAX.Text.Trim()).Success)
  1077. {
  1078. IDC_EDIT_PARTAREAMAX.Focus();
  1079. IDC_EDIT_PARTAREAMAX.SelectAll();
  1080. string message = table["message32"].ToString();
  1081. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1082. return false;
  1083. }
  1084. //背景灰度范围 最小
  1085. if (false == rg.Match(IDC_EDIT_BACKMIN.Text.Trim()).Success)
  1086. {
  1087. IDC_EDIT_BACKMIN.Focus();
  1088. IDC_EDIT_BACKMIN.SelectAll();
  1089. string message = table["message33"].ToString();
  1090. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1091. return false;
  1092. }
  1093. else
  1094. {
  1095. if (false == rgScope.Match(IDC_EDIT_BACKMIN.Text.Trim()).Success)
  1096. {
  1097. IDC_EDIT_BACKMIN.Focus();
  1098. IDC_EDIT_BACKMIN.SelectAll();
  1099. string message = table["message34"].ToString();
  1100. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1101. return false;
  1102. }
  1103. }
  1104. //背景灰度范围 最大
  1105. if (false == rg.Match(IDC_EDIT_BACKMAX.Text.Trim()).Success)
  1106. {
  1107. IDC_EDIT_BACKMAX.Focus();
  1108. IDC_EDIT_BACKMAX.SelectAll();
  1109. string message = table["message35"].ToString();
  1110. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1111. return false;
  1112. }
  1113. else
  1114. {
  1115. if (false == rgScope.Match(IDC_EDIT_BACKMAX.Text.Trim()).Success)
  1116. {
  1117. IDC_EDIT_BACKMAX.Focus();
  1118. IDC_EDIT_BACKMAX.SelectAll();
  1119. string message = table["message36"].ToString();
  1120. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1121. return false;
  1122. }
  1123. }
  1124. //颗粒灰度范围 最小
  1125. if (false == rg.Match(IDC_EDIT_PARTMIN.Text.Trim()).Success)
  1126. {
  1127. IDC_EDIT_PARTMIN.Focus();
  1128. IDC_EDIT_PARTMIN.SelectAll();
  1129. string message = table["message37"].ToString();
  1130. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1131. return false;
  1132. }
  1133. else
  1134. {
  1135. if (false == rgScope.Match(IDC_EDIT_PARTMIN.Text.Trim()).Success)
  1136. {
  1137. IDC_EDIT_PARTMIN.Focus();
  1138. IDC_EDIT_PARTMIN.SelectAll();
  1139. string message = table["message38"].ToString();
  1140. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1141. return false;
  1142. }
  1143. }
  1144. //颗粒灰度范围 最大
  1145. if (false == rg.Match(IDC_EDIT_PARTMAX.Text.Trim()).Success)
  1146. {
  1147. IDC_EDIT_PARTMAX.Focus();
  1148. IDC_EDIT_PARTMAX.SelectAll();
  1149. string message = table["message39"].ToString();
  1150. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1151. return false;
  1152. }
  1153. else
  1154. {
  1155. if (false == rgScope.Match(IDC_EDIT_PARTMAX.Text.Trim()).Success)
  1156. {
  1157. IDC_EDIT_PARTMAX.Focus();
  1158. IDC_EDIT_PARTMAX.SelectAll();
  1159. string message = table["message40"].ToString();
  1160. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1161. return false;
  1162. }
  1163. }
  1164. //分析X-ray计数期望值 最大
  1165. if (false == rg.Match(IDC_EDIT_ANALYXRAYAIMVALUE.Text.Trim()).Success)
  1166. {
  1167. IDC_EDIT_ANALYXRAYAIMVALUE.Focus();
  1168. IDC_EDIT_ANALYXRAYAIMVALUE.SelectAll();
  1169. string message = table["message41"].ToString();
  1170. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1171. return false;
  1172. }
  1173. //分析X-ray精度对应的时间
  1174. if (false == rg.Match(IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Text.Trim()).Success)
  1175. {
  1176. IDC_TEXTBOX_ANALYXRAYSPEED_TIME.Focus();
  1177. IDC_TEXTBOX_ANALYXRAYSPEED_TIME.SelectAll();
  1178. string message = table["message42"].ToString();
  1179. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1180. return false;
  1181. }
  1182. pat = @"^[0-9]+(\.[0-9]{1,3})?$"; //只能输入,1到3位小数的正数
  1183. rg = new Regex(pat);
  1184. //最小放大倍数
  1185. if (false == rg.Match(IDC_EDIT_MINMAG.Text.Trim()).Success)
  1186. {
  1187. IDC_EDIT_MINMAG.Focus();
  1188. IDC_EDIT_MINMAG.SelectAll();
  1189. string message = table["message43"].ToString();
  1190. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1191. return false;
  1192. }
  1193. //再限制,x轴,y轴,的起止的,输入长度,因为现在已经有在mm和um之间的转换,所以这里要限制一下
  1194. //x轴行程/mm 起
  1195. if (IDC_EDIT_XSTART.Text.Length > 4)
  1196. {
  1197. IDC_EDIT_XSTART.Focus();
  1198. IDC_EDIT_XSTART.SelectAll();
  1199. string message = table["message44"].ToString();
  1200. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1201. return false;
  1202. }
  1203. //x轴行程/mm 止
  1204. if (IDC_EDIT_XEND.Text.Length > 4)
  1205. {
  1206. IDC_EDIT_XEND.Focus();
  1207. IDC_EDIT_XEND.SelectAll();
  1208. string message = table["message45"].ToString();
  1209. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1210. return false;
  1211. }
  1212. //y轴行程/mm 起
  1213. if (IDC_EDIT_YSTART.Text.Length > 4)
  1214. {
  1215. IDC_EDIT_YSTART.Focus();
  1216. IDC_EDIT_YSTART.SelectAll();
  1217. string message = table["message46"].ToString();
  1218. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1219. return false;
  1220. }
  1221. //y轴行程/mm 止
  1222. if (IDC_EDIT_YEND.Text.Length > 4)
  1223. {
  1224. IDC_EDIT_YEND.Focus();
  1225. IDC_EDIT_YEND.SelectAll();
  1226. string message = table["message47"].ToString();
  1227. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1228. return false;
  1229. }
  1230. if (Convert.ToInt32(IDC_EDIT_XSTART.Text.Trim()) > Convert.ToInt32(IDC_EDIT_XEND.Text.Trim()))
  1231. {
  1232. IDC_EDIT_XEND.Focus();
  1233. IDC_EDIT_XEND.SelectAll();
  1234. string message = table["message50"].ToString();
  1235. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1236. return false;
  1237. }
  1238. if (Convert.ToInt32(IDC_EDIT_YSTART.Text.Trim()) > Convert.ToInt32(IDC_EDIT_YEND.Text.Trim()))
  1239. {
  1240. IDC_EDIT_YEND.Focus();
  1241. IDC_EDIT_YEND.SelectAll();
  1242. string message = table["message53"].ToString();
  1243. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1244. return false;
  1245. }
  1246. //颗粒尺寸范围
  1247. if (Convert.ToDouble(IDC_EDIT_PARTAREAMIN.Text.Trim()) > Convert.ToDouble(IDC_EDIT_PARTAREAMAX.Text.Trim()))
  1248. {
  1249. IDC_EDIT_PARTAREAMIN.Focus();
  1250. IDC_EDIT_PARTAREAMIN.SelectAll();
  1251. string message = table["message56"].ToString();
  1252. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1253. return false;
  1254. }
  1255. //背景灰度范围
  1256. if (Convert.ToInt32(IDC_EDIT_BACKMIN.Text.Trim()) > Convert.ToInt32(IDC_EDIT_BACKMAX.Text.Trim()))
  1257. {
  1258. IDC_EDIT_BACKMIN.Focus();
  1259. IDC_EDIT_BACKMIN.SelectAll();
  1260. string message = table["message57"].ToString();
  1261. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1262. return false;
  1263. }
  1264. //颗粒灰度范围
  1265. if (Convert.ToInt32(IDC_EDIT_PARTMIN.Text.Trim()) > Convert.ToInt32(IDC_EDIT_PARTMAX.Text.Trim()))
  1266. {
  1267. IDC_EDIT_PARTMIN.Focus();
  1268. IDC_EDIT_PARTMIN.SelectAll();
  1269. string message = table["message58"].ToString();
  1270. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1271. return false;
  1272. }
  1273. //最小放大倍数
  1274. if (false == rgpositiveInteger.Match(IDC_EDIT_XrayLimit.Text.Trim()).Success)
  1275. {
  1276. IDC_EDIT_XrayLimit.Focus();
  1277. IDC_EDIT_XrayLimit.SelectAll();
  1278. string message = table["message64"].ToString();
  1279. MessageBox.Show(message, "Tip", MessageBoxButtons.OK, MessageBoxIcon.Information);
  1280. return false;
  1281. }
  1282. return true;
  1283. }
  1284. /// <summary>
  1285. /// 判断当前样品台是否在被修改
  1286. /// </summary>
  1287. /// <returns></returns>
  1288. public bool IsModified()
  1289. {
  1290. return m_cstagefile.IsModified();
  1291. }
  1292. /// <summary>
  1293. /// 样品台保存
  1294. /// </summary>
  1295. /// <returns></returns>
  1296. public bool StageSave()
  1297. {
  1298. if (!m_cstagefile.Save())
  1299. {
  1300. log.Error("(OTSProgMgrInfoFun.StageLoad) Failed to save sample station information!");
  1301. return false;
  1302. }
  1303. return true;
  1304. }
  1305. private void btnok_Click(object sender, EventArgs e)
  1306. {
  1307. //先判断
  1308. if (false == CheckSetupValues(1))
  1309. {
  1310. return;
  1311. }
  1312. //先把各个值都保存到各类
  1313. m_cotsprogmgrparamfile.m_runmode = (RunMode)IDC_COMBO_Model.SelectedIndex;
  1314. SaveSEMStageData();
  1315. SaveImageScanPrm();
  1316. SaveCGenParam();
  1317. SaveImageProc();
  1318. SaveXRayParam();
  1319. //然后再把各类传入到SaveInfoToProgMgrFile函数中
  1320. if (false == SaveInfoToProgMgrFile())
  1321. {
  1322. return;
  1323. }
  1324. //保存样品台到文件,在被修改时进行保存
  1325. if (true == IsModified())
  1326. {
  1327. if (true == StageSave())
  1328. {
  1329. this.DialogResult = DialogResult.OK;
  1330. this.Close();
  1331. return;
  1332. }
  1333. else
  1334. {
  1335. string message = table["message54"].ToString();
  1336. log.Error("(ProgMgrInfoForm.btnok_Click) " + message);
  1337. this.Close();
  1338. return;
  1339. }
  1340. }
  1341. }
  1342. //关闭窗体
  1343. private void btncancel_Click(object sender, EventArgs e)
  1344. {
  1345. this.Close();
  1346. }
  1347. #endregion
  1348. #region 选择样品台事件
  1349. private void IDC_COMBO_STAGE_SelectedIndexChanged(object sender, EventArgs e)
  1350. {
  1351. //样品台
  1352. if (!StageLoad())
  1353. {
  1354. this.Close();
  1355. return;//加载失败返回
  1356. }
  1357. ThisSetIsModify();
  1358. }
  1359. /// <summary>
  1360. /// 通过id设置当前正在工作的样品台
  1361. /// </summary>
  1362. /// <param name="id"></param>
  1363. public void SetWorkingStageId(int id)
  1364. {
  1365. m_cstagefile.SetWorkingStageId(id);
  1366. }
  1367. /// <summary>
  1368. /// 设置当前样品台正在被修改中
  1369. /// </summary>
  1370. /// <param name="yn"></param>
  1371. public void SetModify(bool yn)
  1372. {
  1373. m_cstagefile.SetModify(true);
  1374. }
  1375. /// <summary>
  1376. /// 设置当前窗体可以保存了
  1377. /// </summary>
  1378. private void ThisSetIsModify()
  1379. {
  1380. ComboBoxItem cbi = new ComboBoxItem();
  1381. if (IDC_COMBO_STAGE.Items.Count > 0)
  1382. if (null != IDC_COMBO_STAGE.SelectedItem)
  1383. {
  1384. cbi = (ComboBoxItem)IDC_COMBO_STAGE.SelectedItem;
  1385. SetWorkingStageId(Convert.ToInt32(cbi.Value));
  1386. SetModify(true);
  1387. btnok.Enabled = true;
  1388. }
  1389. }
  1390. #endregion
  1391. #region 监视控件改变状态事件
  1392. private void IDC_EDIT_SCREENWIDTH_TextChanged(object sender, EventArgs e)
  1393. {
  1394. ThisSetIsModify();
  1395. }
  1396. private void IDC_COMBO_XDIREC_SelectedIndexChanged(object sender, EventArgs e)
  1397. {
  1398. ThisSetIsModify();
  1399. }
  1400. private void IDC_EDIT_XSTART_TextChanged(object sender, EventArgs e)
  1401. {
  1402. ThisSetIsModify();
  1403. }
  1404. private void IDC_EDIT_XEND_TextChanged(object sender, EventArgs e)
  1405. {
  1406. ThisSetIsModify();
  1407. }
  1408. private void IDC_COMBO_YDIRECT_SelectedIndexChanged(object sender, EventArgs e)
  1409. {
  1410. ThisSetIsModify();
  1411. }
  1412. private void IDC_EDIT_YSTART_TextChanged(object sender, EventArgs e)
  1413. {
  1414. ThisSetIsModify();
  1415. }
  1416. private void IDC_EDIT_YEND_TextChanged(object sender, EventArgs e)
  1417. {
  1418. ThisSetIsModify();
  1419. }
  1420. private void IDC_EDIT_MINMAG_TextChanged(object sender, EventArgs e)
  1421. {
  1422. ThisSetIsModify();
  1423. }
  1424. private void IDC_COMBO_STOPMODE_SelectedIndexChanged(object sender, EventArgs e)
  1425. {
  1426. ThisSetIsModify();
  1427. }
  1428. private void IDC_EDIT_STOP_TIME_TextChanged(object sender, EventArgs e)
  1429. {
  1430. ThisSetIsModify();
  1431. }
  1432. private void IDC_EDIT_STOP_FIELD_NUM_TextChanged(object sender, EventArgs e)
  1433. {
  1434. ThisSetIsModify();
  1435. }
  1436. private void IDC_EDIT_STOP_INCA_NUM_TextChanged(object sender, EventArgs e)
  1437. {
  1438. ThisSetIsModify();
  1439. }
  1440. private void IDC_COMBO_FETCHIMGMODE_SelectedIndexChanged(object sender, EventArgs e)
  1441. {
  1442. ThisSetIsModify();
  1443. }
  1444. private void IDC_COMBO_IMGSCANSPEED_SelectedIndexChanged(object sender, EventArgs e)
  1445. {
  1446. ThisSetIsModify();
  1447. }
  1448. private void IDC_COMBO_IMGSIZE_SelectedIndexChanged(object sender, EventArgs e)
  1449. {
  1450. ThisSetIsModify();
  1451. }
  1452. private void IDC_EDIT_SAMPLENAME_TextChanged(object sender, EventArgs e)
  1453. {
  1454. ThisSetIsModify();
  1455. }
  1456. private void IDC_MEAS_SWITCH_CheckedChanged(object sender, EventArgs e)
  1457. {
  1458. ThisSetIsModify();
  1459. }
  1460. private void IDC_EDIT_MEASUREPARAMPATH_TextChanged(object sender, EventArgs e)
  1461. {
  1462. ThisSetIsModify();
  1463. }
  1464. private void IDC_EDIT_ANALYSESTDLIBPATH_TextChanged(object sender, EventArgs e)
  1465. {
  1466. ThisSetIsModify();
  1467. }
  1468. private void IDC_EDIT_STDLIBNAME_TextChanged(object sender, EventArgs e)
  1469. {
  1470. ThisSetIsModify();
  1471. }
  1472. private void IDC_EDIT_PARTAREAMIN_TextChanged(object sender, EventArgs e)
  1473. {
  1474. ThisSetIsModify();
  1475. }
  1476. private void IDC_EDIT_PARTAREAMAX_TextChanged(object sender, EventArgs e)
  1477. {
  1478. ThisSetIsModify();
  1479. }
  1480. private void IDC_EDIT_BACKMIN_TextChanged(object sender, EventArgs e)
  1481. {
  1482. ThisSetIsModify();
  1483. }
  1484. private void IDC_EDIT_BACKMAX_TextChanged(object sender, EventArgs e)
  1485. {
  1486. ThisSetIsModify();
  1487. }
  1488. private void IDC_EDIT_PARTMIN_TextChanged(object sender, EventArgs e)
  1489. {
  1490. ThisSetIsModify();
  1491. }
  1492. private void IDC_EDIT_PARTMAX_TextChanged(object sender, EventArgs e)
  1493. {
  1494. ThisSetIsModify();
  1495. }
  1496. private void IDC_COMBO_AUTOBGREMOVETYPE_SelectedIndexChanged(object sender, EventArgs e)
  1497. {
  1498. ThisSetIsModify();
  1499. }
  1500. private void IDC_COMBO_BGREMOVETYPE_SelectedIndexChanged(object sender, EventArgs e)
  1501. {
  1502. ComboBox cbBGREMOVETYPE = (ComboBox)sender;
  1503. int selectValue=Convert.ToInt32(((OTSMeasureApp.ComboBoxItem)cbBGREMOVETYPE.Items[cbBGREMOVETYPE.SelectedIndex]).Value);
  1504. if (selectValue == (int)otsdataconst.OTS_AUTOBGREMOVETYPE.MANUAL)
  1505. {
  1506. IDC_COMBO_AUTOBGREMOVETYP.Enabled = false;
  1507. }
  1508. else
  1509. {
  1510. IDC_COMBO_AUTOBGREMOVETYP.Enabled = true;
  1511. }
  1512. ThisSetIsModify();
  1513. }
  1514. private void IDC_COMBO_SEARCHXRAYSPEED_SelectedIndexChanged(object sender, EventArgs e)
  1515. {
  1516. ThisSetIsModify();
  1517. }
  1518. private void IDC_EDIT_SEARCHXRAYCOUNTLIMIT_TextChanged(object sender, EventArgs e)
  1519. {
  1520. ThisSetIsModify();
  1521. }
  1522. private void IDC_COMBO_XRAYSCANMODE_SelectedIndexChanged(object sender, EventArgs e)
  1523. {
  1524. ThisSetIsModify();
  1525. }
  1526. private void IDC_COMBO_ANALYXRAYSPEED_SelectedIndexChanged(object sender, EventArgs e)
  1527. {
  1528. ThisSetIsModify();
  1529. }
  1530. private void IDC_EDIT_ANALYXRAYAIMVALUE_TextChanged(object sender, EventArgs e)
  1531. {
  1532. ThisSetIsModify();
  1533. }
  1534. private void IDC_COMBO_TECHNOLOGY_SelectedIndexChanged(object sender, EventArgs e)
  1535. {
  1536. ThisSetIsModify();
  1537. }
  1538. private void IDC_STOP_MODE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1539. {
  1540. ThisSetIsModify();
  1541. }
  1542. private void IDC_STOP_TIME_SWITCH_CheckedChanged(object sender, EventArgs e)
  1543. {
  1544. ThisSetIsModify();
  1545. }
  1546. private void IDC_STOP_FIELD_SWITCH_CheckedChanged(object sender, EventArgs e)
  1547. {
  1548. ThisSetIsModify();
  1549. }
  1550. private void IDC_STOP_PARTICAL_SWITCH_CheckedChanged(object sender, EventArgs e)
  1551. {
  1552. ThisSetIsModify();
  1553. }
  1554. private void IDC_FETCH_IMAGE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1555. {
  1556. ThisSetIsModify();
  1557. }
  1558. private void IDC_SCAN_SPEED_SWITCH_CheckedChanged(object sender, EventArgs e)
  1559. {
  1560. ThisSetIsModify();
  1561. }
  1562. private void IDC_IMAGE_SIZE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1563. {
  1564. ThisSetIsModify();
  1565. }
  1566. private void IDC_PART_MIN_SWITCH_CheckedChanged(object sender, EventArgs e)
  1567. {
  1568. ThisSetIsModify();
  1569. }
  1570. private void IDC_PART_MAX_SWITCH_CheckedChanged(object sender, EventArgs e)
  1571. {
  1572. ThisSetIsModify();
  1573. }
  1574. private void IDC_BACK_MIN_SWITCH_CheckedChanged(object sender, EventArgs e)
  1575. {
  1576. ThisSetIsModify();
  1577. }
  1578. private void IDC_BACK_MAX_SWITCH_CheckedChanged(object sender, EventArgs e)
  1579. {
  1580. ThisSetIsModify();
  1581. }
  1582. private void IDC_PART_GRAY_SWITCH_CheckedChanged(object sender, EventArgs e)
  1583. {
  1584. ThisSetIsModify();
  1585. }
  1586. private void IDC_PART_GRAY_MAX_CheckedChanged(object sender, EventArgs e)
  1587. {
  1588. ThisSetIsModify();
  1589. }
  1590. private void IDC_XRAY_MODE_SWITCH_CheckedChanged(object sender, EventArgs e)
  1591. {
  1592. ThisSetIsModify();
  1593. }
  1594. private void IDC_XRAY_TIME_SWITCH_CheckedChanged(object sender, EventArgs e)
  1595. {
  1596. ThisSetIsModify();
  1597. }
  1598. private void IDC_XRAY_COUNT_SWITCH_CheckedChanged(object sender, EventArgs e)
  1599. {
  1600. ThisSetIsModify();
  1601. }
  1602. private void cBMeasShape_SelectedIndexChanged(object sender, EventArgs e)
  1603. {
  1604. ThisSetIsModify();
  1605. }
  1606. private void tBMeasArea_TextChanged(object sender, EventArgs e)
  1607. {
  1608. ThisSetIsModify();
  1609. }
  1610. private void IDC_SYS_LIB_CheckedChanged(object sender, EventArgs e)
  1611. {
  1612. ThisSetIsModify();
  1613. }
  1614. #endregion
  1615. private void IDC_COMBO_STDSelect_SelectedIndexChanged(object sender, EventArgs e)
  1616. {
  1617. ThisSetIsModify();
  1618. }
  1619. private void IDC_COMBO_USINGXRAYS_SelectedIndexChanged(object sender, EventArgs e)
  1620. {
  1621. ThisSetIsModify();
  1622. }
  1623. private void IDC_COMBO_Model_SelectedIndexChanged(object sender, EventArgs e)
  1624. {
  1625. ThisSetIsModify();
  1626. }
  1627. private void btn_StopMode_Click(object sender, EventArgs e)
  1628. {
  1629. if (StopModeDialog == null)
  1630. {
  1631. StopModeDialog = new frmMeasureStopMode();
  1632. StopModeDialog.FieldMode = m_cotsimgscanprm.GetStopParamFields();
  1633. StopModeDialog.TimeMode = m_cotsimgscanprm.GetStopParamMeasTime();
  1634. StopModeDialog.ParticleMode = m_cotsimgscanprm.GetStopParamParticles();
  1635. StopModeDialog.AreaMode = m_cotsimgscanprm.GetStopParamArea();
  1636. StopModeDialog.StopMode = tB_StopMode.Text;
  1637. }
  1638. DialogResult result = StopModeDialog.ShowDialog();
  1639. if (result == DialogResult.OK)
  1640. {
  1641. string[] rst = StopModeDialog.StopMode.Split(',');
  1642. string str = "";
  1643. for (int k = 0; k < rst.Length; k++)
  1644. {
  1645. str += rst[k].Split(':')[0] + " + ";
  1646. }
  1647. tB_StopMode.Text = str.Substring(0, str.Length - 3);
  1648. }
  1649. }
  1650. private void IDC_COMBO_CorrosionExpansionCoefficient_TextChanged(object sender, EventArgs e)
  1651. {
  1652. ThisSetIsModify();
  1653. }
  1654. private void button_SpPart_Click(object sender, EventArgs e)
  1655. {
  1656. }
  1657. private void checkBox_Run_CheckedChanged(object sender, EventArgs e)
  1658. {
  1659. }
  1660. private void btn_otherselection_Click(object sender, EventArgs e)
  1661. {
  1662. if (otherSelectionForm == null)
  1663. {
  1664. otherSelectionForm = new _7_OTSProgMgrInfo.OtherSelectionForm();
  1665. otherSelectionForm.OtherSelection = m_cotsimgprocprm.GetParticleSelectCondition();
  1666. }
  1667. DialogResult result = otherSelectionForm.ShowDialog();
  1668. if (result == DialogResult.OK)
  1669. {
  1670. m_cotsimgprocprm.SetParticleSelectCondition(otherSelectionForm.OtherSelection);
  1671. if (otherSelectionForm.OtherSelection == "")
  1672. {
  1673. IDC_EDIT_OTHERSELECTION.Text = "NoFilter";
  1674. }
  1675. else
  1676. {
  1677. IDC_EDIT_OTHERSELECTION.Text = otherSelectionForm.OtherSelection;
  1678. }
  1679. }
  1680. }
  1681. private void radioButton1_CheckedChanged(object sender, EventArgs e)
  1682. {
  1683. if (radioButton1.Checked)
  1684. {
  1685. elementchoose.Enabled = false;
  1686. }
  1687. }
  1688. int ReturnsAtomicNumberByElementName(string ElementName)
  1689. {
  1690. switch (ElementName)
  1691. {
  1692. case "H": return 1;
  1693. case "He": return 2;
  1694. case "Li": return 3;
  1695. case "Be": return 4;
  1696. case "B": return 5;
  1697. case "C": return 6;
  1698. case "N": return 7;
  1699. case "O": return 8;
  1700. case "F": return 9;
  1701. case "Ne": return 10;
  1702. case "Na": return 11;
  1703. case "Mg": return 12;
  1704. case "Al": return 13;
  1705. case "Si": return 14;
  1706. case "P": return 15;
  1707. case "S": return 16;
  1708. case "Cl": return 17;
  1709. case "Ar": return 18;
  1710. case "K": return 19;
  1711. case "Ca": return 20;
  1712. case "Sc": return 21;
  1713. case "Ti": return 22;
  1714. case "V": return 23;
  1715. case "Cr": return 24;
  1716. case "Mn": return 25;
  1717. case "Fe": return 26;
  1718. case "Co": return 27;
  1719. case "Ni": return 28;
  1720. case "Cu": return 29;
  1721. case "Zn": return 30;
  1722. case "Ga": return 31;
  1723. case "Ge": return 32;
  1724. case "As": return 33;
  1725. case "Se": return 34;
  1726. case "Br": return 35;
  1727. case "Kr": return 36;
  1728. case "Rb": return 37;
  1729. case "Sr": return 38;
  1730. case "Y": return 39;
  1731. case "Zr": return 40;
  1732. case "Nb": return 41;
  1733. case "Mo": return 42;
  1734. case "Tc": return 43;
  1735. case "Ru": return 44;
  1736. case "Rh": return 45;
  1737. case "Pd": return 46;
  1738. case "Ag": return 47;
  1739. case "Cd": return 48;
  1740. case "In": return 49;
  1741. case "Sn": return 50;
  1742. case "Sb": return 51;
  1743. case "Te": return 52;
  1744. case "I": return 53;
  1745. case "Xe": return 54;
  1746. case "Cs": return 55;
  1747. case "Ba": return 56;
  1748. case "La": return 57;
  1749. case "Ce": return 58;
  1750. case "Pr": return 59;
  1751. case "Nd": return 60;
  1752. case "Pm": return 61;
  1753. case "Sm": return 62;
  1754. case "Eu": return 63;
  1755. case "Gd": return 64;
  1756. case "Tb": return 65;
  1757. case "Dy": return 66;
  1758. case "Ho": return 67;
  1759. case "Er": return 68;
  1760. case "Tm": return 69;
  1761. case "Yb": return 70;
  1762. case "Lu": return 71;
  1763. case "Hf": return 72;
  1764. case "Ta": return 73;
  1765. case "W": return 74;
  1766. case "Re": return 75;
  1767. case "Os": return 76;
  1768. case "Ir": return 77;
  1769. case "Pt": return 78;
  1770. case "Au": return 79;
  1771. case "Hq": return 80;
  1772. case "TI": return 81;
  1773. case "Pb": return 82;
  1774. case "Bi": return 83;
  1775. case "Po": return 84;
  1776. case "At": return 85;
  1777. case "Rn": return 86;
  1778. case "Fr": return 87;
  1779. case "Ra": return 88;
  1780. case "Ac": return 89;
  1781. case "Th": return 90;
  1782. case "Pa": return 91;
  1783. case "U": return 92;
  1784. case "Np": return 93;
  1785. case "Pu": return 94;
  1786. case "Am": return 95;
  1787. case "Cm": return 96;
  1788. case "Bk": return 97;
  1789. case "Cf": return 98;
  1790. case "Es": return 99;
  1791. case "Fm": return 100;
  1792. case "Mc": return 101;
  1793. case "No": return 102;
  1794. case "Lr": return 103;
  1795. case "Rf": return 104;
  1796. case "Db": return 105;
  1797. case "Sg": return 106;
  1798. case "Bh": return 107;
  1799. case "Hs": return 108;
  1800. case "Mt": return 109;
  1801. case "Ds": return 110;
  1802. case "Rg": return 111;
  1803. case "Unb": return 112;
  1804. default: return 1000;
  1805. }
  1806. }
  1807. private void button1_Click(object sender, EventArgs e)
  1808. {
  1809. OTSPeriodicTable.OTSPeriodicTableForm_Small opts = new OTSPeriodicTable.OTSPeriodicTableForm_Small();
  1810. //获取需要显示的元素列表,并转换成元素周期表窗体可接受的格式,传入----------------------
  1811. string str_xsys = tb_xsys.Text.Trim();
  1812. List<string> list_str = new List<string>();
  1813. string[] strs = str_xsys.Split(',');
  1814. for (int i = 0; i < strs.Length; i++)
  1815. {
  1816. list_str.Add(strs[i]);
  1817. }
  1818. //清除元素周期表中所有的记录
  1819. opts.m_List_Periodic.Clear();
  1820. //将该分类下的元素添加到元素周期表窗体的List_periodic中
  1821. for (int i = 0; i < strs.Length; i++)
  1822. {
  1823. string str_ysm = strs[i];
  1824. Periodic ls_periodic = new Periodic();
  1825. ls_periodic = CListPeriodic.GetPeriodicByEleName(str_ysm);
  1826. opts.m_List_Periodic.Add(ls_periodic);
  1827. }
  1828. //----------------------------------------------------------------------------------------
  1829. opts.StartPosition = FormStartPosition.CenterScreen;
  1830. opts.ShowDialog();
  1831. List<string> PeriodicFH = new List<string>();
  1832. for (int j = 0; j < opts.m_List_Periodic.Count; j++)
  1833. {
  1834. PeriodicFH.Add(opts.m_List_Periodic[j].Symbol);
  1835. }
  1836. PeriodicFH.Sort(delegate (string a, string b) { return ReturnsAtomicNumberByElementName(a).CompareTo(ReturnsAtomicNumberByElementName(b)); });//排序 从小到大原子序数
  1837. list_str = list_str.FindAll(delegate (string a) { return PeriodicFH.Contains(a); });
  1838. PeriodicFH = PeriodicFH.FindAll(delegate (string a) { return !list_str.Contains(a); });
  1839. //先清空元素
  1840. str_xsys = "";
  1841. //然后再将选择的元素,组合起来,返回显示到该窗体上
  1842. for (int i = 0; i < list_str.Count; i++)
  1843. {
  1844. if (str_xsys == "")
  1845. {
  1846. str_xsys = list_str[i];
  1847. }
  1848. else
  1849. {
  1850. str_xsys = str_xsys + "," + list_str[i];
  1851. }
  1852. }
  1853. for (int i = 0; i < PeriodicFH.Count; i++)
  1854. {
  1855. if (str_xsys == "")
  1856. {
  1857. str_xsys = PeriodicFH[i];
  1858. }
  1859. else
  1860. {
  1861. str_xsys = str_xsys + "," + PeriodicFH[i];
  1862. }
  1863. }
  1864. //再对选择的元素进行显示
  1865. tb_xsys.Text = str_xsys;
  1866. }
  1867. private void radioButton2_CheckedChanged(object sender, EventArgs e)
  1868. {
  1869. if (radioButton2.Checked)
  1870. {
  1871. elementchoose.Enabled = true;
  1872. }
  1873. }
  1874. }
  1875. public class ComboBoxItem
  1876. {
  1877. private string _text = null;
  1878. private object _value = null;
  1879. public string Text { get { return this._text; } set { this._text = value; } }
  1880. public object Value { get { return this._value; } set { this._value = value; } }
  1881. public override string ToString()
  1882. {
  1883. return this._text;
  1884. }
  1885. }
  1886. }