SpheroidizationGradingDialog.cs 142 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037
  1. using OpenCvSharp;
  2. using PaintDotNet.Annotation.Enum;
  3. using PaintDotNet.Base;
  4. using PaintDotNet.Base.Functionodel;
  5. using PaintDotNet.CustomControl;
  6. using PaintDotNet.Data.Param;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Data;
  11. using System.Drawing;
  12. using System.IO;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Threading.Tasks;
  16. using System.Windows.Forms;
  17. using PaintDotNet.DbOpreate.DbBll;
  18. using PaintDotNet.DbOpreate.DbModel;
  19. using PaintDotNet.Base.CommTool;
  20. using PaintDotNet.Instrument;
  21. using PaintDotNet.Annotation;
  22. using static PaintDotNet.Base.DedicatedAnalysis.Inclusions.MethodOfAssessment;
  23. using PaintDotNet.Base.SettingModel;
  24. using OpenCvSharp.Extensions;
  25. using PaintDotNet.DedicatedAnalysis.DuctileIron.Common;
  26. using Metis.ParameterSet;
  27. namespace PaintDotNet.DedicatedAnalysis.SpheroidizedStructure.GBT38770
  28. {
  29. /// <summary>
  30. /// 低中碳钢球化组织
  31. /// </summary>
  32. internal class SpheroidizationGradingDialog : PdnBaseForm
  33. {
  34. #region 控件
  35. private GroupBox groupBox2;
  36. private GroupBox groupBox1;
  37. private Button button2;
  38. private CheckBox checkBox2;
  39. private Button button1;
  40. private GroupBox groupBox7;
  41. private GroupBox groupBox8;
  42. private ListView listView2;
  43. private NumericUpDown numericUpDown1;
  44. private Button button16;
  45. private Label label5;
  46. private Button button14;
  47. private Button button13;
  48. private DataGridView dataGridView4;
  49. private Button button12;
  50. private Button button11;
  51. private ImageList imageList1;
  52. private IContainer components;
  53. private Button button3;
  54. private GroupBox groupBox5;
  55. private GroupBox groupBox6;
  56. private GroupBox groupBox9;
  57. private GroupBox groupBox10;
  58. private GroupBox groupBox11;
  59. private Label label8;
  60. private Panel panel1;
  61. private Label label7;
  62. private Label label9;
  63. private Panel panel2;
  64. private Label label10;
  65. private RadioButton radioButton3;
  66. private RadioButton radioButton2;
  67. private RadioButton radioButton1;
  68. private CheckBox checkBox4;
  69. private DataGridView dataGridView1;
  70. private ListView listView1;
  71. #endregion
  72. private CommonControlButtons commonControlButtons;
  73. /// <summary>
  74. /// 主控件
  75. /// </summary>
  76. private AppWorkspace appWorkspace;
  77. /// <summary>
  78. /// 初始系统参数配置值
  79. /// </summary>
  80. private BinaryExtractionModel binaryExtractionModel;
  81. /// <summary>
  82. /// 图像面板
  83. /// </summary>
  84. private DocumentWorkspaceWindow documentWorkspace;
  85. /// <summary>
  86. /// 选中图片的mat
  87. /// </summary>
  88. private Mat imageMat;
  89. /// <summary>
  90. /// 保存用于生成报告的图片
  91. /// </summary>
  92. private List<Bitmap> bitList;
  93. /// <summary>
  94. /// 储存点击保存结果后的所有原图与分析图
  95. /// </summary>
  96. private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
  97. /// <summary>
  98. /// 处理程序
  99. /// </summary>
  100. private ParamObject action = new Data.Action.Action1010();
  101. /// <summary>
  102. /// 标尺
  103. /// </summary>
  104. private double unitLength;
  105. /// <summary>
  106. /// 分析结果暂存
  107. /// </summary>
  108. private List<System.Data.DataTable> dataTables = new List<System.Data.DataTable>();
  109. /// <summary>
  110. /// 是否要调用二值化的算法
  111. /// </summary>
  112. private bool toApplyBinary = true;
  113. private decimal maxArea = 0;
  114. /// <summary>
  115. /// 存在视场标记
  116. /// </summary>
  117. private bool existViewFlag = false;
  118. /// <summary>
  119. /// 全部显示
  120. /// </summary>
  121. private bool allShow = false;
  122. /// <summary>
  123. /// 当前选择的图片
  124. /// </summary>
  125. private Mat mat;
  126. /// <summary>
  127. /// 球状碳化物面积
  128. /// </summary>
  129. private double sphericalArea;
  130. /// <summary>
  131. /// 片状碳化物面积
  132. /// </summary>
  133. private double flakArea;
  134. /// <summary>
  135. /// 独立碳化物面积
  136. /// </summary>
  137. private double independentArea;
  138. //二值化集成1
  139. BinaryClass binaryClass;
  140. private int menuId;
  141. private string menuName;
  142. /// <summary>
  143. /// 中间数据
  144. /// </summary>
  145. private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
  146. /// <summary>
  147. /// 轮廓质点
  148. /// </summary>
  149. private Dictionary<Point2d, decimal> keyValuePairs = new Dictionary< Point2d, decimal>();
  150. /// <summary>
  151. /// 轮廓质点(多视场)
  152. /// </summary>
  153. private List<Dictionary<Point2d, decimal>> keyValuePairsList = new List<Dictionary<Point2d, decimal>>();
  154. /// <summary>
  155. /// 切换图片
  156. /// </summary>
  157. private bool init = true;
  158. private string oldValueT1 = "0";
  159. private string oldValueT2 = "0";
  160. /// <summary>
  161. /// 二值化后的mat
  162. /// </summary>
  163. private Mat binarizationMat;
  164. private ColorsForm colorsForm1;
  165. private ColorsForm colorsForm2;
  166. private TextBox textBox1;
  167. private TextBox textBox2;
  168. private DataGridViewTextBoxColumn Column11;
  169. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
  170. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
  171. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
  172. private DataGridViewTextBoxColumn Column1;
  173. private DataGridViewTextBoxColumn Column2;
  174. private DataGridViewTextBoxColumn Column5;
  175. private DataGridViewTextBoxColumn Column6;
  176. private DataGridViewTextBoxColumn Column7;
  177. private Button button4;
  178. private ColorsForm colorsForm3;
  179. private BinaryControl bc;
  180. private AppCommon appCommon;
  181. private Label label1;
  182. private NumericUpDown numericUpDown2;
  183. private int defaultIndex = -1;
  184. private bool isExportResults = false;
  185. private bool isExportReports = false;
  186. private bool isExportProjects = false;
  187. /// <summary>
  188. /// 是否脚本运行
  189. /// </summary>
  190. private Boolean initScriptValues = false;
  191. // <summary>
  192. /// 保存窗口参数
  193. /// </summary>
  194. /// <summary>
  195. /// 各个图片对应数据
  196. /// </summary>
  197. private Dictionary<string, GrainSizeAnalysisModel> eachData = new Dictionary<string, GrainSizeAnalysisModel>();
  198. private const string ParamKey_Report = "report";//报告设置
  199. private const string ParamKey_GlobularColour = "globularColour";//球状颜色
  200. private const string ParamKey_LessThan = "lessThan";//长宽比小于
  201. private const string ParamKey_FlakyColour = "flakyColour";//片状颜色
  202. private const string ParamKey_GreaterThan = "greaterTha";//长宽比大于
  203. private const string ParamKey_LowCarbon = "lowCarbon";//低碳碳素结构
  204. private const string ParamKey_MediumCarbon = "mediumCarbon";//中碳碳素结构
  205. private const string ParamKey_MediumCarbonAlloy = "mediumCarbonAlloy";//中碳合金结构
  206. private const string ParamKey_ShowAspectRatio = "showAspectRatio";//显示长宽比
  207. private const string ParamKey_FontSize = "fontSize";//字号
  208. private Button button5;
  209. private Button button6;
  210. private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数
  211. public SpheroidizationGradingDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem)
  212. {
  213. this.menuId = menuItem.MenuId;
  214. this.menuName = menuItem.Text;
  215. binaryClass = new BinaryClass(menuId);
  216. NullKey();
  217. InitializeComponent();
  218. InitializeLanguageText();
  219. this.button11.Visible = true;
  220. this.button16.Visible = false;
  221. //调色板
  222. this.colorsForm1 = new ColorsForm();
  223. this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
  224. this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  225. //调色板
  226. this.colorsForm2 = new ColorsForm();
  227. this.colorsForm2.StartPosition = FormStartPosition.CenterScreen;
  228. this.colorsForm2.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  229. //调色板
  230. this.colorsForm3 = new ColorsForm();
  231. this.colorsForm3.StartPosition = FormStartPosition.CenterScreen;
  232. this.colorsForm3.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  233. this.appWorkspace = appWorkspace;
  234. this.documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
  235. this.documentWorkspace.Dock = DockStyle.Fill;
  236. this.documentWorkspace.HookMouseEvents();
  237. //this.documentWorkspace.AuxiliaryLineEnabled = false;
  238. this.documentWorkspace.Visible = false;
  239. this.groupBox7.Controls.Add(documentWorkspace);
  240. this.commonControlButtons = new CommonControlButtons();
  241. this.commonControlButtons.Dock = DockStyle.Top;
  242. this.commonControlButtons.Height = 30;
  243. this.commonControlButtons.HideZoomToWindowAndActualSize();
  244. this.commonControlButtons.Visible = false;
  245. this.groupBox7.Controls.Add(commonControlButtons);
  246. //初始化头
  247. this.listView2.View = View.Details;
  248. ColumnHeader header0 = new ColumnHeader();
  249. header0.Text = "";
  250. header0.Width = 180;
  251. this.listView2.Columns.Add(header0);
  252. documentWorkspace.panel.Paint += Panel_Paint;
  253. // 标尺
  254. //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength);
  255. Init();
  256. InitPicList();
  257. this.listView1.SelectedIndexChanged += new EventHandler(this.ListViewSelectedIndexChanged);
  258. SetStyle(ControlStyles.UserPaint, true);
  259. SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
  260. SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
  261. InitCommonButtonEvent();
  262. SetAnalyzeModelFromXml("Template.Manager.item3.SpheroidizationGrading");
  263. //二值化集成2
  264. bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
  265. binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text"), PdnResources.GetString("Menu.Grainboundarytoreproduce.text") }
  266. , this.bc, this.appWorkspace, this.documentWorkspace, this.listView1);//初始化相的工作结构
  267. binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
  268. for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
  269. {
  270. this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  271. }
  272. for (int i = 0; i < this.dataGridView4.Columns.Count; i++)
  273. {
  274. this.dataGridView4.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  275. }
  276. }
  277. private void ShowImgEvent(object sender, EventArgs e)
  278. {
  279. listView1.Focus();
  280. if (this.defaultIndex != -1)
  281. {
  282. this.listView1.Items[defaultIndex].Focused = true;
  283. this.listView1.Items[defaultIndex].Selected = true;
  284. //如果是脚本执行,将参数带入
  285. if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
  286. {
  287. this.initScriptValues = true;//ScriptAutomatic
  288. //Boolean initScriptValues = true;
  289. ////在这里反射出对应功能的参数类
  290. string className = InvariantData.path_Action + ".Action" + menuId;
  291. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  292. foreach (Args arg in param.Lists)
  293. {
  294. Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
  295. if (param1.value != null)
  296. arg.Value = param1.value;
  297. getValue(arg.key, arg.Value);
  298. }
  299. appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
  300. }
  301. else
  302. {//读取上次关闭窗口时保存的参数
  303. GetXmlParameter();
  304. }
  305. if (this.initScriptValues && this.appWorkspace.ScriptAutomatic)
  306. this.startScriptAutomaticAction();
  307. }
  308. }
  309. //二值化集成3
  310. #region 二值化相关方法
  311. private void InclusionsStandardDialog_FormClosing(object sender, FormClosingEventArgs e)
  312. {
  313. #region [开启脚本录制]
  314. if (appWorkspace.startScriptRecording)
  315. {
  316. getScriptRecording();
  317. }
  318. #endregion
  319. binaryClass.saveParams();
  320. this.saveDialogParamValues();
  321. //xml保存路径
  322. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  323. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  324. foreach (var analysisItem in this.eachData[GetImgKey()].ListParam)
  325. {
  326. bool foundItem = false;
  327. foreach (var item in analysisModelXml.ListParam)
  328. {
  329. if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
  330. {
  331. item.param_value = analysisItem.param_value;
  332. foundItem = true;
  333. break;
  334. }
  335. }
  336. if (!foundItem)
  337. analysisModelXml.ListParam.Add(analysisItem.cloneModel());
  338. }
  339. //按路径和名称保存xml文件
  340. string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
  341. //保存xml
  342. FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
  343. }
  344. private void ShownChoiseItemAndInitData(object sender, EventArgs e)
  345. {
  346. binaryClass.RefreshHistogramControl1Values();
  347. }
  348. /// <summary>
  349. /// 添加参数改变的监听
  350. /// </summary>
  351. /// <param name="sender"></param>
  352. /// <param name="e"></param>
  353. private void SpheroidizationGradingDialog_Load(object sender, EventArgs e)
  354. {
  355. this.binaryClass.loadParams();
  356. }
  357. private bool bcBinaryChecked()
  358. {
  359. return bc != null && bc.BinaryChecked;
  360. }
  361. private bool bcOriginChecked()
  362. {
  363. return bc != null && bc.OriginChecked;
  364. }
  365. /// <summary>
  366. /// 参数改变时,重新处理图像
  367. /// </summary>
  368. /// <param name="sender"></param>
  369. /// <param name="e"></param>
  370. private void bClassBinaryImplFinishAction(object sender, EventArgs e)
  371. {
  372. if (this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
  373. {
  374. binarizationMat = this.documentWorkspace.PhaseModels[0].mat;
  375. ScreeningSpheroidizedTissue(this.panel1.BackColor, Convert.ToDecimal(this.textBox1.Text), this.panel2.BackColor, Convert.ToDecimal(this.textBox2.Text));
  376. ResultsDisplay();
  377. }
  378. this.documentWorkspace.Refresh();
  379. }
  380. /// <summary>
  381. /// 显示原图/原图+二值图
  382. /// </summary>
  383. /// <param name="sender"></param>
  384. /// <param name="e"></param>
  385. private void bcOriginCheckedChanged(object sender, EventArgs e)
  386. {
  387. if (!bcOriginChecked())
  388. {
  389. if (bcBinaryChecked())
  390. this.documentWorkspace.PhaseModels[0].choise = true;
  391. }
  392. else
  393. {
  394. this.documentWorkspace.PhaseModels[0].choise = false;
  395. this.documentWorkspace.PhaseModels[1].choise = false;
  396. }
  397. this.documentWorkspace.Refresh();
  398. }
  399. #endregion
  400. /// <summary>
  401. /// 初始化图片列表数据
  402. /// </summary>
  403. public void InitPicList()
  404. {
  405. //初始化图片列表
  406. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  407. {
  408. this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  409. this.listView1.Items.Add("", i);
  410. this.listView1.Items[i].ImageIndex = i;
  411. this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  412. this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  413. if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
  414. {
  415. defaultIndex = i;
  416. }
  417. }
  418. this.Shown += ShowImgEvent;
  419. }
  420. private void Init()
  421. {
  422. this.init = false;
  423. this.dataGridView1.Rows.Clear();
  424. this.documentWorkspace.phaseModels.Clear();
  425. this.checkBox4.Checked = false;
  426. this.textBox1.Text = "5";
  427. this.textBox2.Text = "5";
  428. this.init = true;
  429. }
  430. #region 初始化
  431. private void InitializeLanguageText()
  432. {
  433. this.bc = new PaintDotNet.CustomControl.BinaryControl();
  434. //
  435. // bc
  436. //
  437. this.bc.BinaryBackColor = System.Drawing.Color.Red;
  438. this.bc.BinaryChecked = false;
  439. this.bc.BinaryStyle = 1;
  440. this.bc.Location = new System.Drawing.Point(151, 59);
  441. this.bc.Name = "bc";
  442. this.bc.OriginChecked = false;
  443. this.bc.scope1End = 0D;
  444. this.bc.scope1Start = 0D;
  445. this.bc.scope2End = 0D;
  446. this.bc.scope2Start = 0D;
  447. this.bc.scope3End = 0D;
  448. this.bc.scope3Start = 0D;
  449. this.bc.Size = new System.Drawing.Size(360, 292);
  450. this.bc.TabIndex = 20;
  451. this.Controls.Add(this.bc);
  452. this.Controls.SetChildIndex(this.bc, 0);
  453. this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  454. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  455. this.button3.Text = PdnResources.GetString("Menu.Edit.Text");
  456. this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
  457. this.checkBox2.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  458. this.button1.Text = PdnResources.GetString("Menu.Setting.Text");
  459. this.groupBox7.Text = PdnResources.GetString("Menu.Preview.text");
  460. this.groupBox8.Text = PdnResources.GetString("Menu.Analysisresult.text");
  461. this.button4.Text = PdnResources.GetString("Menu.Exportproject.text");
  462. this.button16.Text = PdnResources.GetString("Menu.Cancelshowall.text");
  463. this.label5.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
  464. this.button14.Text = PdnResources.GetString("Menu.Exportresults.text");
  465. this.button13.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  466. this.Column1.HeaderText = PdnResources.GetString("Menu.picture.Text");
  467. this.Column2.HeaderText = PdnResources.GetString("Menu.view.text");
  468. this.Column5.HeaderText = PdnResources.GetString("Menu.nodularity.text");
  469. this.Column6.HeaderText = PdnResources.GetString("Menu.organizationcharacteristics.text");
  470. this.Column7.HeaderText = PdnResources.GetString("Menu.grade.text");
  471. this.button12.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  472. this.button11.Text = PdnResources.GetString("Menu.Showall.text");
  473. this.groupBox5.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Sphericalcarbide.text");
  474. this.label8.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Aspectratioislessthan.text") + ":";
  475. this.label7.Text = PdnResources.GetString("Menu.color.text") + ":";
  476. this.groupBox6.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.lamellarpearlite.text");
  477. this.label9.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Aspectrterthan.text") + ":";
  478. this.label10.Text = PdnResources.GetString("Menu.color.text") + ":";
  479. this.groupBox9.Text = PdnResources.GetString("Menu.Measurementofsteelgrade.text");
  480. this.radioButton3.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Mediumcarbonalloystructure.text");
  481. this.radioButton2.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Mediuructure.text");
  482. this.radioButton1.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Lowcarbonresults.text");
  483. this.groupBox10.Text = PdnResources.GetString("Menu.Measurementofsteelgrade.text");
  484. this.checkBox4.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Displayaspectratio.text");
  485. this.groupBox11.Text = PdnResources.GetString("Menu.Theesultshow.text");
  486. this.Column11.HeaderText = PdnResources.GetString("Menu.view.text");
  487. this.dataGridViewTextBoxColumn3.HeaderText = PdnResources.GetString("Menu.nodularity.text");
  488. this.dataGridViewTextBoxColumn4.HeaderText = PdnResources.GetString("Menu.organizationcharacteristics.text");
  489. this.dataGridViewTextBoxColumn5.HeaderText = PdnResources.GetString("Menu.grade.text");
  490. this.Text = "GBT38770" + PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Spherorading.text");
  491. this.label1.Text = PdnResources.GetString("Menu.Font.text") + PdnResources.GetString("Menu.size.text") + ":";
  492. this.button5.Text = PdnResources.GetString("Menu.File.SaveAll.Text");
  493. this.button6.Text = PdnResources.GetString("Menu.Applyall.text");
  494. }
  495. private void InitializeComponent()
  496. {
  497. this.components = new System.ComponentModel.Container();
  498. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  499. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
  500. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
  501. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
  502. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
  503. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
  504. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
  505. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
  506. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
  507. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
  508. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
  509. this.groupBox2 = new System.Windows.Forms.GroupBox();
  510. this.listView1 = new System.Windows.Forms.ListView();
  511. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  512. this.groupBox1 = new System.Windows.Forms.GroupBox();
  513. this.button5 = new System.Windows.Forms.Button();
  514. this.button6 = new System.Windows.Forms.Button();
  515. this.button3 = new System.Windows.Forms.Button();
  516. this.button2 = new System.Windows.Forms.Button();
  517. this.checkBox2 = new System.Windows.Forms.CheckBox();
  518. this.button1 = new System.Windows.Forms.Button();
  519. this.groupBox7 = new System.Windows.Forms.GroupBox();
  520. this.groupBox8 = new System.Windows.Forms.GroupBox();
  521. this.button4 = new System.Windows.Forms.Button();
  522. this.listView2 = new System.Windows.Forms.ListView();
  523. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  524. this.button16 = new System.Windows.Forms.Button();
  525. this.label5 = new System.Windows.Forms.Label();
  526. this.button14 = new System.Windows.Forms.Button();
  527. this.button13 = new System.Windows.Forms.Button();
  528. this.dataGridView4 = new System.Windows.Forms.DataGridView();
  529. this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  530. this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  531. this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  532. this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  533. this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  534. this.button12 = new System.Windows.Forms.Button();
  535. this.button11 = new System.Windows.Forms.Button();
  536. this.groupBox5 = new System.Windows.Forms.GroupBox();
  537. this.textBox1 = new System.Windows.Forms.TextBox();
  538. this.label8 = new System.Windows.Forms.Label();
  539. this.panel1 = new System.Windows.Forms.Panel();
  540. this.label7 = new System.Windows.Forms.Label();
  541. this.groupBox6 = new System.Windows.Forms.GroupBox();
  542. this.textBox2 = new System.Windows.Forms.TextBox();
  543. this.label9 = new System.Windows.Forms.Label();
  544. this.panel2 = new System.Windows.Forms.Panel();
  545. this.label10 = new System.Windows.Forms.Label();
  546. this.groupBox9 = new System.Windows.Forms.GroupBox();
  547. this.radioButton3 = new System.Windows.Forms.RadioButton();
  548. this.radioButton2 = new System.Windows.Forms.RadioButton();
  549. this.radioButton1 = new System.Windows.Forms.RadioButton();
  550. this.groupBox10 = new System.Windows.Forms.GroupBox();
  551. this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
  552. this.label1 = new System.Windows.Forms.Label();
  553. this.checkBox4 = new System.Windows.Forms.CheckBox();
  554. this.groupBox11 = new System.Windows.Forms.GroupBox();
  555. this.dataGridView1 = new System.Windows.Forms.DataGridView();
  556. this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  557. this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  558. this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  559. this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  560. this.groupBox2.SuspendLayout();
  561. this.groupBox1.SuspendLayout();
  562. this.groupBox8.SuspendLayout();
  563. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  564. ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).BeginInit();
  565. this.groupBox5.SuspendLayout();
  566. this.groupBox6.SuspendLayout();
  567. this.groupBox9.SuspendLayout();
  568. this.groupBox10.SuspendLayout();
  569. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
  570. this.groupBox11.SuspendLayout();
  571. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
  572. this.SuspendLayout();
  573. //
  574. // groupBox2
  575. //
  576. this.groupBox2.Controls.Add(this.listView1);
  577. this.groupBox2.Location = new System.Drawing.Point(14, 59);
  578. this.groupBox2.Name = "groupBox2";
  579. this.groupBox2.Size = new System.Drawing.Size(135, 648);
  580. this.groupBox2.TabIndex = 4;
  581. this.groupBox2.TabStop = false;
  582. //
  583. // listView1
  584. //
  585. this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  586. | System.Windows.Forms.AnchorStyles.Left)
  587. | System.Windows.Forms.AnchorStyles.Right)));
  588. this.listView1.HideSelection = false;
  589. this.listView1.LargeImageList = this.imageList1;
  590. this.listView1.Location = new System.Drawing.Point(5, 17);
  591. this.listView1.MultiSelect = false;
  592. this.listView1.Name = "listView1";
  593. this.listView1.Size = new System.Drawing.Size(124, 625);
  594. this.listView1.TabIndex = 0;
  595. this.listView1.UseCompatibleStateImageBehavior = false;
  596. this.listView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDown);
  597. this.listView1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseUp);
  598. //
  599. // imageList1
  600. //
  601. this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  602. this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
  603. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  604. //
  605. // groupBox1
  606. //
  607. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  608. | System.Windows.Forms.AnchorStyles.Right)));
  609. this.groupBox1.Controls.Add(this.button5);
  610. this.groupBox1.Controls.Add(this.button6);
  611. this.groupBox1.Controls.Add(this.button3);
  612. this.groupBox1.Controls.Add(this.button2);
  613. this.groupBox1.Controls.Add(this.checkBox2);
  614. this.groupBox1.Controls.Add(this.button1);
  615. this.groupBox1.Location = new System.Drawing.Point(19, 3);
  616. this.groupBox1.Name = "groupBox1";
  617. this.groupBox1.Size = new System.Drawing.Size(1081, 50);
  618. this.groupBox1.TabIndex = 5;
  619. this.groupBox1.TabStop = false;
  620. //
  621. // button5
  622. //
  623. this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  624. this.button5.Location = new System.Drawing.Point(986, 14);
  625. this.button5.Name = "button5";
  626. this.button5.Size = new System.Drawing.Size(84, 30);
  627. this.button5.TabIndex = 19;
  628. this.button5.Text = "保存全部";
  629. this.button5.UseVisualStyleBackColor = false;
  630. this.button5.Click += new System.EventHandler(this.button5_Click);
  631. //
  632. // button6
  633. //
  634. this.button6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  635. this.button6.Location = new System.Drawing.Point(715, 14);
  636. this.button6.Name = "button6";
  637. this.button6.Size = new System.Drawing.Size(84, 30);
  638. this.button6.TabIndex = 18;
  639. this.button6.Text = "应用全部";
  640. this.button6.UseVisualStyleBackColor = false;
  641. this.button6.Click += new System.EventHandler(this.button6_Click);
  642. //
  643. // button3
  644. //
  645. this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  646. this.button3.BackColor = System.Drawing.SystemColors.Control;
  647. this.button3.Location = new System.Drawing.Point(805, 14);
  648. this.button3.Name = "button3";
  649. this.button3.Size = new System.Drawing.Size(84, 30);
  650. this.button3.TabIndex = 4;
  651. this.button3.UseVisualStyleBackColor = false;
  652. this.button3.Click += new System.EventHandler(this.button3_Click);
  653. //
  654. // button2
  655. //
  656. this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  657. this.button2.BackColor = System.Drawing.SystemColors.Control;
  658. this.button2.Location = new System.Drawing.Point(895, 14);
  659. this.button2.Name = "button2";
  660. this.button2.Size = new System.Drawing.Size(84, 30);
  661. this.button2.TabIndex = 3;
  662. this.button2.UseVisualStyleBackColor = false;
  663. this.button2.Click += new System.EventHandler(this.button2_Click);
  664. //
  665. // checkBox2
  666. //
  667. this.checkBox2.AutoSize = true;
  668. this.checkBox2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
  669. this.checkBox2.Location = new System.Drawing.Point(105, 20);
  670. this.checkBox2.Name = "checkBox2";
  671. this.checkBox2.Size = new System.Drawing.Size(15, 14);
  672. this.checkBox2.TabIndex = 2;
  673. this.checkBox2.UseVisualStyleBackColor = true;
  674. //
  675. // button1
  676. //
  677. this.button1.BackColor = System.Drawing.SystemColors.Control;
  678. this.button1.Location = new System.Drawing.Point(15, 14);
  679. this.button1.Name = "button1";
  680. this.button1.Size = new System.Drawing.Size(84, 30);
  681. this.button1.TabIndex = 0;
  682. this.button1.UseVisualStyleBackColor = false;
  683. this.button1.Click += new System.EventHandler(this.button1_Click);
  684. //
  685. // groupBox7
  686. //
  687. this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  688. | System.Windows.Forms.AnchorStyles.Right)));
  689. this.groupBox7.Location = new System.Drawing.Point(520, 59);
  690. this.groupBox7.Name = "groupBox7";
  691. this.groupBox7.Size = new System.Drawing.Size(580, 648);
  692. this.groupBox7.TabIndex = 14;
  693. this.groupBox7.TabStop = false;
  694. //
  695. // groupBox8
  696. //
  697. this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  698. | System.Windows.Forms.AnchorStyles.Left)
  699. | System.Windows.Forms.AnchorStyles.Right)));
  700. this.groupBox8.Controls.Add(this.button4);
  701. this.groupBox8.Controls.Add(this.listView2);
  702. this.groupBox8.Controls.Add(this.numericUpDown1);
  703. this.groupBox8.Controls.Add(this.button16);
  704. this.groupBox8.Controls.Add(this.label5);
  705. this.groupBox8.Controls.Add(this.button14);
  706. this.groupBox8.Controls.Add(this.button13);
  707. this.groupBox8.Controls.Add(this.dataGridView4);
  708. this.groupBox8.Controls.Add(this.button12);
  709. this.groupBox8.Controls.Add(this.button11);
  710. this.groupBox8.Location = new System.Drawing.Point(19, 713);
  711. this.groupBox8.Name = "groupBox8";
  712. this.groupBox8.Size = new System.Drawing.Size(1081, 159);
  713. this.groupBox8.TabIndex = 15;
  714. this.groupBox8.TabStop = false;
  715. //
  716. // button4
  717. //
  718. this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  719. this.button4.BackColor = System.Drawing.SystemColors.Control;
  720. this.button4.Location = new System.Drawing.Point(941, 92);
  721. this.button4.Name = "button4";
  722. this.button4.Size = new System.Drawing.Size(128, 26);
  723. this.button4.TabIndex = 23;
  724. this.button4.UseVisualStyleBackColor = false;
  725. this.button4.Click += new System.EventHandler(this.button4_Click);
  726. //
  727. // listView2
  728. //
  729. this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  730. | System.Windows.Forms.AnchorStyles.Left)));
  731. this.listView2.FullRowSelect = true;
  732. this.listView2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
  733. this.listView2.HideSelection = false;
  734. this.listView2.Location = new System.Drawing.Point(16, 56);
  735. this.listView2.Name = "listView2";
  736. this.listView2.Size = new System.Drawing.Size(180, 95);
  737. this.listView2.TabIndex = 22;
  738. this.listView2.UseCompatibleStateImageBehavior = false;
  739. this.listView2.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView2_ItemSelectionChanged);
  740. this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
  741. //
  742. // numericUpDown1
  743. //
  744. this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  745. this.numericUpDown1.Location = new System.Drawing.Point(997, 128);
  746. this.numericUpDown1.Maximum = new decimal(new int[] {
  747. 10,
  748. 0,
  749. 0,
  750. 0});
  751. this.numericUpDown1.Name = "numericUpDown1";
  752. this.numericUpDown1.Size = new System.Drawing.Size(56, 21);
  753. this.numericUpDown1.TabIndex = 21;
  754. this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
  755. //
  756. // button16
  757. //
  758. this.button16.BackColor = System.Drawing.SystemColors.Control;
  759. this.button16.Location = new System.Drawing.Point(15, 20);
  760. this.button16.Name = "button16";
  761. this.button16.Size = new System.Drawing.Size(93, 26);
  762. this.button16.TabIndex = 20;
  763. this.button16.UseVisualStyleBackColor = false;
  764. this.button16.Click += new System.EventHandler(this.button16_Click);
  765. //
  766. // label5
  767. //
  768. this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  769. this.label5.AutoSize = true;
  770. this.label5.Location = new System.Drawing.Point(958, 134);
  771. this.label5.Name = "label5";
  772. this.label5.Size = new System.Drawing.Size(0, 12);
  773. this.label5.TabIndex = 18;
  774. //
  775. // button14
  776. //
  777. this.button14.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  778. this.button14.BackColor = System.Drawing.SystemColors.Control;
  779. this.button14.Location = new System.Drawing.Point(941, 58);
  780. this.button14.Name = "button14";
  781. this.button14.Size = new System.Drawing.Size(128, 26);
  782. this.button14.TabIndex = 16;
  783. this.button14.UseVisualStyleBackColor = false;
  784. this.button14.Click += new System.EventHandler(this.button14_Click);
  785. //
  786. // button13
  787. //
  788. this.button13.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  789. this.button13.BackColor = System.Drawing.SystemColors.Control;
  790. this.button13.Location = new System.Drawing.Point(941, 24);
  791. this.button13.Name = "button13";
  792. this.button13.Size = new System.Drawing.Size(128, 26);
  793. this.button13.TabIndex = 12;
  794. this.button13.UseVisualStyleBackColor = false;
  795. this.button13.Click += new System.EventHandler(this.button13_Click);
  796. //
  797. // dataGridView4
  798. //
  799. this.dataGridView4.AllowUserToAddRows = false;
  800. this.dataGridView4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  801. | System.Windows.Forms.AnchorStyles.Left)
  802. | System.Windows.Forms.AnchorStyles.Right)));
  803. this.dataGridView4.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  804. this.dataGridView4.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  805. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  806. dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
  807. dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F);
  808. dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
  809. dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  810. dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  811. dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  812. this.dataGridView4.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
  813. this.dataGridView4.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  814. this.dataGridView4.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  815. this.Column1,
  816. this.Column2,
  817. this.Column5,
  818. this.Column6,
  819. this.Column7});
  820. this.dataGridView4.Location = new System.Drawing.Point(228, 20);
  821. this.dataGridView4.Name = "dataGridView4";
  822. this.dataGridView4.ReadOnly = true;
  823. this.dataGridView4.RowHeadersVisible = false;
  824. this.dataGridView4.RowTemplate.Height = 23;
  825. this.dataGridView4.Size = new System.Drawing.Size(693, 131);
  826. this.dataGridView4.TabIndex = 15;
  827. //
  828. // Column1
  829. //
  830. dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  831. this.Column1.DefaultCellStyle = dataGridViewCellStyle2;
  832. this.Column1.Name = "Column1";
  833. this.Column1.ReadOnly = true;
  834. //
  835. // Column2
  836. //
  837. dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  838. this.Column2.DefaultCellStyle = dataGridViewCellStyle3;
  839. this.Column2.Name = "Column2";
  840. this.Column2.ReadOnly = true;
  841. //
  842. // Column5
  843. //
  844. dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  845. this.Column5.DefaultCellStyle = dataGridViewCellStyle4;
  846. this.Column5.Name = "Column5";
  847. this.Column5.ReadOnly = true;
  848. //
  849. // Column6
  850. //
  851. dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  852. this.Column6.DefaultCellStyle = dataGridViewCellStyle5;
  853. this.Column6.Name = "Column6";
  854. this.Column6.ReadOnly = true;
  855. //
  856. // Column7
  857. //
  858. dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  859. this.Column7.DefaultCellStyle = dataGridViewCellStyle6;
  860. this.Column7.Name = "Column7";
  861. this.Column7.ReadOnly = true;
  862. //
  863. // button12
  864. //
  865. this.button12.BackColor = System.Drawing.SystemColors.Control;
  866. this.button12.Location = new System.Drawing.Point(145, 20);
  867. this.button12.Name = "button12";
  868. this.button12.Size = new System.Drawing.Size(52, 26);
  869. this.button12.TabIndex = 13;
  870. this.button12.UseVisualStyleBackColor = false;
  871. this.button12.Click += new System.EventHandler(this.button12_Click);
  872. //
  873. // button11
  874. //
  875. this.button11.BackColor = System.Drawing.SystemColors.Control;
  876. this.button11.Location = new System.Drawing.Point(15, 20);
  877. this.button11.Name = "button11";
  878. this.button11.Size = new System.Drawing.Size(63, 26);
  879. this.button11.TabIndex = 12;
  880. this.button11.UseVisualStyleBackColor = false;
  881. this.button11.Click += new System.EventHandler(this.button11_Click);
  882. //
  883. // groupBox5
  884. //
  885. this.groupBox5.Controls.Add(this.textBox1);
  886. this.groupBox5.Controls.Add(this.label8);
  887. this.groupBox5.Controls.Add(this.panel1);
  888. this.groupBox5.Controls.Add(this.label7);
  889. this.groupBox5.Location = new System.Drawing.Point(155, 357);
  890. this.groupBox5.Name = "groupBox5";
  891. this.groupBox5.Size = new System.Drawing.Size(356, 45);
  892. this.groupBox5.TabIndex = 17;
  893. this.groupBox5.TabStop = false;
  894. //
  895. // textBox1
  896. //
  897. this.textBox1.Location = new System.Drawing.Point(235, 17);
  898. this.textBox1.Name = "textBox1";
  899. this.textBox1.Size = new System.Drawing.Size(71, 21);
  900. this.textBox1.TabIndex = 3;
  901. this.textBox1.Text = "5";
  902. this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
  903. this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
  904. //
  905. // label8
  906. //
  907. this.label8.AutoSize = true;
  908. this.label8.Location = new System.Drawing.Point(158, 21);
  909. this.label8.Name = "label8";
  910. this.label8.Size = new System.Drawing.Size(0, 12);
  911. this.label8.TabIndex = 2;
  912. //
  913. // panel1
  914. //
  915. this.panel1.BackColor = System.Drawing.Color.Blue;
  916. this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  917. this.panel1.Location = new System.Drawing.Point(70, 17);
  918. this.panel1.Name = "panel1";
  919. this.panel1.Size = new System.Drawing.Size(71, 20);
  920. this.panel1.TabIndex = 1;
  921. this.panel1.BackColorChanged += new System.EventHandler(this.panel1_BackColorChanged);
  922. this.panel1.Click += new System.EventHandler(this.panel1_Click);
  923. //
  924. // label7
  925. //
  926. this.label7.AutoSize = true;
  927. this.label7.Location = new System.Drawing.Point(27, 21);
  928. this.label7.Name = "label7";
  929. this.label7.Size = new System.Drawing.Size(0, 12);
  930. this.label7.TabIndex = 0;
  931. //
  932. // groupBox6
  933. //
  934. this.groupBox6.Controls.Add(this.textBox2);
  935. this.groupBox6.Controls.Add(this.label9);
  936. this.groupBox6.Controls.Add(this.panel2);
  937. this.groupBox6.Controls.Add(this.label10);
  938. this.groupBox6.Location = new System.Drawing.Point(155, 408);
  939. this.groupBox6.Name = "groupBox6";
  940. this.groupBox6.Size = new System.Drawing.Size(356, 45);
  941. this.groupBox6.TabIndex = 17;
  942. this.groupBox6.TabStop = false;
  943. //
  944. // textBox2
  945. //
  946. this.textBox2.Location = new System.Drawing.Point(237, 17);
  947. this.textBox2.Name = "textBox2";
  948. this.textBox2.Size = new System.Drawing.Size(71, 21);
  949. this.textBox2.TabIndex = 7;
  950. this.textBox2.Text = "5";
  951. this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
  952. this.textBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox2_KeyPress);
  953. //
  954. // label9
  955. //
  956. this.label9.AutoSize = true;
  957. this.label9.Location = new System.Drawing.Point(158, 21);
  958. this.label9.Name = "label9";
  959. this.label9.Size = new System.Drawing.Size(0, 12);
  960. this.label9.TabIndex = 6;
  961. //
  962. // panel2
  963. //
  964. this.panel2.BackColor = System.Drawing.Color.Yellow;
  965. this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  966. this.panel2.Location = new System.Drawing.Point(70, 17);
  967. this.panel2.Name = "panel2";
  968. this.panel2.Size = new System.Drawing.Size(73, 20);
  969. this.panel2.TabIndex = 5;
  970. this.panel2.BackColorChanged += new System.EventHandler(this.panel2_BackColorChanged);
  971. this.panel2.Click += new System.EventHandler(this.panel2_Click);
  972. //
  973. // label10
  974. //
  975. this.label10.AutoSize = true;
  976. this.label10.Location = new System.Drawing.Point(27, 21);
  977. this.label10.Name = "label10";
  978. this.label10.Size = new System.Drawing.Size(0, 12);
  979. this.label10.TabIndex = 4;
  980. //
  981. // groupBox9
  982. //
  983. this.groupBox9.Controls.Add(this.radioButton3);
  984. this.groupBox9.Controls.Add(this.radioButton2);
  985. this.groupBox9.Controls.Add(this.radioButton1);
  986. this.groupBox9.Location = new System.Drawing.Point(155, 459);
  987. this.groupBox9.Name = "groupBox9";
  988. this.groupBox9.Size = new System.Drawing.Size(356, 46);
  989. this.groupBox9.TabIndex = 17;
  990. this.groupBox9.TabStop = false;
  991. //
  992. // radioButton3
  993. //
  994. this.radioButton3.AutoSize = true;
  995. this.radioButton3.Location = new System.Drawing.Point(225, 20);
  996. this.radioButton3.Name = "radioButton3";
  997. this.radioButton3.Size = new System.Drawing.Size(14, 13);
  998. this.radioButton3.TabIndex = 2;
  999. this.radioButton3.TabStop = true;
  1000. this.radioButton3.UseVisualStyleBackColor = true;
  1001. this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged);
  1002. //
  1003. // radioButton2
  1004. //
  1005. this.radioButton2.AutoSize = true;
  1006. this.radioButton2.Location = new System.Drawing.Point(123, 20);
  1007. this.radioButton2.Name = "radioButton2";
  1008. this.radioButton2.Size = new System.Drawing.Size(14, 13);
  1009. this.radioButton2.TabIndex = 1;
  1010. this.radioButton2.TabStop = true;
  1011. this.radioButton2.UseVisualStyleBackColor = true;
  1012. this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
  1013. //
  1014. // radioButton1
  1015. //
  1016. this.radioButton1.AutoSize = true;
  1017. this.radioButton1.Checked = true;
  1018. this.radioButton1.Location = new System.Drawing.Point(8, 20);
  1019. this.radioButton1.Name = "radioButton1";
  1020. this.radioButton1.Size = new System.Drawing.Size(14, 13);
  1021. this.radioButton1.TabIndex = 0;
  1022. this.radioButton1.TabStop = true;
  1023. this.radioButton1.UseVisualStyleBackColor = true;
  1024. this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
  1025. //
  1026. // groupBox10
  1027. //
  1028. this.groupBox10.Controls.Add(this.numericUpDown2);
  1029. this.groupBox10.Controls.Add(this.label1);
  1030. this.groupBox10.Controls.Add(this.checkBox4);
  1031. this.groupBox10.Location = new System.Drawing.Point(155, 511);
  1032. this.groupBox10.Name = "groupBox10";
  1033. this.groupBox10.Size = new System.Drawing.Size(356, 44);
  1034. this.groupBox10.TabIndex = 17;
  1035. this.groupBox10.TabStop = false;
  1036. //
  1037. // numericUpDown2
  1038. //
  1039. this.numericUpDown2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1040. this.numericUpDown2.Location = new System.Drawing.Point(208, 16);
  1041. this.numericUpDown2.Maximum = new decimal(new int[] {
  1042. 9999,
  1043. 0,
  1044. 0,
  1045. 0});
  1046. this.numericUpDown2.Minimum = new decimal(new int[] {
  1047. 1,
  1048. 0,
  1049. 0,
  1050. 0});
  1051. this.numericUpDown2.Name = "numericUpDown2";
  1052. this.numericUpDown2.Size = new System.Drawing.Size(56, 21);
  1053. this.numericUpDown2.TabIndex = 22;
  1054. this.numericUpDown2.Value = new decimal(new int[] {
  1055. 20,
  1056. 0,
  1057. 0,
  1058. 0});
  1059. this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown2_ValueChanged);
  1060. //
  1061. // label1
  1062. //
  1063. this.label1.AutoSize = true;
  1064. this.label1.Location = new System.Drawing.Point(137, 20);
  1065. this.label1.Name = "label1";
  1066. this.label1.Size = new System.Drawing.Size(0, 12);
  1067. this.label1.TabIndex = 1;
  1068. //
  1069. // checkBox4
  1070. //
  1071. this.checkBox4.AutoSize = true;
  1072. this.checkBox4.Location = new System.Drawing.Point(11, 20);
  1073. this.checkBox4.Name = "checkBox4";
  1074. this.checkBox4.Size = new System.Drawing.Size(15, 14);
  1075. this.checkBox4.TabIndex = 0;
  1076. this.checkBox4.UseVisualStyleBackColor = true;
  1077. this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
  1078. //
  1079. // groupBox11
  1080. //
  1081. this.groupBox11.Controls.Add(this.dataGridView1);
  1082. this.groupBox11.Location = new System.Drawing.Point(155, 561);
  1083. this.groupBox11.Name = "groupBox11";
  1084. this.groupBox11.Size = new System.Drawing.Size(356, 146);
  1085. this.groupBox11.TabIndex = 17;
  1086. this.groupBox11.TabStop = false;
  1087. //
  1088. // dataGridView1
  1089. //
  1090. this.dataGridView1.AllowUserToAddRows = false;
  1091. this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  1092. this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  1093. dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1094. dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
  1095. dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  1096. dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
  1097. dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  1098. dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  1099. dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  1100. this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
  1101. this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  1102. this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  1103. this.Column11,
  1104. this.dataGridViewTextBoxColumn3,
  1105. this.dataGridViewTextBoxColumn4,
  1106. this.dataGridViewTextBoxColumn5});
  1107. this.dataGridView1.Location = new System.Drawing.Point(8, 20);
  1108. this.dataGridView1.MultiSelect = false;
  1109. this.dataGridView1.Name = "dataGridView1";
  1110. this.dataGridView1.ReadOnly = true;
  1111. this.dataGridView1.RowHeadersVisible = false;
  1112. this.dataGridView1.RowTemplate.Height = 23;
  1113. this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  1114. this.dataGridView1.Size = new System.Drawing.Size(337, 118);
  1115. this.dataGridView1.TabIndex = 1;
  1116. //
  1117. // Column11
  1118. //
  1119. dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  1120. this.Column11.DefaultCellStyle = dataGridViewCellStyle8;
  1121. this.Column11.Name = "Column11";
  1122. this.Column11.ReadOnly = true;
  1123. //
  1124. // dataGridViewTextBoxColumn3
  1125. //
  1126. dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1127. this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle9;
  1128. this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
  1129. this.dataGridViewTextBoxColumn3.ReadOnly = true;
  1130. //
  1131. // dataGridViewTextBoxColumn4
  1132. //
  1133. dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  1134. this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle10;
  1135. this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
  1136. this.dataGridViewTextBoxColumn4.ReadOnly = true;
  1137. //
  1138. // dataGridViewTextBoxColumn5
  1139. //
  1140. dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
  1141. this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle11;
  1142. this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
  1143. this.dataGridViewTextBoxColumn5.ReadOnly = true;
  1144. //
  1145. // SpheroidizationGradingDialog
  1146. //
  1147. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  1148. this.ClientSize = new System.Drawing.Size(1107, 881);
  1149. this.Controls.Add(this.groupBox11);
  1150. this.Controls.Add(this.groupBox10);
  1151. this.Controls.Add(this.groupBox9);
  1152. this.Controls.Add(this.groupBox6);
  1153. this.Controls.Add(this.groupBox5);
  1154. this.Controls.Add(this.groupBox8);
  1155. this.Controls.Add(this.groupBox7);
  1156. this.Controls.Add(this.groupBox1);
  1157. this.Controls.Add(this.groupBox2);
  1158. this.Name = "SpheroidizationGradingDialog";
  1159. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InclusionsStandardDialog_FormClosing);
  1160. this.Load += new System.EventHandler(this.SpheroidizationGradingDialog_Load);
  1161. this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData);
  1162. this.Controls.SetChildIndex(this.groupBox2, 0);
  1163. this.Controls.SetChildIndex(this.groupBox1, 0);
  1164. this.Controls.SetChildIndex(this.groupBox7, 0);
  1165. this.Controls.SetChildIndex(this.groupBox8, 0);
  1166. this.Controls.SetChildIndex(this.groupBox5, 0);
  1167. this.Controls.SetChildIndex(this.groupBox6, 0);
  1168. this.Controls.SetChildIndex(this.groupBox9, 0);
  1169. this.Controls.SetChildIndex(this.groupBox10, 0);
  1170. this.Controls.SetChildIndex(this.groupBox11, 0);
  1171. this.groupBox2.ResumeLayout(false);
  1172. this.groupBox1.ResumeLayout(false);
  1173. this.groupBox1.PerformLayout();
  1174. this.groupBox8.ResumeLayout(false);
  1175. this.groupBox8.PerformLayout();
  1176. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  1177. ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).EndInit();
  1178. this.groupBox5.ResumeLayout(false);
  1179. this.groupBox5.PerformLayout();
  1180. this.groupBox6.ResumeLayout(false);
  1181. this.groupBox6.PerformLayout();
  1182. this.groupBox9.ResumeLayout(false);
  1183. this.groupBox9.PerformLayout();
  1184. this.groupBox10.ResumeLayout(false);
  1185. this.groupBox10.PerformLayout();
  1186. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
  1187. this.groupBox11.ResumeLayout(false);
  1188. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  1189. this.ResumeLayout(false);
  1190. }
  1191. #endregion
  1192. /// <summary>
  1193. /// ListView图片选择改变事件
  1194. /// </summary>
  1195. /// <param name="sender"></param>
  1196. /// <param name="e"></param>
  1197. private void ListViewSelectedIndexChanged(object sender, EventArgs e)
  1198. {
  1199. if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
  1200. {
  1201. this.unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
  1202. GetListParamModel();
  1203. this.commonControlButtons.Visible = true;
  1204. existViewFlag = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList.IsExsitView();
  1205. this.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
  1206. if (!existViewFlag)
  1207. mat = imageMat.Clone();
  1208. else
  1209. mat = PaintDotNet.Camera.Tools.ToMat(this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFullSizeWithRegion());
  1210. //二值化集成4
  1211. binaryClass.listView1_SelectedIndexChangedNoCheckedChanged(this.imageMat.Clone(), this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]);
  1212. if (bcOriginChecked())
  1213. {
  1214. this.documentWorkspace.PhaseModels[0].choise = false;
  1215. this.documentWorkspace.PhaseModels[1].choise = false;
  1216. this.documentWorkspace.Refresh();
  1217. }
  1218. if (this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
  1219. {
  1220. binarizationMat = this.documentWorkspace.PhaseModels[0].mat;
  1221. ScreeningSpheroidizedTissue(this.panel1.BackColor, Convert.ToDecimal(this.textBox1.Text), this.panel2.BackColor, Convert.ToDecimal(this.textBox2.Text));
  1222. ResultsDisplay();
  1223. }
  1224. }
  1225. }
  1226. #region 公共按钮
  1227. private void InitCommonButtonEvent()
  1228. {
  1229. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  1230. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  1231. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  1232. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  1233. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  1234. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  1235. }
  1236. private void zoomInButton_Click(object sender, EventArgs e)
  1237. {
  1238. this.documentWorkspace.ZoomIn();
  1239. }
  1240. private void zoomOutButton_Click(object sender, EventArgs e)
  1241. {
  1242. this.documentWorkspace.ZoomOut();
  1243. }
  1244. private void zoomToWindowButton_Click(object sender, EventArgs e)
  1245. {
  1246. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  1247. }
  1248. private void actualSizeButton_Click(object sender, EventArgs e)
  1249. {
  1250. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  1251. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  1252. }
  1253. private void pointerButton_Click(object sender, EventArgs e)
  1254. {
  1255. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
  1256. }
  1257. private void mobileModeButton_Click(object sender, EventArgs e)
  1258. {
  1259. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  1260. }
  1261. #endregion
  1262. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  1263. {
  1264. }
  1265. private void panel1_Click(object sender, EventArgs e)
  1266. {
  1267. this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
  1268. this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.panel1Changed));
  1269. this.colorsForm1.ShowDialog();
  1270. }
  1271. private void panel1Changed(object sender, EventArgs e)
  1272. {
  1273. this.panel1.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();
  1274. this.colorsForm1.Close();
  1275. }
  1276. private void panel2_Click(object sender, EventArgs e)
  1277. {
  1278. this.colorsForm2.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
  1279. this.colorsForm2.setSaveBtn_Click(new System.EventHandler(this.panel2Changed));
  1280. this.colorsForm2.ShowDialog();
  1281. }
  1282. private void panel2Changed(object sender, EventArgs e)
  1283. {
  1284. this.panel2.BackColor = this.colorsForm2.UserPrimaryColor.ToColor();
  1285. this.colorsForm2.Close();
  1286. }
  1287. private decimal getMaxArea(Mat pMat)
  1288. {
  1289. double maxArea = 0;
  1290. Mat mat = Mat.FromImageData(pMat.ToBytes(), ImreadModes.Grayscale);
  1291. HierarchyIndex[] hierarchy;
  1292. OpenCvSharp.Point[][] contours;
  1293. Cv2.FindContours(mat, out contours, out hierarchy, RetrievalModes.External, ContourApproximationModes.ApproxNone);
  1294. for (int i = 0; i < contours.Count(); i++)
  1295. {
  1296. double area = Cv2.ContourArea(contours[i]);
  1297. if (area > maxArea)
  1298. {
  1299. maxArea = area;
  1300. }
  1301. }
  1302. return (decimal)maxArea;
  1303. }
  1304. /// <summary>
  1305. /// 球状宽高比
  1306. /// </summary>
  1307. /// <param name="sender"></param>
  1308. /// <param name="e"></param>
  1309. private void textBox1_TextChanged(object sender, EventArgs e)
  1310. {
  1311. if (!this.init)
  1312. return;
  1313. if (string.IsNullOrEmpty(this.textBox1.Text))
  1314. this.textBox1.Text = "0";
  1315. if (this.textBox1.Text.Equals(".0"))
  1316. this.textBox1.Text = "0";
  1317. if (Convert.ToDecimal(this.textBox1.Text) > Convert.ToDecimal(this.textBox2.Text))
  1318. {
  1319. this.textBox2.Text = this.textBox1.Text;
  1320. }
  1321. if (this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
  1322. {
  1323. ScreeningSpheroidizedTissue(this.panel1.BackColor, Convert.ToDecimal(this.textBox1.Text), this.panel2.BackColor, Convert.ToDecimal(this.textBox2.Text));
  1324. ResultsDisplay();
  1325. }
  1326. this.oldValueT1 = textBox1.Text;
  1327. this.documentWorkspace.Refresh();
  1328. }
  1329. /// <summary>
  1330. /// 球状颜色
  1331. ///
  1332. /// </summary>
  1333. /// <param name="sender"></param>
  1334. /// <param name="e"></param>
  1335. private void panel1_BackColorChanged(object sender, EventArgs e)
  1336. {
  1337. if (this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
  1338. {
  1339. ScreeningSpheroidizedTissue(this.panel1.BackColor, Convert.ToDecimal(this.textBox1.Text), this.panel2.BackColor, Convert.ToDecimal(this.textBox2.Text));
  1340. ResultsDisplay();
  1341. }
  1342. this.documentWorkspace.Refresh();
  1343. }
  1344. /// <summary>
  1345. /// 片状宽高比
  1346. /// </summary>
  1347. /// <param name="sender"></param>
  1348. /// <param name="e"></param>
  1349. private void textBox2_TextChanged(object sender, EventArgs e)
  1350. {
  1351. if (!this.init)
  1352. return;
  1353. if (string.IsNullOrEmpty(this.textBox2.Text))
  1354. this.textBox2.Text = "0";
  1355. if (this.textBox2.Text.Equals(".0"))
  1356. this.textBox2.Text = "0";
  1357. if (Convert.ToDecimal(this.textBox1.Text) > Convert.ToDecimal(this.textBox2.Text))
  1358. {
  1359. this.textBox1.Text = this.textBox2.Text;
  1360. }
  1361. if (this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
  1362. {
  1363. ScreeningSpheroidizedTissue(this.panel1.BackColor, Convert.ToDecimal(this.textBox1.Text), this.panel2.BackColor, Convert.ToDecimal(this.textBox2.Text));
  1364. ResultsDisplay();
  1365. }
  1366. this.oldValueT2 = textBox2.Text;
  1367. this.documentWorkspace.Refresh();
  1368. }
  1369. /// <summary>
  1370. /// 片状颜色
  1371. /// </summary>
  1372. /// <param name="sender"></param>
  1373. /// <param name="e"></param>
  1374. private void panel2_BackColorChanged(object sender, EventArgs e)
  1375. {
  1376. if (this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
  1377. {
  1378. ScreeningSpheroidizedTissue(this.panel1.BackColor, Convert.ToDecimal(this.textBox1.Text), this.panel2.BackColor, Convert.ToDecimal(this.textBox2.Text));
  1379. ResultsDisplay();
  1380. }
  1381. this.documentWorkspace.Refresh();
  1382. }
  1383. /// <summary>
  1384. /// 筛选球化组织
  1385. /// </summary>
  1386. private void ScreeningSpheroidizedTissue(Color globularColor, decimal globulAraspectRatio, Color flakColor, decimal flakAspectRatio)
  1387. {
  1388. appCommon = new AppCommon();
  1389. if (binarizationMat == null)
  1390. return;
  1391. // 多视场
  1392. if (this.documentWorkspace.GraphicsList.IsExsitView())
  1393. {
  1394. // 原始轮廓信息
  1395. Mat temp = new Mat();
  1396. this.documentWorkspace.phaseModels[0].mat.CopyTo(temp);
  1397. List<OpenCvSharp.Point[][]> points = new List<OpenCvSharp.Point[][]>();//各石墨轮廓集合
  1398. List<List<int>> lstAttribute = new List<List<int>>();//各个视场属性集合,索引0-横坐标,1-纵坐标,2-视场宽度,3-视场高度,4-视场面积
  1399. int sumFieldl = 0; //视场个数
  1400. //调用处理视场方法
  1401. appCommon.MultiFieldView(appWorkspace, temp, listView1, documentWorkspace, out points, out lstAttribute, out sumFieldl);
  1402. int viewCount = 0;
  1403. int h = 0;
  1404. foreach (OpenCvSharp.Point[][] contours in points)
  1405. {
  1406. h++;
  1407. keyValuePairsList.Add(new Dictionary<Point2d, decimal>());
  1408. }
  1409. }
  1410. else
  1411. {
  1412. // 初始化计算面积
  1413. sphericalArea = 0;
  1414. flakArea = 0;
  1415. independentArea = 0;
  1416. // 原始轮廓信息
  1417. OpenCvSharp.Point[][] contours;
  1418. HierarchyIndex[] hierachy;
  1419. Mat temp = new Mat();
  1420. binarizationMat.CopyTo(temp);
  1421. List<List<OpenCvSharp.Point>> globularPoint = new List<List<OpenCvSharp.Point>>();
  1422. List<List<OpenCvSharp.Point>> flakyPoint = new List<List<OpenCvSharp.Point>>();
  1423. Cv2.FindContours(BinaryClass.BGRA2GRAY(binarizationMat), out contours, out hierachy, RetrievalModes.External, ContourApproximationModes.ApproxNone);
  1424. if (hierachy.Length > 0)
  1425. {
  1426. // 计算所有轮廓质点
  1427. keyValuePairs = new Dictionary<Point2d, decimal>();
  1428. decimal thisAspectRatio = 0;
  1429. for (int i = 0; i < hierachy.Length; i++)
  1430. {
  1431. double area = Math.Abs(Cv2.ContourArea(contours[i]));
  1432. if (contours[i].Length < 10)
  1433. continue;
  1434. else
  1435. {
  1436. OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
  1437. if (rect.Size.Width != 0)
  1438. thisAspectRatio = Convert.ToDecimal(rect.Size.Height / rect.Size.Width);
  1439. else
  1440. continue;
  1441. // 取得所有轮廓质点
  1442. OpenCvSharp.Moments moments = new OpenCvSharp.Moments(contours[i], false);
  1443. var pt = new Point2d(moments.M10 / moments.M00, moments.M01 / moments.M00);
  1444. if (keyValuePairs.Keys.Contains(pt) == false)
  1445. {
  1446. keyValuePairs.Add(new Point2d(moments.M10 / moments.M00, moments.M01 / moments.M00), thisAspectRatio);
  1447. }
  1448. if (thisAspectRatio < globulAraspectRatio)
  1449. {
  1450. sphericalArea += area * this.unitLength;
  1451. globularPoint.Add(contours[i].ToList());
  1452. }
  1453. if (thisAspectRatio > flakAspectRatio)
  1454. {
  1455. flakArea += area * this.unitLength;
  1456. flakyPoint.Add(contours[i].ToList());
  1457. }
  1458. if (thisAspectRatio >= 5)
  1459. independentArea += area * this.unitLength;
  1460. }
  1461. }
  1462. //填充
  1463. if (globularPoint.Count > 0) Cv2.FillPoly(temp, globularPoint, new Scalar(globularColor.B, globularColor.G, globularColor.R, 255));
  1464. if (flakyPoint.Count > 0) Cv2.FillPoly(temp, flakyPoint, new Scalar(flakColor.B, flakColor.G, flakColor.R, 255));
  1465. documentWorkspace.phaseModels[0].mat = temp;
  1466. }
  1467. }
  1468. }
  1469. /// <summary>
  1470. /// 球状宽高比值验证
  1471. /// </summary>
  1472. /// <param name="sender"></param>
  1473. /// <param name="e"></param>
  1474. private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  1475. {
  1476. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8 && (int)e.KeyChar != 46)
  1477. e.Handled = true;
  1478. //小数点的处理
  1479. if ((int)e.KeyChar == 46)
  1480. {
  1481. if (textBox1.Text.Length <= 0)
  1482. e.Handled = true; //小数点不能在第一位
  1483. else
  1484. {
  1485. float f;
  1486. float oldf;
  1487. bool b1 = false, b2 = false;
  1488. b1 = float.TryParse(textBox1.Text, out oldf);
  1489. b2 = float.TryParse(textBox1.Text + e.KeyChar.ToString(), out f);
  1490. if (b2 == false)
  1491. {
  1492. if (b1 == true)
  1493. e.Handled = true;
  1494. else
  1495. e.Handled = false;
  1496. }
  1497. }
  1498. }
  1499. }
  1500. /// <summary>
  1501. /// 片状宽高比值验证
  1502. /// </summary>
  1503. /// <param name="sender"></param>
  1504. /// <param name="e"></param>
  1505. private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
  1506. {
  1507. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8 && (int)e.KeyChar != 46)
  1508. e.Handled = true;
  1509. //小数点的处理
  1510. if ((int)e.KeyChar == 46)
  1511. {
  1512. if (textBox2.Text.Length <= 0)
  1513. e.Handled = true; //小数点不能在第一位
  1514. else
  1515. {
  1516. float f;
  1517. float oldf;
  1518. bool b1 = false, b2 = false;
  1519. b1 = float.TryParse(textBox2.Text, out oldf);
  1520. b2 = float.TryParse(textBox2.Text + e.KeyChar.ToString(), out f);
  1521. if (b2 == false)
  1522. {
  1523. if (b1 == true)
  1524. e.Handled = true;
  1525. else
  1526. e.Handled = false;
  1527. }
  1528. }
  1529. }
  1530. }
  1531. /// <summary>
  1532. /// 画布绘制
  1533. /// </summary>
  1534. /// <param name="sender"></param>
  1535. /// <param name="e"></param>
  1536. private void Panel_Paint(object sender, PaintEventArgs e)
  1537. {
  1538. if (this.documentWorkspace.CompositionSurface != null)
  1539. {
  1540. //
  1541. // 以下是计算绘制图片的位置和大小并绘制图片
  1542. //
  1543. System.Drawing.Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
  1544. int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
  1545. int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
  1546. int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
  1547. int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
  1548. //
  1549. // 以下是绘制网格、标注、测量、视场等开始
  1550. //
  1551. e.Graphics.TranslateTransform(x, y);
  1552. e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
  1553. Draw(e.Graphics);
  1554. e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
  1555. e.Graphics.TranslateTransform(-x, -y);
  1556. }
  1557. }
  1558. /// <summary>
  1559. /// 绘制
  1560. /// </summary>
  1561. private void Draw(Graphics graphics)
  1562. {
  1563. SolidBrush brush1 = new SolidBrush(Color.Black);
  1564. Font font = new Font("宋体", Convert.ToInt32(this.numericUpDown2.Value));
  1565. if (this.checkBox4.Checked)
  1566. {
  1567. foreach (var keyValuePair in keyValuePairs)
  1568. {
  1569. graphics.DrawString("" + Math.Round(keyValuePair.Value, Convert.ToInt32(this.numericUpDown1.Value)), font, brush1, new System.Drawing.PointF((float)keyValuePair.Key.X, (float)keyValuePair.Key.Y));
  1570. }
  1571. }
  1572. }
  1573. /// <summary>
  1574. /// 是否显示宽高比
  1575. /// </summary>
  1576. /// <param name="sender"></param>
  1577. /// <param name="e"></param>
  1578. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  1579. {
  1580. this.documentWorkspace.Refresh();
  1581. }
  1582. private double spheroidizationRate;
  1583. /// <summary>
  1584. /// 结果展示
  1585. /// </summary>
  1586. private void ResultsDisplay()
  1587. {
  1588. this.dataGridView1.Rows.Clear();
  1589. DataGridViewRow dgvr = new DataGridViewRow();
  1590. foreach (DataGridViewColumn Column in this.dataGridView1.Columns)
  1591. {
  1592. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  1593. }
  1594. dgvr.Cells[0].Value = PdnResources.GetString("Menu.view.text")+"1";
  1595. spheroidizationRate = this.sphericalArea / (this.sphericalArea + this.independentArea + (0.22 * this.flakArea));
  1596. if (this.sphericalArea + this.independentArea + this.flakArea != 0)
  1597. {
  1598. dgvr.Cells[1].Value = Math.Round((spheroidizationRate * 100), Convert.ToInt32(this.numericUpDown1.Value)) + "%";
  1599. }
  1600. int grade = 0;
  1601. if (spheroidizationRate * 100 < 5) grade = 1;
  1602. if (spheroidizationRate * 100 >= 5 && spheroidizationRate * 100 <= 30) grade = 2;
  1603. if (spheroidizationRate * 100 > 30 && spheroidizationRate * 100 <= 60) grade = 3;
  1604. if (spheroidizationRate * 100 > 60 && spheroidizationRate * 100 <= 75) grade = 4;
  1605. if (spheroidizationRate * 100 > 75 && spheroidizationRate * 100 <= 95) grade = 5;
  1606. if (spheroidizationRate * 100 > 95) grade = 6;
  1607. if(this.radioButton1.Checked)
  1608. {
  1609. if (grade == 1) dgvr.Cells[2].Value = PdnResources.GetString("Menu.ferrite.Text")+" + "+ PdnResources.GetString("Menu.pearlite.Text");
  1610. if (grade == 2) dgvr.Cells[2].Value = PdnResources.GetString("Menu.ferrite.Text")+" + "+ PdnResources.GetString("Menu.llamountofspheroidizedbody.Text");
  1611. if (grade == 3) dgvr.Cells[2].Value = PdnResources.GetString("Menu.ferrite.Text")+" + "+ PdnResources.GetString("Menu.Spheroidizeandpearlitic.Text");
  1612. if (grade == 4) dgvr.Cells[2].Value = PdnResources.GetString("Menu.ferrite.Text")+" + "+ PdnResources.GetString("Menu.mallamountofpearlite.Text");
  1613. if (grade == 5) dgvr.Cells[2].Value = PdnResources.GetString("Menu.ferrite.Text")+" + "+ PdnResources.GetString("Menu.Nodularspheroidsnd.Text");
  1614. if (grade == 6) dgvr.Cells[2].Value = PdnResources.GetString("Menu.ferrite.Text")+" + "+ PdnResources.GetString("Menu.Thespheroidizingbody.Text");
  1615. }
  1616. else if(this.radioButton2.Checked)
  1617. {
  1618. if (grade == 1) dgvr.Cells[2].Value = PdnResources.GetString("Menu.pearlite.Text")+ " + " + PdnResources.GetString("Menu.ferrite.Text");
  1619. if (grade == 2) dgvr.Cells[2].Value = PdnResources.GetString("Menu.llamountofspheroidizedbody.Text")+ " + " + PdnResources.GetString("Menu.ferrite.Text");
  1620. if (grade == 3) dgvr.Cells[2].Value = PdnResources.GetString("Menu.Spheroidizeandpearlitic.Text")+" + " + PdnResources.GetString("Menu.ferrite.Text");
  1621. if (grade == 4) dgvr.Cells[2].Value = PdnResources.GetString("Menu.Nodularspheroidsnd.Text")+ " + " + PdnResources.GetString("Menu.ferrite.Text");
  1622. if (grade == 5) dgvr.Cells[2].Value = PdnResources.GetString("Menu.Nodularspheroidsnd.Text")+ " + " + PdnResources.GetString("Menu.ferrite.Text");
  1623. if (grade == 6) dgvr.Cells[2].Value = PdnResources.GetString("Menu.Uniformlydistributedspheroidizedbodies.Text")+ " + " + PdnResources.GetString("Menu.ferrite.Text");
  1624. }
  1625. else
  1626. {
  1627. if (grade == 1) dgvr.Cells[2].Value = PdnResources.GetString("Menu.pearlite.Text")+" + "+ PdnResources.GetString("Menu.ferrite.Text");
  1628. if (grade == 2) dgvr.Cells[2].Value = PdnResources.GetString("Menu.llamountofspheroidizedbody.Text")+ " + " + PdnResources.GetString("Menu.ferrite.Text");
  1629. if (grade == 3) dgvr.Cells[2].Value = PdnResources.GetString("Menu.Spheroidizeandpearlitic.Text")+" + " + PdnResources.GetString("Menu.ferrite.Text");
  1630. if (grade == 4) dgvr.Cells[2].Value = PdnResources.GetString("Menu.Nodularspheroidsnd.Text")+ " + " + PdnResources.GetString("Menu.ferrite.Text");
  1631. if (grade == 5) dgvr.Cells[2].Value = PdnResources.GetString("Menu.Thespheroidizingbody.Text")+" + "+ PdnResources.GetString("Menu.Punctatespheroidizedodies.Text")+ " + " + PdnResources.GetString("Menu.ferrite.Text");
  1632. if (grade == 6) dgvr.Cells[2].Value = PdnResources.GetString("Menu.Uniformlydistributedspheroidizedbodies.Text")+ " + " + PdnResources.GetString("Menu.ferrite.Text");
  1633. }
  1634. if (grade != 0)
  1635. dgvr.Cells[3].Value = grade;
  1636. for (int i = 0; i < dgvr.Cells.Count; i++)
  1637. {
  1638. if (dgvr.Cells[i].Value == null || string.IsNullOrEmpty(dgvr.Cells[i].Value.ToString()))
  1639. {
  1640. dgvr.Cells[i].Value = PdnResources.GetString("Menu.ereror.Text");
  1641. dgvr.Cells[i].Style.BackColor = Color.Red;
  1642. }
  1643. else
  1644. dgvr.Cells[i].Style.BackColor = SystemColors.ControlLightLight;
  1645. }
  1646. this.dataGridView1.Rows.Add(dgvr);
  1647. }
  1648. /// <summary>
  1649. /// 低碳
  1650. /// </summary>
  1651. /// <param name="sender"></param>
  1652. /// <param name="e"></param>
  1653. private void radioButton1_CheckedChanged(object sender, EventArgs e)
  1654. {
  1655. if (this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
  1656. {
  1657. ResultsDisplay();
  1658. }
  1659. }
  1660. /// <summary>
  1661. /// 中碳
  1662. /// </summary>
  1663. /// <param name="sender"></param>
  1664. /// <param name="e"></param>
  1665. private void radioButton2_CheckedChanged(object sender, EventArgs e)
  1666. {
  1667. if (this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
  1668. {
  1669. ResultsDisplay();
  1670. }
  1671. }
  1672. /// <summary>
  1673. /// 合金
  1674. /// </summary>
  1675. /// <param name="sender"></param>
  1676. /// <param name="e"></param>
  1677. private void radioButton3_CheckedChanged(object sender, EventArgs e)
  1678. {
  1679. if (this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
  1680. {
  1681. ResultsDisplay();
  1682. }
  1683. }
  1684. /// <summary>
  1685. /// 编辑
  1686. /// </summary>
  1687. /// <param name="sender"></param>
  1688. /// <param name="e"></param>
  1689. private void button3_Click(object sender, EventArgs e)
  1690. {
  1691. if(this.documentWorkspace.phaseModels.Count == 0 ||this.documentWorkspace.phaseModels[0].mat == null)
  1692. {
  1693. MessageBox.Show(PdnResources.GetString("Menu.Pleaseperonfirst.text")+"!");
  1694. return;
  1695. }
  1696. SpheroidizationGradingEditDialog spheroidizationGradingEditDialog = new SpheroidizationGradingEditDialog(
  1697. this.documentWorkspace, imageMat.Clone(), Convert.ToDecimal(this.textBox1.Text), Convert.ToDecimal(this.textBox2.Text));
  1698. spheroidizationGradingEditDialog.StartPosition = FormStartPosition.CenterScreen;
  1699. spheroidizationGradingEditDialog.ShowDialog(this);
  1700. }
  1701. public void EditPageClose(DocumentWorkspaceWindow documentWorkspace)
  1702. {
  1703. this.documentWorkspace = documentWorkspace;
  1704. this.groupBox7.Controls.Add(documentWorkspace);
  1705. binarizationMat = documentWorkspace.PhaseModels[0].mat;
  1706. if (this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
  1707. {
  1708. ScreeningSpheroidizedTissue(this.panel1.BackColor, Convert.ToDecimal(this.textBox1.Text), this.panel2.BackColor, Convert.ToDecimal(this.textBox2.Text));
  1709. ResultsDisplay();
  1710. }
  1711. this.documentWorkspace.Refresh();
  1712. }
  1713. /// <summary>
  1714. /// 保存结果
  1715. /// </summary>
  1716. /// <param name="sender"></param>
  1717. /// <param name="e"></param>
  1718. private void button2_Click(object sender, EventArgs e)
  1719. {
  1720. if (this.listView1.SelectedItems.Count == 0)
  1721. {
  1722. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  1723. return;
  1724. }
  1725. if (this.dataGridView1.Rows.Count == 0)
  1726. {
  1727. MessageBox.Show(PdnResources.GetString("Menu.Noresultdata.text")+"!");
  1728. return;
  1729. }
  1730. for (int i = 0; i < this.dataGridView1.Rows[0].Cells.Count; i++)
  1731. {
  1732. if (PdnResources.GetString("Menu.ereror.Text").Equals(this.dataGridView1.Rows[0].Cells[i].Value.ToString()))
  1733. {
  1734. MessageBox.Show(PdnResources.GetString("Menu.Resultdataerror.text")+"!");
  1735. return;
  1736. }
  1737. }
  1738. string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
  1739. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
  1740. DataTable dataTable = new DataTable();
  1741. bool replace = false;
  1742. int add = 0;
  1743. foreach (ListViewItem item in this.listView2.Items)
  1744. {
  1745. if (item.Tag.Equals(tag))
  1746. {
  1747. add++;
  1748. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theresuethertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1749. if (dr == DialogResult.OK)
  1750. {
  1751. replace = true;
  1752. this.listView2.Items.Remove(item);
  1753. }
  1754. break;
  1755. }
  1756. }
  1757. if (replace || this.listView2.Items.Count == 0 || add == 0)
  1758. {
  1759. ListViewItem listViewItem = new ListViewItem();
  1760. listViewItem.SubItems[0].Text = imgName;
  1761. listViewItem.Tag = "" + tag;
  1762. if (this.listView2.Items.Count == 0)
  1763. this.listView2.Items.Add(listViewItem);
  1764. else
  1765. this.listView2.Items.Insert(0, listViewItem);
  1766. this.dataGridView4.Rows.Clear();
  1767. DataGridViewRow dgvr = new DataGridViewRow();
  1768. dgvr.Tag = tag;
  1769. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  1770. {
  1771. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  1772. }
  1773. dgvr.Cells[0].Value = imgName;
  1774. dgvr.Cells[1].Value = this.dataGridView1.Rows[0].Cells[0].Value;
  1775. dgvr.Cells[2].Value = this.dataGridView1.Rows[0].Cells[1].Value;
  1776. dgvr.Cells[3].Value = this.dataGridView1.Rows[0].Cells[2].Value;
  1777. dgvr.Cells[4].Value = this.dataGridView1.Rows[0].Cells[3].Value;
  1778. this.dataGridView4.Rows.Add(dgvr);
  1779. dataTable.TableName = tag;
  1780. foreach (System.Data.DataTable dataTable1 in dataTables)
  1781. {
  1782. if (dataTable1.TableName.Equals(dataTable.TableName))
  1783. {
  1784. dataTables.Remove(dataTable1);
  1785. break;
  1786. }
  1787. }
  1788. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  1789. {
  1790. dataTable.Columns.Add(c.HeaderText);
  1791. }
  1792. for (int r = 0; r < this.dataGridView4.Rows.Count; r++)
  1793. {
  1794. if(this.dataGridView4.Rows[r].Tag.Equals(dataTable.TableName))
  1795. {
  1796. DataRow dataRow = dataTable.NewRow();
  1797. for (int c = 0; c < this.dataGridView4.Rows[r].Cells.Count; c++)
  1798. {
  1799. if (c == 2)
  1800. dataRow[this.dataGridView4.Columns[c].HeaderText] = this.spheroidizationRate * 100;
  1801. else
  1802. dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView4.Rows[r].Cells[c].Value;
  1803. }
  1804. dataTable.Rows.Add(dataRow);
  1805. }
  1806. }
  1807. this.dataTables.Add(dataTable);
  1808. if (this.allShow)
  1809. AllShow();
  1810. this.listView2.Items[0].Selected = true;
  1811. //RefreshDataGridView4();
  1812. if (this.documentWorkspace.PhaseModels[0].mat != null)
  1813. {
  1814. //保存处理后的图片
  1815. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  1816. List<Bitmap> tempBit = new List<Bitmap>();
  1817. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1818. originalBit.Tag = pantographRatio;
  1819. tempBit.Add(originalBit);
  1820. Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
  1821. Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  1822. Graphics graphics = Graphics.FromImage(newBit);
  1823. graphics.DrawImage(processedBit, new PointF(0, 0));
  1824. Draw(graphics);
  1825. newBit.Tag = pantographRatio;
  1826. tempBit.Add(newBit);
  1827. if (bitDic.ContainsKey(tag))
  1828. bitDic[tag] = tempBit;
  1829. else
  1830. bitDic.Add(tag, tempBit);
  1831. }
  1832. //拼接中间数据
  1833. List<List<string>> dataList = new List<List<string>>();
  1834. List<string> columnName = new List<string>();
  1835. columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
  1836. columnName.Add(PdnResources.GetString("Menu.Aspectio.Text"));
  1837. dataList.Add(columnName);
  1838. int ad = 0;
  1839. foreach (var keyValuePair in keyValuePairs)
  1840. {
  1841. List<string> strList = new List<string>();
  1842. strList.Add((ad + 1).ToString());
  1843. strList.Add(keyValuePair.Value.ToString());
  1844. dataList.Add(strList);
  1845. ad++;
  1846. }
  1847. bool isExist = false;//是否已存在进行替换
  1848. int modelIndex = -1;//要替换的下标
  1849. for (int j = 0; j < tempDataModel.Count; j++)
  1850. {
  1851. if (tempDataModel[j].tagName.Equals(tag))
  1852. {
  1853. isExist = true;
  1854. modelIndex = j;
  1855. break;
  1856. }
  1857. }
  1858. if (isExist && modelIndex > -1)
  1859. tempDataModel[modelIndex].dataList = dataList;
  1860. else
  1861. {
  1862. ExportProjectModel newModel = new ExportProjectModel();
  1863. newModel.tagName = tag;
  1864. newModel.picName = imgName;
  1865. newModel.dataList = dataList;
  1866. tempDataModel.Add(newModel);
  1867. }
  1868. }
  1869. //listView2_SelectedIndexChanged(null, null);
  1870. //RefreshDataGridView4();
  1871. }
  1872. /// <summary>
  1873. /// 取消全部显示
  1874. /// </summary>
  1875. /// <param name="sender"></param>
  1876. /// <param name="e"></param>
  1877. private void button16_Click(object sender, EventArgs e)
  1878. {
  1879. this.button11.Visible = true;
  1880. this.button16.Visible = false;
  1881. this.button11.Focus();
  1882. this.allShow = false;
  1883. RefreshDataGridView4();
  1884. //List<System.Data.DataTable> dataTables1 = new List<System.Data.DataTable>();
  1885. //foreach (var dataTable in this.dataTables)
  1886. //{
  1887. // if (this.listView2.SelectedItems.Count > 0)
  1888. // {
  1889. // foreach (ListViewItem item in this.listView2.SelectedItems)
  1890. // {
  1891. // if (item.Tag.Equals(dataTable.TableName))
  1892. // dataTables1.Add(dataTable);
  1893. // }
  1894. // }
  1895. // else
  1896. // {
  1897. // if (this.listView2.Items[0].Tag.Equals(dataTable.TableName))
  1898. // dataTables1.Add(dataTable);
  1899. // }
  1900. //}
  1901. //this.dataGridView4.Rows.Clear();
  1902. //foreach (System.Data.DataTable item in dataTables1)
  1903. //{
  1904. // if (dataTables.Count > 0)
  1905. // {
  1906. // DataGridViewRow dgvr = new DataGridViewRow();
  1907. // dgvr.Tag = item.TableName;
  1908. // foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  1909. // {
  1910. // dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  1911. // }
  1912. // for (int c = 0; c < item.Columns.Count; c++)
  1913. // {
  1914. // if (c == 2)
  1915. // dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(item.Rows[0][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  1916. // else
  1917. // dgvr.Cells[c].Value = item.Rows[0][c].ToString();
  1918. // }
  1919. // this.dataGridView4.Rows.Add(dgvr);
  1920. // }
  1921. //}
  1922. }
  1923. /// <summary>
  1924. /// 全部显示
  1925. /// </summary>
  1926. /// <param name="sender"></param>
  1927. /// <param name="e"></param>
  1928. private void button11_Click(object sender, EventArgs e)
  1929. {
  1930. if (this.listView2.Items.Count > 0)
  1931. {
  1932. this.button11.Visible = false;
  1933. this.button16.Visible = true;
  1934. this.button16.Focus();
  1935. this.allShow = true;
  1936. AllShow();
  1937. }
  1938. else
  1939. {
  1940. MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
  1941. }
  1942. }
  1943. private void AllShow()
  1944. {
  1945. this.dataGridView4.Rows.Clear();
  1946. for (int i = this.dataTables.Count - 1; i >= 0; i--)
  1947. {
  1948. DataGridViewRow dgvr = new DataGridViewRow();
  1949. dgvr.Tag = this.dataTables[i].TableName;
  1950. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  1951. {
  1952. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  1953. }
  1954. for (int c = 0; c < this.dataTables[i].Columns.Count; c++)
  1955. {
  1956. if (c == 2)
  1957. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.dataTables[i].Rows[0][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  1958. else
  1959. dgvr.Cells[c].Value = this.dataTables[i].Rows[0][c].ToString();
  1960. }
  1961. this.dataGridView4.Rows.Add(dgvr);
  1962. }
  1963. }
  1964. /// <summary>
  1965. /// 分析结果删除
  1966. /// </summary>
  1967. /// <param name="sender"></param>
  1968. /// <param name="e"></param>
  1969. private void button12_Click(object sender, EventArgs e)
  1970. {
  1971. if (this.listView2.Items.Count > 0)
  1972. {
  1973. if (this.listView2.SelectedItems.Count > 0)
  1974. {
  1975. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretcteddata.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1976. if (dr == DialogResult.OK)
  1977. {
  1978. List<string> detaleName = new List<string>();
  1979. int selectIndex = this.listView2.SelectedItems[0].Index;
  1980. foreach (ListViewItem item in this.listView2.SelectedItems)
  1981. {
  1982. detaleName.Add(item.Tag.ToString());
  1983. this.listView2.Items.Remove(item);
  1984. }
  1985. foreach (string item in detaleName)
  1986. {
  1987. foreach (var dataTable in this.dataTables)
  1988. {
  1989. if (dataTable.TableName.Equals(item))
  1990. {
  1991. this.dataTables.Remove(dataTable);
  1992. break;
  1993. }
  1994. }
  1995. if (bitDic.ContainsKey(item))
  1996. bitDic.Remove(item);
  1997. foreach (ExportProjectModel model in this.tempDataModel)
  1998. {
  1999. if (model.tagName.Equals(item))
  2000. {
  2001. this.tempDataModel.Remove(model);
  2002. break;
  2003. }
  2004. }
  2005. }
  2006. if (this.listView2.Items.Count == 0)
  2007. this.dataGridView4.Rows.Clear();
  2008. else
  2009. {
  2010. if (selectIndex == 0)
  2011. this.listView2.Items[0].Selected = true;
  2012. else
  2013. this.listView2.Items[selectIndex - 1].Selected = true;
  2014. RefreshDataGridView4();
  2015. }
  2016. }
  2017. }
  2018. else
  2019. {
  2020. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectthedatatobedeleted.text")+"!");
  2021. }
  2022. }
  2023. else
  2024. {
  2025. MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
  2026. }
  2027. }
  2028. /// <summary>
  2029. /// 刷新分析结果数据
  2030. /// </summary>
  2031. private void RefreshDataGridView4()
  2032. {
  2033. if (!this.allShow)
  2034. {
  2035. if (this.listView2.SelectedItems.Count > 0)
  2036. {
  2037. List<int> dataTableIndex = new List<int>();
  2038. for (int i = 0; i < this.dataTables.Count; i++)
  2039. {
  2040. foreach (ListViewItem item in this.listView2.SelectedItems)
  2041. {
  2042. if (this.dataTables[i].TableName.Equals(this.listView2.SelectedItems[0].Tag))
  2043. if (!dataTableIndex.Exists(x => x == i))
  2044. {
  2045. dataTableIndex.Add(i);
  2046. }
  2047. }
  2048. }
  2049. if (this.dataTables.Count == 0)
  2050. return;
  2051. this.dataGridView4.Rows.Clear();
  2052. foreach (int item in dataTableIndex)
  2053. {
  2054. if (this.dataTables[item].Rows.Count > 0)
  2055. {
  2056. for (int r = 0; r < this.dataTables[item].Rows.Count; r++)
  2057. {
  2058. DataGridViewRow dgvr = new DataGridViewRow();
  2059. dgvr.Tag = this.dataTables[item].TableName;
  2060. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  2061. {
  2062. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  2063. }
  2064. for (int c = 0; c < this.dataTables[item].Columns.Count; c++)
  2065. {
  2066. if (c == 2)
  2067. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.dataTables[item].Rows[0][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  2068. else
  2069. dgvr.Cells[c].Value = this.dataTables[item].Rows[r][c].ToString();
  2070. }
  2071. this.dataGridView4.Rows.Add(dgvr);
  2072. }
  2073. }
  2074. }
  2075. }
  2076. }
  2077. else
  2078. {
  2079. this.dataGridView4.Rows.Clear();
  2080. DataTable dataTable = new DataTable();
  2081. for (int i = this.dataTables.Count - 1; i >= 0; i--)
  2082. {
  2083. dataTable = this.dataTables[i];
  2084. for (int r = 0; r < dataTable.Rows.Count; r++)
  2085. {
  2086. DataGridViewRow dgvr = new DataGridViewRow();
  2087. dgvr.Tag = dataTable.TableName;
  2088. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  2089. {
  2090. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  2091. }
  2092. for (int c = 0; c < dataTable.Columns.Count; c++)
  2093. {
  2094. if (c == 2)
  2095. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[0][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  2096. else
  2097. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  2098. }
  2099. this.dataGridView4.Rows.Add(dgvr);
  2100. }
  2101. }
  2102. }
  2103. }
  2104. /// <summary>
  2105. /// 未选择分析结果
  2106. /// </summary>
  2107. /// <param name="sender"></param>
  2108. /// <param name="e"></param>
  2109. private void listView2_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
  2110. {
  2111. if (!this.allShow)
  2112. {
  2113. if (this.listView2.SelectedItems.Count == 0)
  2114. this.dataGridView4.Rows.Clear();
  2115. }
  2116. }
  2117. /// <summary>
  2118. /// 切换分析结果
  2119. /// </summary>
  2120. /// <param name="sender"></param>
  2121. /// <param name="e"></param>
  2122. private void listView2_SelectedIndexChanged(object sender, EventArgs e)
  2123. {
  2124. if (this.allShow)
  2125. return;
  2126. RefreshDataGridView4();
  2127. //if (!this.allShow)
  2128. //{
  2129. // if (this.listView2.SelectedItems.Count > 0)
  2130. // {
  2131. // List<int> dataTableIndex = new List<int>();
  2132. // for (int i = 0; i < this.dataTables.Count; i++)
  2133. // {
  2134. // foreach (ListViewItem item in this.listView2.SelectedItems)
  2135. // {
  2136. // if(this.dataTables[i].TableName.Equals(item.Tag))
  2137. // dataTableIndex.Add(i);
  2138. // }
  2139. // }
  2140. // if (this.dataTables.Count == 0)
  2141. // return;
  2142. // this.dataGridView4.Rows.Clear();
  2143. // foreach (int item in dataTableIndex)
  2144. // {
  2145. // if (this.dataTables[item].Rows.Count > 0)
  2146. // {
  2147. // for (int r = 0; r < this.dataTables[item].Rows.Count; r++)
  2148. // {
  2149. // DataGridViewRow dgvr = new DataGridViewRow();
  2150. // dgvr.Tag = this.dataTables[item].TableName;
  2151. // foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  2152. // {
  2153. // dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  2154. // }
  2155. // for (int c = 0; c < this.dataTables[item].Columns.Count; c++)
  2156. // {
  2157. // if (c == 2)
  2158. // dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.dataTables[item].Rows[0][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  2159. // else
  2160. // dgvr.Cells[c].Value = this.dataTables[item].Rows[r][c].ToString();
  2161. // }
  2162. // this.dataGridView4.Rows.Add(dgvr);
  2163. // }
  2164. // }
  2165. // }
  2166. // }
  2167. //}
  2168. }
  2169. /// <summary>
  2170. /// 导出结果
  2171. /// </summary>
  2172. /// <param name="sender"></param>
  2173. /// <param name="e"></param>
  2174. private void button14_Click(object sender, EventArgs e)
  2175. {
  2176. if (this.listView2.Items.Count > 0)
  2177. {
  2178. SaveFileDialog exe = new SaveFileDialog();
  2179. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  2180. exe.FilterIndex = 0;
  2181. exe.RestoreDirectory = true;
  2182. exe.Title = "Export Excel File";
  2183. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  2184. exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Spherorading.text")+ PdnResources.GetString("Menu.Analysisresult.text");
  2185. DialogResult dr = exe.ShowDialog();
  2186. if (dr != DialogResult.OK)
  2187. {
  2188. return;
  2189. }
  2190. DataTable dtb = new DataTable();
  2191. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  2192. {
  2193. dtb.Columns.Add(c.HeaderText);
  2194. }
  2195. for (int r = 0; r < this.dataGridView4.Rows.Count; r++)
  2196. {
  2197. DataRow dataRow = dtb.NewRow();
  2198. for (int c = 0; c < this.dataGridView4.Rows[r].Cells.Count; c++)
  2199. {
  2200. dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView4.Rows[r].Cells[c].Value;
  2201. }
  2202. dtb.Rows.Add(dataRow);
  2203. }
  2204. List<DataTable> list = new List<DataTable>();
  2205. list.Add(dtb);
  2206. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
  2207. }
  2208. else
  2209. {
  2210. MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
  2211. }
  2212. }
  2213. /// <summary>
  2214. /// 设置
  2215. /// </summary>
  2216. /// <param name="sender"></param>
  2217. /// <param name="e"></param>
  2218. private void button1_Click(object sender, EventArgs e)
  2219. {
  2220. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.SpheroidizationGrading");
  2221. if (recombinationRateSetDialog.hasModule)
  2222. {
  2223. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  2224. recombinationRateSetDialog.ShowDialog();
  2225. }
  2226. else
  2227. {
  2228. recombinationRateSetDialog = null;
  2229. }
  2230. }
  2231. /// <summary>
  2232. /// 不可点击空白区域
  2233. /// </summary>
  2234. /// <param name="sender"></param>
  2235. /// <param name="e"></param>
  2236. private void listView1_MouseUp(object sender, MouseEventArgs e)
  2237. {
  2238. if (e.Button == MouseButtons.Left)
  2239. {
  2240. if (listView1.SelectedItems.Count > 0)
  2241. {
  2242. }
  2243. else if (listView1.SelectedItems.Count <= 0)//点击空白区
  2244. {
  2245. if (this.listView1.FocusedItem != null)
  2246. {
  2247. ListViewItem item = this.listView1.GetItemAt(e.X, e.Y);
  2248. if (item == null)
  2249. {
  2250. this.listView1.FocusedItem.Selected = true;
  2251. }
  2252. }
  2253. }
  2254. }
  2255. }
  2256. /// <summary>
  2257. /// 生成报告
  2258. /// </summary>
  2259. /// <param name="sender"></param>
  2260. /// <param name="e"></param>
  2261. private void button13_Click(object sender, EventArgs e)
  2262. {
  2263. if (this.checkBox2.Checked)
  2264. {
  2265. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.SpheroidizationGrading");
  2266. if (recombinationRateSetDialog.hasModule)
  2267. {
  2268. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  2269. recombinationRateSetDialog.ShowDialog();
  2270. }
  2271. else
  2272. {
  2273. recombinationRateSetDialog = null;
  2274. }
  2275. }
  2276. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  2277. {
  2278. //获取word书签与excel单元格的关系,以字典方式存储
  2279. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  2280. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  2281. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2282. {
  2283. foreach (mic_module_infos info in mic_module_infos)
  2284. {
  2285. tagInfos.Add(info.tag_name, info.cell_position);
  2286. }
  2287. }
  2288. List<List<string>> analysisContent = new List<List<string>>();
  2289. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  2290. {
  2291. List<string> content1 = new List<string>();
  2292. if (i == 0)
  2293. {
  2294. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  2295. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  2296. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  2297. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  2298. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  2299. analysisContent.Add(content1);
  2300. }
  2301. content1 = new List<string>();
  2302. if(this.dataGridView4.Rows[i].Cells[0].Value != null)
  2303. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  2304. else
  2305. content1.Add(string.Empty);
  2306. if (this.dataGridView4.Rows[i].Cells[1].Value != null)
  2307. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  2308. else
  2309. content1.Add(string.Empty);
  2310. if (this.dataGridView4.Rows[i].Cells[2].Value != null)
  2311. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  2312. else
  2313. content1.Add(string.Empty);
  2314. if (this.dataGridView4.Rows[i].Cells[3].Value != null)
  2315. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  2316. else
  2317. content1.Add(string.Empty);
  2318. if (this.dataGridView4.Rows[i].Cells[4].Value != null)
  2319. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  2320. else
  2321. content1.Add(string.Empty);
  2322. analysisContent.Add(content1);
  2323. }
  2324. bitList = new List<Bitmap>();
  2325. if (this.allShow)
  2326. {
  2327. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  2328. {
  2329. bitList.Add(kv.Value[0]);
  2330. bitList.Add(kv.Value[1]);
  2331. }
  2332. }
  2333. else
  2334. {
  2335. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  2336. {
  2337. foreach (ListViewItem item in this.listView2.SelectedItems)
  2338. {
  2339. if (bitDic.ContainsKey(item.Tag.ToString()))
  2340. {
  2341. bitList.Add(bitDic[item.Tag.ToString()][0]);
  2342. bitList.Add(bitDic[item.Tag.ToString()][1]);
  2343. }
  2344. }
  2345. }
  2346. }
  2347. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  2348. }
  2349. else
  2350. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  2351. }
  2352. /// <summary>
  2353. /// 小数
  2354. /// </summary>
  2355. /// <param name="sender"></param>
  2356. /// <param name="e"></param>
  2357. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  2358. {
  2359. this.documentWorkspace.Refresh();
  2360. ResultsDisplay();
  2361. if (this.listView2.Items.Count == 0)
  2362. return;
  2363. if (!this.allShow)
  2364. {
  2365. if (this.listView2.SelectedItems.Count == 0)
  2366. {
  2367. this.listView2.Items[0].Selected = true;
  2368. }
  2369. int dataTableIndex = 0;
  2370. for (int i = 0; i < this.dataTables.Count; i++)
  2371. {
  2372. if (this.dataTables[i].TableName.Equals(this.listView2.SelectedItems[0].Tag))
  2373. dataTableIndex = i;
  2374. }
  2375. if (this.dataTables[dataTableIndex].Rows.Count > 0)
  2376. {
  2377. this.dataGridView4.Rows.Clear();
  2378. for (int r = 0; r < this.dataTables[dataTableIndex].Rows.Count; r++)
  2379. {
  2380. DataGridViewRow dgvr = new DataGridViewRow();
  2381. dgvr.Tag = this.dataTables[dataTableIndex].TableName;
  2382. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  2383. {
  2384. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  2385. }
  2386. for (int c = 0; c < this.dataTables[dataTableIndex].Columns.Count; c++)
  2387. {
  2388. if (c == 2)
  2389. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.dataTables[dataTableIndex].Rows[0][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  2390. else
  2391. dgvr.Cells[c].Value = this.dataTables[dataTableIndex].Rows[r][c].ToString();
  2392. }
  2393. this.dataGridView4.Rows.Add(dgvr);
  2394. }
  2395. }
  2396. }
  2397. else
  2398. {
  2399. this.dataGridView4.Rows.Clear();
  2400. DataTable dataTable = new DataTable();
  2401. for (int i = this.dataTables.Count - 1; i >= 0; i--)
  2402. {
  2403. dataTable = this.dataTables[i];
  2404. for (int r = 0; r < dataTable.Rows.Count; r++)
  2405. {
  2406. DataGridViewRow dgvr = new DataGridViewRow();
  2407. dgvr.Tag = dataTable.TableName;
  2408. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  2409. {
  2410. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  2411. }
  2412. for (int c = 0; c < dataTable.Columns.Count; c++)
  2413. {
  2414. if (c == 2)
  2415. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[0][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString() + "%";
  2416. else
  2417. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  2418. }
  2419. this.dataGridView4.Rows.Add(dgvr);
  2420. }
  2421. }
  2422. }
  2423. }
  2424. /// <summary>
  2425. /// 导出项目
  2426. /// </summary>
  2427. /// <param name="sender"></param>
  2428. /// <param name="e"></param>
  2429. private void button4_Click(object sender, EventArgs e)
  2430. {
  2431. try
  2432. {
  2433. if (this.analyzeSettingModel == null)
  2434. {
  2435. MessageBox.Show(PdnResources.GetString("Menu.Settheexporteitemfirst.Text"));
  2436. return;
  2437. }
  2438. //获取项目工程内的文件夹路径
  2439. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.SpheroidizedStructure.Text", this.analyzeSettingModel.savePath);
  2440. if (item != null)
  2441. {
  2442. //向文件夹内保存图片和报告
  2443. if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  2444. {
  2445. //获取word书签与excel单元格的关系,以字典方式存储
  2446. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  2447. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  2448. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2449. {
  2450. foreach (mic_module_infos info in mic_module_infos)
  2451. {
  2452. tagInfos.Add(info.tag_name, info.cell_position);
  2453. }
  2454. }
  2455. //分析结果
  2456. List<List<string>> analysisContent = new List<List<string>>();
  2457. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  2458. {
  2459. List<string> content1 = new List<string>();
  2460. if (i == 0)
  2461. {
  2462. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  2463. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  2464. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  2465. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  2466. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  2467. analysisContent.Add(content1);
  2468. }
  2469. content1 = new List<string>();
  2470. if (this.dataGridView4.Rows[i].Cells[0].Value != null)
  2471. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  2472. else
  2473. content1.Add(string.Empty);
  2474. if (this.dataGridView4.Rows[i].Cells[1].Value != null)
  2475. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  2476. else
  2477. content1.Add(string.Empty);
  2478. if (this.dataGridView4.Rows[i].Cells[2].Value != null)
  2479. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  2480. else
  2481. content1.Add(string.Empty);
  2482. if (this.dataGridView4.Rows[i].Cells[3].Value != null)
  2483. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  2484. else
  2485. content1.Add(string.Empty);
  2486. if (this.dataGridView4.Rows[i].Cells[4].Value != null)
  2487. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  2488. else
  2489. content1.Add(string.Empty);
  2490. analysisContent.Add(content1);
  2491. }
  2492. bitList = new List<Bitmap>();
  2493. if (this.allShow)
  2494. {
  2495. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  2496. {
  2497. bitList.Add(kv.Value[0]);
  2498. bitList.Add(kv.Value[1]);
  2499. }
  2500. }
  2501. else
  2502. {
  2503. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  2504. {
  2505. foreach (ListViewItem itemL2 in this.listView2.SelectedItems)
  2506. {
  2507. if (bitDic.ContainsKey(itemL2.Tag.ToString()))
  2508. {
  2509. bitList.Add(bitDic[itemL2.Tag.ToString()][0]);
  2510. bitList.Add(bitDic[itemL2.Tag.ToString()][1]);
  2511. }
  2512. }
  2513. }
  2514. }
  2515. //中间数据
  2516. if (!this.allShow)
  2517. {
  2518. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  2519. {
  2520. List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
  2521. foreach (ListViewItem rowItem in this.listView2.SelectedItems)
  2522. {
  2523. foreach (ExportProjectModel model in this.tempDataModel)
  2524. {
  2525. if (model.tagName.Equals(rowItem.Tag))
  2526. {
  2527. ExportProjectModel tempModel = new ExportProjectModel();
  2528. tempModel.tagName = model.tagName;
  2529. tempModel.picName = model.picName;
  2530. tempModel.dataList = model.dataList;
  2531. exportModel.Add(tempModel);
  2532. break;
  2533. }
  2534. }
  2535. }
  2536. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);
  2537. }
  2538. }
  2539. else
  2540. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, item.path, item.code);
  2541. }
  2542. else
  2543. {
  2544. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  2545. return;
  2546. }
  2547. //保存项目信息到数据库
  2548. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  2549. }
  2550. }
  2551. catch (Exception)
  2552. {
  2553. }
  2554. }
  2555. /// <summary>
  2556. /// 字体大小
  2557. /// </summary>
  2558. /// <param name="sender"></param>
  2559. /// <param name="e"></param>
  2560. private void numericUpDown2_ValueChanged(object sender, EventArgs e)
  2561. {
  2562. this.documentWorkspace.Refresh();
  2563. }
  2564. #region 参数保存及提取
  2565. /// <summary>
  2566. /// 保存参数的key,value和type
  2567. /// </summary>
  2568. /// <param name="param_key"></param>
  2569. /// <param name="param_value"></param>
  2570. /// <param name="param_type"></param>
  2571. private void saveParamValue(string param_key, string param_value, int param_type)
  2572. {
  2573. bool foundItem = false;
  2574. if (!this.eachData.ContainsKey(GetImgKey()))
  2575. {
  2576. GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
  2577. analysisItem.menuId = this.menuId;
  2578. analysisItem.param_key = param_key;
  2579. analysisItem.param_type = param_type;
  2580. analysisItem.param_value = param_value;
  2581. analysisItem.setValue();
  2582. analysisItem.ListParam = new List<GrainSizeAnalysisModel>();
  2583. analysisItem.ListParam.Add(analysisItem);
  2584. this.eachData.Add(GetImgKey(), analysisItem);
  2585. }
  2586. foreach (var item in this.eachData[GetImgKey()].ListParam)
  2587. {
  2588. if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
  2589. {
  2590. item.param_value = param_value;
  2591. item.setValue();
  2592. foundItem = true;
  2593. break;
  2594. }
  2595. }
  2596. if (!foundItem)
  2597. {
  2598. GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
  2599. analysisItem.menuId = this.menuId;
  2600. analysisItem.param_key = param_key;
  2601. analysisItem.param_type = param_type;
  2602. analysisItem.param_value = param_value;
  2603. analysisItem.setValue();
  2604. this.eachData[GetImgKey()].ListParam.Add(analysisItem);
  2605. }
  2606. }
  2607. /// <summary>
  2608. /// 保存界面中的参数到model
  2609. /// </summary>
  2610. private void saveDialogParamValues()
  2611. {
  2612. saveParamValue(ParamKey_Report, checkBox2.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//报告设置
  2613. saveParamValue(ParamKey_GlobularColour, panel1.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//球状颜色
  2614. saveParamValue(ParamKey_LessThan, textBox1.Text, (int)Base.Dtryt.ItemString);//长宽比小于
  2615. saveParamValue(ParamKey_FlakyColour, panel2.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//片状颜色
  2616. saveParamValue(ParamKey_GreaterThan, textBox2.Text, (int)Base.Dtryt.ItemString);//长宽比大于
  2617. saveParamValue(ParamKey_LowCarbon, radioButton1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//低碳碳素结构
  2618. saveParamValue(ParamKey_MediumCarbon, radioButton2.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//中碳碳素结构
  2619. saveParamValue(ParamKey_MediumCarbonAlloy, radioButton3.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//中碳合金结构
  2620. saveParamValue(ParamKey_ShowAspectRatio, checkBox4.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//显示长宽比
  2621. saveParamValue(ParamKey_FontSize, numericUpDown2.Value.ToString(), (int)Base.Dtryt.Decimal);//字号
  2622. saveParamValue(ParamKey_DecimalPlace, numericUpDown1 != null ? numericUpDown1.Value.ToString() : "", (int)Base.Dtryt.Decimal);//保留小数位数
  2623. }
  2624. /// <summary>
  2625. /// 获取保存的参数
  2626. /// </summary>
  2627. private void GetListParamModel()
  2628. {
  2629. if (this.eachData.ContainsKey(GetImgKey()) && this.eachData[GetImgKey()] != null)
  2630. {
  2631. for (int i = 0; i < this.eachData[GetImgKey()].ListParam.Count; i++)
  2632. {
  2633. switch (this.eachData[GetImgKey()].ListParam[i].param_key)
  2634. {
  2635. case ParamKey_Report:
  2636. checkBox2.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
  2637. break;
  2638. case ParamKey_GlobularColour:
  2639. panel1.BackColor = Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value);
  2640. break;
  2641. case ParamKey_LessThan:
  2642. textBox1.Text = (string)this.eachData[GetImgKey()].ListParam[i].value;
  2643. break;
  2644. case ParamKey_FlakyColour:
  2645. panel2.BackColor = Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value);
  2646. break;
  2647. case ParamKey_GreaterThan:
  2648. textBox2.Text = (string)this.eachData[GetImgKey()].ListParam[i].value;
  2649. break;
  2650. case ParamKey_LowCarbon:
  2651. radioButton1.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
  2652. break;
  2653. case ParamKey_MediumCarbon:
  2654. radioButton2.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
  2655. break;
  2656. case ParamKey_MediumCarbonAlloy:
  2657. radioButton3.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
  2658. break;
  2659. case ParamKey_ShowAspectRatio:
  2660. checkBox4.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value;
  2661. break;
  2662. case ParamKey_FontSize:
  2663. numericUpDown2.Value = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
  2664. break;
  2665. case ParamKey_DecimalPlace:
  2666. numericUpDown1.Value = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].param_value);
  2667. break;
  2668. }
  2669. }
  2670. }
  2671. }
  2672. /// <summary>
  2673. /// 获取XML保存的参数
  2674. /// </summary>
  2675. private void GetXmlParameter()
  2676. {
  2677. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  2678. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  2679. for (int i = 0; i < listView1.Items.Count; i++)
  2680. {
  2681. if (this.eachData.ContainsKey(listView1.Items[i].Index.ToString()))
  2682. {
  2683. this.eachData[listView1.Items[i].Index.ToString()] = analysisModelXml.cloneListParamModel(this.menuId);
  2684. }
  2685. else
  2686. {
  2687. this.eachData.Add(listView1.Items[i].Index.ToString(), analysisModelXml.cloneListParamModel(this.menuId));
  2688. }
  2689. }
  2690. foreach (var item in this.eachData[GetImgKey()].ListParam)
  2691. item.setValue();
  2692. }
  2693. /// <summary>
  2694. /// 保存参数,防止没有图片
  2695. /// </summary>
  2696. private void NullKey()
  2697. {
  2698. GrainSizeAnalysisModel grainsizeanalysismodel = new GrainSizeAnalysisModel();
  2699. grainsizeanalysismodel.ListParam = new List<GrainSizeAnalysisModel>();
  2700. this.eachData.Add("null", grainsizeanalysismodel);
  2701. }
  2702. private string GetImgKey()
  2703. {
  2704. string key = this.listView1.FocusedItem != null ? this.listView1.FocusedItem.Index.ToString() : "null";
  2705. return key;
  2706. }
  2707. #endregion
  2708. private void button6_Click(object sender, EventArgs e)
  2709. {
  2710. if (this.listView1.FocusedItem == null)
  2711. {
  2712. return;
  2713. }
  2714. binaryClass.saveParams();
  2715. binaryClass.applyToAll(this.imageList1.Images.Keys, this.imageList1.Images.Keys[int.Parse(GetImgKey())]);
  2716. saveDialogParamValues();
  2717. GrainSizeAnalysisModel data = new GrainSizeAnalysisModel();
  2718. if (eachData.ContainsKey(GetImgKey()))
  2719. {
  2720. data = eachData[GetImgKey()];
  2721. }
  2722. for (int i = 0; i < listView1.Items.Count; i++)
  2723. {
  2724. eachData[i.ToString()] = data.cloneListParamModel(this.menuId);
  2725. this.listView1.EnsureVisible(i);
  2726. this.listView1.Items[i].Focused = true;
  2727. this.listView1.Items[i].Selected = true;
  2728. }
  2729. }
  2730. private void button5_Click(object sender, EventArgs e)
  2731. {
  2732. if (this.listView1.FocusedItem == null)
  2733. {
  2734. return;
  2735. }
  2736. if (eachData.Count - 1 != listView1.Items.Count)
  2737. {
  2738. MessageBox.Show("请先点击应用全部!");
  2739. return;
  2740. }
  2741. saveDialogParamValues();
  2742. int current = int.Parse(GetImgKey());
  2743. for (int i = 0; i < listView1.Items.Count; i++)
  2744. {
  2745. this.listView1.EnsureVisible(i);
  2746. this.listView1.Items[i].Focused = true;
  2747. this.listView1.Items[i].Selected = true;
  2748. this.button2.PerformClick();
  2749. }
  2750. this.listView1.EnsureVisible(current);
  2751. this.listView1.Items[current].Focused = true;
  2752. this.listView1.Items[current].Selected = true;
  2753. }
  2754. private void listView1_MouseDown(object sender, MouseEventArgs e)
  2755. {
  2756. if (this.listView1.FocusedItem != null)
  2757. saveDialogParamValues();
  2758. }
  2759. #region [脚本相关]
  2760. private void getValue(string key, object value)
  2761. {
  2762. switch (key)
  2763. {
  2764. case "parameter1":
  2765. panel1.BackColor = Color.FromArgb(Convert.ToInt32(value));
  2766. break;
  2767. case "parameter2":
  2768. textBox1.Text = value.ToString();
  2769. break;
  2770. case "parameter3":
  2771. panel2.BackColor = Color.FromArgb(Convert.ToInt32(value));
  2772. break;
  2773. case "parameter4":
  2774. textBox2.Text = value.ToString();
  2775. break;
  2776. case "parameter5":
  2777. int val1 = (int)value;
  2778. radioButton1.Checked = val1 == 1 ? true : false;
  2779. radioButton2.Checked = val1 == 2 ? true : false;
  2780. radioButton3.Checked = val1 == 3 ? true : false;
  2781. break;
  2782. case "parameter6":
  2783. checkBox4.Checked = Convert.ToBoolean(value);
  2784. break;
  2785. case "parameter7":
  2786. numericUpDown2.Value = Convert.ToDecimal(value);
  2787. break;
  2788. case "OpenWhileExportReport":
  2789. checkBox2.Checked = Convert.ToBoolean(value);
  2790. break;
  2791. case "CalculatorDecimalDigits":
  2792. numericUpDown1.Value = Convert.ToDecimal(value);
  2793. break;
  2794. case "ExportResults":
  2795. isExportResults = Convert.ToBoolean(value);
  2796. break;
  2797. case "ExportReports":
  2798. isExportReports = Convert.ToBoolean(value);
  2799. break;
  2800. case "ExportProjects":
  2801. isExportProjects = Convert.ToBoolean(value);
  2802. break;
  2803. }
  2804. }
  2805. private void startScriptAutomaticAction()
  2806. {
  2807. this.button6.PerformClick();
  2808. this.button5.PerformClick();
  2809. this.button11.Visible = false;
  2810. this.button16.Visible = true;
  2811. this.button16.Focus();
  2812. this.allShow = true;
  2813. AllShow();
  2814. if (isExportResults)//导出结果
  2815. this.button14.PerformClick();
  2816. if (isExportReports)//生成报告
  2817. this.button13.PerformClick();
  2818. if (isExportProjects)//导出项目
  2819. this.button4.PerformClick();
  2820. this.appWorkspace.ScriptAutomatic = false;
  2821. this.Close();
  2822. }
  2823. #endregion
  2824. #region [脚本录制]
  2825. private void getScriptRecording()
  2826. {
  2827. string className = InvariantData.path_Action + ".Action" + menuId;
  2828. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  2829. List<Args> args = param.Lists;
  2830. foreach (var item in args)
  2831. {
  2832. item.value = setScriptRecording(item.key);
  2833. }
  2834. //找出二值相关参数 进行赋值
  2835. List<Args> isNullList = args.Where(m => m.value == null).ToList();
  2836. foreach (var item in isNullList)
  2837. {
  2838. item.value = binaryClass.setScriptRecording(item.key);
  2839. }
  2840. appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
  2841. }
  2842. private object setScriptRecording(string key)
  2843. {
  2844. object value = null;
  2845. switch (key)
  2846. {
  2847. case "parameter1":
  2848. value = panel1.BackColor.ToArgb();
  2849. break;
  2850. case "parameter2":
  2851. value = textBox1.Text;
  2852. break;
  2853. case "parameter3":
  2854. value = panel2.BackColor.ToArgb();
  2855. break;
  2856. case "parameter4":
  2857. value = textBox2.Text ;
  2858. break;
  2859. case "parameter5":
  2860. if (radioButton1.Checked) {
  2861. value = 1;
  2862. } else if (radioButton2.Checked) {
  2863. value = 2;
  2864. } else if (radioButton3.Checked) {
  2865. value = 3;
  2866. }
  2867. break;
  2868. case "parameter6":
  2869. value = checkBox4.Checked;
  2870. break;
  2871. case "parameter7":
  2872. value = numericUpDown2.Value;
  2873. break;
  2874. case "OpenWhileExportReport":
  2875. value = checkBox2.Checked;
  2876. break;
  2877. case "CalculatorDecimalDigits":
  2878. value = numericUpDown1.Value;
  2879. break;
  2880. case "ExportResults":
  2881. value = isExportResults;
  2882. break;
  2883. case "ExportReports":
  2884. value = isExportReports;
  2885. break;
  2886. case "ExportProjects":
  2887. value = isExportProjects;
  2888. break;
  2889. }
  2890. return value;
  2891. }
  2892. #endregion
  2893. }
  2894. }