VermiculateCastIronJBT3829Classification.cs 141 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966
  1. using OpenCvSharp;
  2. using OpenCvSharp.Extensions;
  3. using PaintDotNet.Annotation;
  4. using PaintDotNet.Annotation.Enum;
  5. using PaintDotNet.Base.CommTool;
  6. using PaintDotNet.Base.Functionodel;
  7. using PaintDotNet.CustomControl;
  8. using PaintDotNet.DbOpreate.DbBll;
  9. using PaintDotNet.DbOpreate.DbModel;
  10. using PaintDotNet.Instrument;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.ComponentModel;
  14. using System.Data;
  15. using System.Data.Entity.Migrations.Infrastructure;
  16. using System.Diagnostics.Contracts;
  17. using System.Drawing;
  18. using System.Drawing.Drawing2D;
  19. using System.IO;
  20. using System.Linq;
  21. using System.Text;
  22. using System.Threading.Tasks;
  23. using System.Windows.Forms;
  24. namespace PaintDotNet.DedicatedAnalysis.VermiculateCastIron.JBT3829_1999
  25. {
  26. /// <summary>
  27. /// 蠕化级别
  28. /// </summary>
  29. internal class VermiculateCastIronJBT3829Classification : PdnBaseForm
  30. {
  31. #region 基础控件
  32. private Button button1;
  33. private CheckBox checkBox1;
  34. private Button button2;
  35. private GroupBox groupBox2;
  36. private ListView listView1;
  37. private GroupBox groupBox3;
  38. private GroupBox groupBox5;
  39. private GroupBox groupBox6;
  40. private GroupBox groupBox8;
  41. private DataGridView dataGridView1;
  42. private GroupBox groupBox9;
  43. private Button button6;
  44. private Button button7;
  45. private ListView listView2;
  46. private DataGridView dataGridView2;
  47. private Button button9;
  48. private Button button8;
  49. private NumericUpDown numericUpDown1;
  50. private Label label8;
  51. private Label label9;
  52. private Label label10;
  53. private ImageList imageList1;
  54. private IContainer components;
  55. private GroupBox groupBox1;
  56. private TrackBar trackBar2;
  57. private NumericUpDown numericUpDown5;
  58. private NumericUpDown numericUpDown4;
  59. private Label label3;
  60. private CheckBox checkBox3;
  61. private TrackBar trackBar4;
  62. private GroupBox groupBox7;
  63. private Button button4;
  64. private Button button3;
  65. private CheckBox checkBox5;
  66. private CheckBox checkBox4;
  67. private Label label5;
  68. private NumericUpDown numericUpDown6;
  69. private Label label4;
  70. private DataGridViewTextBoxColumn Column1;
  71. private DataGridViewTextBoxColumn Column2;
  72. private DataGridViewTextBoxColumn Column3;
  73. private DataGridViewTextBoxColumn Column4;
  74. private DataGridViewTextBoxColumn Column5;
  75. private DataGridViewTextBoxColumn Column6;
  76. private DataGridViewTextBoxColumn Column7;
  77. private DataGridViewTextBoxColumn Column8;
  78. private DataGridViewTextBoxColumn Column9;
  79. private DataGridViewTextBoxColumn Column10;
  80. private DataGridViewTextBoxColumn Column11;
  81. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
  82. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
  83. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
  84. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
  85. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
  86. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
  87. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
  88. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;
  89. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn9;
  90. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn10;
  91. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn11;
  92. private DataGridViewTextBoxColumn Column12;
  93. #endregion
  94. /// <summary>
  95. /// 调色板
  96. /// </summary>
  97. PaintDotNet.ColorsForm colorsForm1;
  98. /// <summary>
  99. /// 主控件
  100. /// </summary>
  101. private AppWorkspace appWorkspace;
  102. /// <summary>
  103. /// 图像面板
  104. /// </summary>
  105. private DocumentWorkspaceWindow documentWorkspace;
  106. /// <summary>
  107. /// 公共按钮
  108. /// </summary>
  109. private CommonControlButtons commonControlButtons;
  110. /// <summary>
  111. /// 选中图片的bitmap
  112. /// </summary>
  113. private Bitmap bitmap;
  114. /// <summary>
  115. /// 计算结果的表格集合
  116. /// </summary>
  117. private List<DataTable> resultTableList = new List<DataTable>();
  118. /// <summary>
  119. /// 保存用于生成报告的图片
  120. /// </summary>
  121. private List<Bitmap> bitList;
  122. /// <summary>
  123. /// 储存点击保存结果后的所有原图与分析图
  124. /// </summary>
  125. private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
  126. /// <summary>
  127. /// 是否显示全部
  128. /// </summary>
  129. private bool showAll = false;
  130. /// <summary>
  131. /// 当前图片是否有视场
  132. /// </summary>
  133. private bool isHadView = false;
  134. /// <summary>
  135. /// 原图mat-包括视场
  136. /// </summary>
  137. private Mat mat;
  138. /// <summary>
  139. /// 单位标尺
  140. /// </summary>
  141. private double unitLength = 1;
  142. /// <summary>
  143. /// 球状点集合
  144. /// </summary>
  145. private List<List<OpenCvSharp.Point>> ballPoint;
  146. /// <summary>
  147. /// 团状点集合
  148. /// </summary>
  149. private List<List<OpenCvSharp.Point>> groupPoint;
  150. /// <summary>
  151. /// 蠕虫状点集合
  152. /// </summary>
  153. private List<List<OpenCvSharp.Point>> vermicularPoint;
  154. /// <summary>
  155. /// 球状圆形系数集合
  156. /// </summary>
  157. private List<double> ballCircleList;
  158. /// <summary>
  159. /// 团状圆形系数集合
  160. /// </summary>
  161. private List<double> groupCircleList;
  162. /// <summary>
  163. /// 蠕虫状圆形系数集合
  164. /// </summary>
  165. private List<double> vermicularCircleList;
  166. /// <summary>
  167. /// 球状面积
  168. /// </summary>
  169. private double ballCircleArea;
  170. /// <summary>
  171. /// 团状面积
  172. /// </summary>
  173. private double groupCircleArea;
  174. /// <summary>
  175. /// 蠕虫状面积
  176. /// </summary>
  177. private double vermicularCircleArea;
  178. /// <summary>
  179. /// 圆形系数
  180. /// </summary>
  181. private double[] CircularityCoefficient = new double[] { 0.525, 0.625 };
  182. /// <summary>
  183. /// 是否仅修改相的颜色
  184. /// </summary>
  185. private bool changeColor = false;
  186. /// <summary>
  187. /// 球状颜色
  188. /// </summary>
  189. public Color BallColor = Color.LightBlue;
  190. /// <summary>
  191. /// 团状颜色
  192. /// </summary>
  193. public Color GroupColor = Color.YellowGreen;
  194. /// <summary>
  195. /// 蠕虫状颜色
  196. /// </summary>
  197. public Color VermicularColor = Color.Yellow;
  198. /// <summary>
  199. /// 字体
  200. /// </summary>
  201. public string fontStyle = "宋体";
  202. /// <summary>
  203. /// 字号
  204. /// </summary>
  205. public float fontSize = 12;
  206. /// <summary>
  207. /// 字体颜色
  208. /// </summary>
  209. public Color fontColor = Color.Black;
  210. /// <summary>
  211. /// 放大倍数
  212. /// </summary>
  213. private decimal gainNumber;
  214. /// <summary>
  215. /// 是否未对图片做其他操作
  216. /// </summary>
  217. private bool isFirstSwitch = false;
  218. /// <summary>
  219. /// 中间数据
  220. /// </summary>
  221. private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
  222. /// <summary>
  223. /// 面积
  224. /// </summary>
  225. private List<string> tempArea;
  226. /// <summary>
  227. /// 最大卡规直径
  228. /// </summary>
  229. private List<string> maxCaliperDiameter;
  230. private Button button5;
  231. private BinaryControl bc;
  232. //二值化集成1
  233. BinaryClass binaryClass;
  234. private int menuId;
  235. private string menuName;
  236. /// <summary>
  237. /// 原型系数
  238. /// </summary>
  239. private List<string> circleCoefficientList;
  240. public VermiculateCastIronJBT3829Classification(AppWorkspace appWorkspace, PdnMenuItem menuItem)
  241. {
  242. this.menuId = menuItem.MenuId;
  243. this.menuName = menuItem.Text;
  244. binaryClass = new BinaryClass(menuId);
  245. this.appWorkspace = appWorkspace;
  246. InitializeComponent();
  247. InitializeCustomControl();
  248. InitializeLanguageText();
  249. InitGridHeader();
  250. InitPicList();
  251. InitOtherTools();
  252. InitCommonButtonEvent();
  253. AddPictureBoxEvent();
  254. SetAnalyzeModelFromXml("Template.Manager.item3.VermiculateCastIronJBT3829");
  255. }
  256. private void InitializeCustomControl()
  257. {
  258. //
  259. // bc
  260. //
  261. this.bc = new PaintDotNet.CustomControl.BinaryControl();
  262. this.bc.BinaryBackColor = System.Drawing.Color.Red;
  263. this.bc.BinaryChecked = false;
  264. this.bc.BinaryStyle = 1;
  265. this.bc.Location = new System.Drawing.Point(147, 60);
  266. this.bc.Name = "bc";
  267. this.bc.OriginChecked = false;
  268. this.bc.scope1End = 0D;
  269. this.bc.scope1Start = 0D;
  270. this.bc.scope2End = 0D;
  271. this.bc.scope2Start = 0D;
  272. this.bc.scope3End = 0D;
  273. this.bc.scope3Start = 0D;
  274. this.bc.Size = new System.Drawing.Size(360, 292);
  275. this.bc.TabIndex = 19;
  276. this.Controls.Add(this.bc);
  277. this.Controls.SetChildIndex(this.bc, 0);
  278. }
  279. private void InitializeLanguageText()
  280. {
  281. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  282. this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
  283. this.checkBox1.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  284. this.button1.Text = PdnResources.GetString("Menu.Setting.Text");
  285. this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  286. this.groupBox3.Text = PdnResources.GetString("Menu.Preview.text");
  287. this.groupBox5.Text = PdnResources.GetString("Menu.Particlescreening.text");
  288. this.label3.Text = PdnResources.GetString("Menu.range.text") + ":";
  289. this.checkBox3.Text = PdnResources.GetString("Menu.filter.text");
  290. this.groupBox6.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
  291. this.button4.Text = PdnResources.GetString("Menu.Colorsetting.text");
  292. this.button3.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
  293. this.groupBox8.Text = PdnResources.GetString("Menu.Theesultshow.text");
  294. this.Column1.HeaderText = PdnResources.GetString("Menu.view.text");
  295. this.Column8.HeaderText = PdnResources.GetString("Menu.Thetotalarea.text");
  296. this.groupBox9.Text = PdnResources.GetString("Menu.Analysisresult.text");
  297. this.button5.Text = PdnResources.GetString("Menu.Exportproject.text");
  298. this.label8.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
  299. this.button9.Text = PdnResources.GetString("Menu.Exportresults.text");
  300. this.button8.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  301. this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.picture.Text");
  302. this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.view.text");
  303. this.dataGridViewTextBoxColumn9.HeaderText = PdnResources.GetString("Menu.Thetotalarea.text");
  304. this.button7.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  305. this.button6.Text = PdnResources.GetString("Menu.Showall.text");
  306. }
  307. private void InitializeComponent()
  308. {
  309. this.components = new System.ComponentModel.Container();
  310. this.groupBox1 = new System.Windows.Forms.GroupBox();
  311. this.button2 = new System.Windows.Forms.Button();
  312. this.checkBox1 = new System.Windows.Forms.CheckBox();
  313. this.button1 = new System.Windows.Forms.Button();
  314. this.groupBox2 = new System.Windows.Forms.GroupBox();
  315. this.listView1 = new System.Windows.Forms.ListView();
  316. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  317. this.groupBox3 = new System.Windows.Forms.GroupBox();
  318. this.groupBox5 = new System.Windows.Forms.GroupBox();
  319. this.trackBar4 = new System.Windows.Forms.TrackBar();
  320. this.trackBar2 = new System.Windows.Forms.TrackBar();
  321. this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
  322. this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
  323. this.label3 = new System.Windows.Forms.Label();
  324. this.checkBox3 = new System.Windows.Forms.CheckBox();
  325. this.groupBox6 = new System.Windows.Forms.GroupBox();
  326. this.button4 = new System.Windows.Forms.Button();
  327. this.button3 = new System.Windows.Forms.Button();
  328. this.checkBox5 = new System.Windows.Forms.CheckBox();
  329. this.checkBox4 = new System.Windows.Forms.CheckBox();
  330. this.groupBox8 = new System.Windows.Forms.GroupBox();
  331. this.dataGridView1 = new System.Windows.Forms.DataGridView();
  332. this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  333. this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  334. this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  335. this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  336. this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  337. this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  338. this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  339. this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  340. this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  341. this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  342. this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  343. this.groupBox9 = new System.Windows.Forms.GroupBox();
  344. this.button5 = new System.Windows.Forms.Button();
  345. this.label10 = new System.Windows.Forms.Label();
  346. this.label9 = new System.Windows.Forms.Label();
  347. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  348. this.label8 = new System.Windows.Forms.Label();
  349. this.button9 = new System.Windows.Forms.Button();
  350. this.button8 = new System.Windows.Forms.Button();
  351. this.dataGridView2 = new System.Windows.Forms.DataGridView();
  352. this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  353. this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  354. this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  355. this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  356. this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  357. this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  358. this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  359. this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  360. this.dataGridViewTextBoxColumn9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  361. this.dataGridViewTextBoxColumn10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  362. this.dataGridViewTextBoxColumn11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  363. this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  364. this.listView2 = new System.Windows.Forms.ListView();
  365. this.button7 = new System.Windows.Forms.Button();
  366. this.button6 = new System.Windows.Forms.Button();
  367. this.groupBox7 = new System.Windows.Forms.GroupBox();
  368. this.label5 = new System.Windows.Forms.Label();
  369. this.numericUpDown6 = new System.Windows.Forms.NumericUpDown();
  370. this.label4 = new System.Windows.Forms.Label();
  371. this.groupBox1.SuspendLayout();
  372. this.groupBox2.SuspendLayout();
  373. this.groupBox5.SuspendLayout();
  374. ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).BeginInit();
  375. ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();
  376. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
  377. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
  378. this.groupBox6.SuspendLayout();
  379. this.groupBox8.SuspendLayout();
  380. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
  381. this.groupBox9.SuspendLayout();
  382. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  383. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
  384. this.groupBox7.SuspendLayout();
  385. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).BeginInit();
  386. this.SuspendLayout();
  387. //
  388. // groupBox1
  389. //
  390. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  391. | System.Windows.Forms.AnchorStyles.Right)));
  392. this.groupBox1.Controls.Add(this.button2);
  393. this.groupBox1.Controls.Add(this.checkBox1);
  394. this.groupBox1.Controls.Add(this.button1);
  395. this.groupBox1.Location = new System.Drawing.Point(14, 3);
  396. this.groupBox1.Name = "groupBox1";
  397. this.groupBox1.Size = new System.Drawing.Size(1081, 50);
  398. this.groupBox1.TabIndex = 1;
  399. this.groupBox1.TabStop = false;
  400. //
  401. // button2
  402. //
  403. this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  404. | System.Windows.Forms.AnchorStyles.Right)));
  405. this.button2.Location = new System.Drawing.Point(985, 14);
  406. this.button2.Name = "button2";
  407. this.button2.Size = new System.Drawing.Size(84, 30);
  408. this.button2.TabIndex = 2;
  409. this.button2.UseVisualStyleBackColor = true;
  410. this.button2.Click += new System.EventHandler(this.button2_Click);
  411. //
  412. // checkBox1
  413. //
  414. this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  415. | System.Windows.Forms.AnchorStyles.Left)));
  416. this.checkBox1.AutoSize = true;
  417. this.checkBox1.Location = new System.Drawing.Point(141, 21);
  418. this.checkBox1.Name = "checkBox1";
  419. this.checkBox1.Size = new System.Drawing.Size(15, 14);
  420. this.checkBox1.TabIndex = 1;
  421. this.checkBox1.UseVisualStyleBackColor = true;
  422. //
  423. // button1
  424. //
  425. this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  426. | System.Windows.Forms.AnchorStyles.Left)));
  427. this.button1.Location = new System.Drawing.Point(15, 14);
  428. this.button1.Name = "button1";
  429. this.button1.Size = new System.Drawing.Size(84, 30);
  430. this.button1.TabIndex = 0;
  431. this.button1.UseVisualStyleBackColor = true;
  432. this.button1.Click += new System.EventHandler(this.button1_Click);
  433. //
  434. // groupBox2
  435. //
  436. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  437. | System.Windows.Forms.AnchorStyles.Left)));
  438. this.groupBox2.Controls.Add(this.listView1);
  439. this.groupBox2.Location = new System.Drawing.Point(14, 60);
  440. this.groupBox2.Name = "groupBox2";
  441. this.groupBox2.Size = new System.Drawing.Size(135, 607);
  442. this.groupBox2.TabIndex = 2;
  443. this.groupBox2.TabStop = false;
  444. //
  445. // listView1
  446. //
  447. this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  448. | System.Windows.Forms.AnchorStyles.Left)
  449. | System.Windows.Forms.AnchorStyles.Right)));
  450. this.listView1.HideSelection = false;
  451. this.listView1.LargeImageList = this.imageList1;
  452. this.listView1.Location = new System.Drawing.Point(5, 17);
  453. this.listView1.MultiSelect = false;
  454. this.listView1.Name = "listView1";
  455. this.listView1.Size = new System.Drawing.Size(124, 584);
  456. this.listView1.TabIndex = 0;
  457. this.listView1.UseCompatibleStateImageBehavior = false;
  458. this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
  459. //
  460. // imageList1
  461. //
  462. this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  463. this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
  464. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  465. //
  466. // groupBox3
  467. //
  468. this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  469. | System.Windows.Forms.AnchorStyles.Right)));
  470. this.groupBox3.Location = new System.Drawing.Point(515, 60);
  471. this.groupBox3.Name = "groupBox3";
  472. this.groupBox3.Size = new System.Drawing.Size(580, 606);
  473. this.groupBox3.TabIndex = 3;
  474. this.groupBox3.TabStop = false;
  475. //
  476. // groupBox5
  477. //
  478. this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  479. | System.Windows.Forms.AnchorStyles.Right)));
  480. this.groupBox5.Controls.Add(this.trackBar4);
  481. this.groupBox5.Controls.Add(this.trackBar2);
  482. this.groupBox5.Controls.Add(this.numericUpDown5);
  483. this.groupBox5.Controls.Add(this.numericUpDown4);
  484. this.groupBox5.Controls.Add(this.label3);
  485. this.groupBox5.Controls.Add(this.checkBox3);
  486. this.groupBox5.Location = new System.Drawing.Point(149, 358);
  487. this.groupBox5.Name = "groupBox5";
  488. this.groupBox5.Size = new System.Drawing.Size(353, 78);
  489. this.groupBox5.TabIndex = 5;
  490. this.groupBox5.TabStop = false;
  491. //
  492. // trackBar4
  493. //
  494. this.trackBar4.Cursor = System.Windows.Forms.Cursors.Hand;
  495. this.trackBar4.Location = new System.Drawing.Point(257, 46);
  496. this.trackBar4.Maximum = 0;
  497. this.trackBar4.Name = "trackBar4";
  498. this.trackBar4.Size = new System.Drawing.Size(92, 45);
  499. this.trackBar4.TabIndex = 14;
  500. this.trackBar4.TickStyle = System.Windows.Forms.TickStyle.None;
  501. this.trackBar4.Scroll += new System.EventHandler(this.trackBar4_Scroll);
  502. //
  503. // trackBar2
  504. //
  505. this.trackBar2.Cursor = System.Windows.Forms.Cursors.Hand;
  506. this.trackBar2.Location = new System.Drawing.Point(104, 46);
  507. this.trackBar2.Maximum = 0;
  508. this.trackBar2.Name = "trackBar2";
  509. this.trackBar2.Size = new System.Drawing.Size(92, 45);
  510. this.trackBar2.TabIndex = 13;
  511. this.trackBar2.TickStyle = System.Windows.Forms.TickStyle.None;
  512. this.trackBar2.Scroll += new System.EventHandler(this.trackBar2_Scroll);
  513. //
  514. // numericUpDown5
  515. //
  516. this.numericUpDown5.Location = new System.Drawing.Point(197, 46);
  517. this.numericUpDown5.Maximum = new decimal(new int[] {
  518. 0,
  519. 0,
  520. 0,
  521. 0});
  522. this.numericUpDown5.Name = "numericUpDown5";
  523. this.numericUpDown5.Size = new System.Drawing.Size(62, 21);
  524. this.numericUpDown5.TabIndex = 12;
  525. this.numericUpDown5.ValueChanged += new System.EventHandler(this.numericUpDown5_ValueChanged);
  526. //
  527. // numericUpDown4
  528. //
  529. this.numericUpDown4.Location = new System.Drawing.Point(44, 46);
  530. this.numericUpDown4.Maximum = new decimal(new int[] {
  531. 0,
  532. 0,
  533. 0,
  534. 0});
  535. this.numericUpDown4.Name = "numericUpDown4";
  536. this.numericUpDown4.Size = new System.Drawing.Size(62, 21);
  537. this.numericUpDown4.TabIndex = 10;
  538. this.numericUpDown4.ValueChanged += new System.EventHandler(this.numericUpDown4_ValueChanged);
  539. //
  540. // label3
  541. //
  542. this.label3.AutoSize = true;
  543. this.label3.Location = new System.Drawing.Point(9, 50);
  544. this.label3.Name = "label3";
  545. this.label3.Size = new System.Drawing.Size(0, 12);
  546. this.label3.TabIndex = 9;
  547. //
  548. // checkBox3
  549. //
  550. this.checkBox3.AutoSize = true;
  551. this.checkBox3.Location = new System.Drawing.Point(30, 21);
  552. this.checkBox3.Name = "checkBox3";
  553. this.checkBox3.Size = new System.Drawing.Size(15, 14);
  554. this.checkBox3.TabIndex = 0;
  555. this.checkBox3.UseVisualStyleBackColor = true;
  556. this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
  557. //
  558. // groupBox6
  559. //
  560. this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  561. | System.Windows.Forms.AnchorStyles.Right)));
  562. this.groupBox6.Controls.Add(this.button4);
  563. this.groupBox6.Controls.Add(this.button3);
  564. this.groupBox6.Controls.Add(this.checkBox5);
  565. this.groupBox6.Controls.Add(this.checkBox4);
  566. this.groupBox6.Location = new System.Drawing.Point(153, 442);
  567. this.groupBox6.Name = "groupBox6";
  568. this.groupBox6.Size = new System.Drawing.Size(354, 63);
  569. this.groupBox6.TabIndex = 6;
  570. this.groupBox6.TabStop = false;
  571. //
  572. // button4
  573. //
  574. this.button4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  575. this.button4.Location = new System.Drawing.Point(221, 36);
  576. this.button4.Name = "button4";
  577. this.button4.Size = new System.Drawing.Size(94, 20);
  578. this.button4.TabIndex = 3;
  579. this.button4.UseVisualStyleBackColor = true;
  580. this.button4.Click += new System.EventHandler(this.button4_Click);
  581. //
  582. // button3
  583. //
  584. this.button3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
  585. this.button3.Location = new System.Drawing.Point(221, 12);
  586. this.button3.Name = "button3";
  587. this.button3.Size = new System.Drawing.Size(94, 20);
  588. this.button3.TabIndex = 2;
  589. this.button3.UseVisualStyleBackColor = true;
  590. this.button3.Click += new System.EventHandler(this.button3_Click);
  591. //
  592. // checkBox5
  593. //
  594. this.checkBox5.AutoSize = true;
  595. this.checkBox5.Location = new System.Drawing.Point(32, 38);
  596. this.checkBox5.Name = "checkBox5";
  597. this.checkBox5.Size = new System.Drawing.Size(156, 16);
  598. this.checkBox5.TabIndex = 1;
  599. this.checkBox5.Text = "显示不同级别的石墨颜色";
  600. this.checkBox5.UseVisualStyleBackColor = true;
  601. this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
  602. //
  603. // checkBox4
  604. //
  605. this.checkBox4.AutoSize = true;
  606. this.checkBox4.Location = new System.Drawing.Point(32, 17);
  607. this.checkBox4.Name = "checkBox4";
  608. this.checkBox4.Size = new System.Drawing.Size(96, 16);
  609. this.checkBox4.TabIndex = 0;
  610. this.checkBox4.Text = "显示圆形系数";
  611. this.checkBox4.UseVisualStyleBackColor = true;
  612. this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
  613. //
  614. // groupBox8
  615. //
  616. this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  617. | System.Windows.Forms.AnchorStyles.Left)
  618. | System.Windows.Forms.AnchorStyles.Right)));
  619. this.groupBox8.Controls.Add(this.dataGridView1);
  620. this.groupBox8.Location = new System.Drawing.Point(149, 554);
  621. this.groupBox8.Name = "groupBox8";
  622. this.groupBox8.Size = new System.Drawing.Size(353, 112);
  623. this.groupBox8.TabIndex = 8;
  624. this.groupBox8.TabStop = false;
  625. //
  626. // dataGridView1
  627. //
  628. this.dataGridView1.AllowUserToAddRows = false;
  629. this.dataGridView1.AllowUserToDeleteRows = false;
  630. this.dataGridView1.AllowUserToResizeColumns = false;
  631. this.dataGridView1.AllowUserToResizeRows = false;
  632. this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  633. | System.Windows.Forms.AnchorStyles.Left)
  634. | System.Windows.Forms.AnchorStyles.Right)));
  635. this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  636. this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
  637. this.dataGridView1.ColumnHeadersHeight = 44;
  638. this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  639. this.Column1,
  640. this.Column2,
  641. this.Column3,
  642. this.Column4,
  643. this.Column5,
  644. this.Column6,
  645. this.Column7,
  646. this.Column8,
  647. this.Column9,
  648. this.Column10,
  649. this.Column11});
  650. this.dataGridView1.Location = new System.Drawing.Point(7, 21);
  651. this.dataGridView1.MultiSelect = false;
  652. this.dataGridView1.Name = "dataGridView1";
  653. this.dataGridView1.ReadOnly = true;
  654. this.dataGridView1.RowHeadersVisible = false;
  655. this.dataGridView1.RowTemplate.Height = 23;
  656. this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  657. this.dataGridView1.Size = new System.Drawing.Size(340, 85);
  658. this.dataGridView1.TabIndex = 0;
  659. //
  660. // Column1
  661. //
  662. this.Column1.FillWeight = 73.14721F;
  663. this.Column1.MinimumWidth = 72;
  664. this.Column1.Name = "Column1";
  665. this.Column1.ReadOnly = true;
  666. this.Column1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  667. this.Column1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  668. //
  669. // Column2
  670. //
  671. this.Column2.FillWeight = 368.5279F;
  672. this.Column2.HeaderText = "球状面积";
  673. this.Column2.MinimumWidth = 66;
  674. this.Column2.Name = "Column2";
  675. this.Column2.ReadOnly = true;
  676. this.Column2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  677. this.Column2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  678. //
  679. // Column3
  680. //
  681. this.Column3.FillWeight = 73.14721F;
  682. this.Column3.HeaderText = "球状个数";
  683. this.Column3.MinimumWidth = 66;
  684. this.Column3.Name = "Column3";
  685. this.Column3.ReadOnly = true;
  686. this.Column3.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  687. this.Column3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  688. //
  689. // Column4
  690. //
  691. this.Column4.FillWeight = 73.14721F;
  692. this.Column4.HeaderText = "团状、团絮状面积";
  693. this.Column4.MinimumWidth = 66;
  694. this.Column4.Name = "Column4";
  695. this.Column4.ReadOnly = true;
  696. this.Column4.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  697. this.Column4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  698. //
  699. // Column5
  700. //
  701. this.Column5.FillWeight = 73.14721F;
  702. this.Column5.HeaderText = "团状、团絮状个数";
  703. this.Column5.MinimumWidth = 66;
  704. this.Column5.Name = "Column5";
  705. this.Column5.ReadOnly = true;
  706. this.Column5.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  707. this.Column5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  708. //
  709. // Column6
  710. //
  711. this.Column6.FillWeight = 73.14721F;
  712. this.Column6.HeaderText = "蠕虫状面积";
  713. this.Column6.MinimumWidth = 66;
  714. this.Column6.Name = "Column6";
  715. this.Column6.ReadOnly = true;
  716. this.Column6.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  717. this.Column6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  718. //
  719. // Column7
  720. //
  721. this.Column7.FillWeight = 73.14721F;
  722. this.Column7.HeaderText = "蠕虫状个数";
  723. this.Column7.MinimumWidth = 66;
  724. this.Column7.Name = "Column7";
  725. this.Column7.ReadOnly = true;
  726. this.Column7.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  727. this.Column7.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  728. //
  729. // Column8
  730. //
  731. this.Column8.FillWeight = 73.14721F;
  732. this.Column8.MinimumWidth = 66;
  733. this.Column8.Name = "Column8";
  734. this.Column8.ReadOnly = true;
  735. this.Column8.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  736. this.Column8.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  737. //
  738. // Column9
  739. //
  740. this.Column9.FillWeight = 73.14721F;
  741. this.Column9.HeaderText = "石墨含量";
  742. this.Column9.MinimumWidth = 66;
  743. this.Column9.Name = "Column9";
  744. this.Column9.ReadOnly = true;
  745. this.Column9.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  746. this.Column9.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  747. //
  748. // Column10
  749. //
  750. this.Column10.FillWeight = 73.14721F;
  751. this.Column10.HeaderText = "蠕化率";
  752. this.Column10.MinimumWidth = 66;
  753. this.Column10.Name = "Column10";
  754. this.Column10.ReadOnly = true;
  755. this.Column10.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  756. this.Column10.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  757. //
  758. // Column11
  759. //
  760. this.Column11.FillWeight = 73.14721F;
  761. this.Column11.HeaderText = "蠕化级别";
  762. this.Column11.MinimumWidth = 66;
  763. this.Column11.Name = "Column11";
  764. this.Column11.ReadOnly = true;
  765. this.Column11.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  766. this.Column11.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  767. //
  768. // groupBox9
  769. //
  770. this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  771. | System.Windows.Forms.AnchorStyles.Right)));
  772. this.groupBox9.Controls.Add(this.button5);
  773. this.groupBox9.Controls.Add(this.label10);
  774. this.groupBox9.Controls.Add(this.label9);
  775. this.groupBox9.Controls.Add(this.numericUpDown1);
  776. this.groupBox9.Controls.Add(this.label8);
  777. this.groupBox9.Controls.Add(this.button9);
  778. this.groupBox9.Controls.Add(this.button8);
  779. this.groupBox9.Controls.Add(this.dataGridView2);
  780. this.groupBox9.Controls.Add(this.listView2);
  781. this.groupBox9.Controls.Add(this.button7);
  782. this.groupBox9.Controls.Add(this.button6);
  783. this.groupBox9.Location = new System.Drawing.Point(14, 672);
  784. this.groupBox9.Name = "groupBox9";
  785. this.groupBox9.Size = new System.Drawing.Size(1081, 204);
  786. this.groupBox9.TabIndex = 9;
  787. this.groupBox9.TabStop = false;
  788. //
  789. // button5
  790. //
  791. this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  792. this.button5.Location = new System.Drawing.Point(941, 102);
  793. this.button5.Name = "button5";
  794. this.button5.Size = new System.Drawing.Size(128, 26);
  795. this.button5.TabIndex = 10;
  796. this.button5.UseVisualStyleBackColor = true;
  797. this.button5.Click += new System.EventHandler(this.button5_Click);
  798. //
  799. // label10
  800. //
  801. this.label10.AutoSize = true;
  802. this.label10.ForeColor = System.Drawing.SystemColors.ScrollBar;
  803. this.label10.Location = new System.Drawing.Point(927, 9);
  804. this.label10.Name = "label10";
  805. this.label10.Size = new System.Drawing.Size(11, 192);
  806. this.label10.TabIndex = 9;
  807. this.label10.Text = "|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|";
  808. //
  809. // label9
  810. //
  811. this.label9.AutoSize = true;
  812. this.label9.ForeColor = System.Drawing.SystemColors.ScrollBar;
  813. this.label9.Location = new System.Drawing.Point(210, 9);
  814. this.label9.Name = "label9";
  815. this.label9.Size = new System.Drawing.Size(11, 192);
  816. this.label9.TabIndex = 8;
  817. this.label9.Text = "|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|";
  818. //
  819. // numericUpDown1
  820. //
  821. this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  822. this.numericUpDown1.Location = new System.Drawing.Point(993, 162);
  823. this.numericUpDown1.Maximum = new decimal(new int[] {
  824. 10,
  825. 0,
  826. 0,
  827. 0});
  828. this.numericUpDown1.Name = "numericUpDown1";
  829. this.numericUpDown1.Size = new System.Drawing.Size(70, 21);
  830. this.numericUpDown1.TabIndex = 7;
  831. this.numericUpDown1.Value = new decimal(new int[] {
  832. 2,
  833. 0,
  834. 0,
  835. 0});
  836. this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
  837. //
  838. // label8
  839. //
  840. this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  841. this.label8.AutoSize = true;
  842. this.label8.Location = new System.Drawing.Point(957, 167);
  843. this.label8.Name = "label8";
  844. this.label8.Size = new System.Drawing.Size(0, 12);
  845. this.label8.TabIndex = 6;
  846. //
  847. // button9
  848. //
  849. this.button9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  850. this.button9.Location = new System.Drawing.Point(941, 68);
  851. this.button9.Name = "button9";
  852. this.button9.Size = new System.Drawing.Size(128, 26);
  853. this.button9.TabIndex = 5;
  854. this.button9.UseVisualStyleBackColor = true;
  855. this.button9.Click += new System.EventHandler(this.button9_Click);
  856. //
  857. // button8
  858. //
  859. this.button8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  860. this.button8.Location = new System.Drawing.Point(941, 34);
  861. this.button8.Name = "button8";
  862. this.button8.Size = new System.Drawing.Size(128, 26);
  863. this.button8.TabIndex = 4;
  864. this.button8.UseVisualStyleBackColor = true;
  865. this.button8.Click += new System.EventHandler(this.button8_Click);
  866. //
  867. // dataGridView2
  868. //
  869. this.dataGridView2.AllowUserToAddRows = false;
  870. this.dataGridView2.AllowUserToDeleteRows = false;
  871. this.dataGridView2.AllowUserToResizeColumns = false;
  872. this.dataGridView2.AllowUserToResizeRows = false;
  873. this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  874. | System.Windows.Forms.AnchorStyles.Left)
  875. | System.Windows.Forms.AnchorStyles.Right)));
  876. this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  877. this.dataGridView2.BackgroundColor = System.Drawing.Color.White;
  878. this.dataGridView2.ColumnHeadersHeight = 48;
  879. this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  880. this.dataGridViewTextBoxColumn1,
  881. this.dataGridViewTextBoxColumn2,
  882. this.dataGridViewTextBoxColumn3,
  883. this.dataGridViewTextBoxColumn4,
  884. this.dataGridViewTextBoxColumn5,
  885. this.dataGridViewTextBoxColumn6,
  886. this.dataGridViewTextBoxColumn7,
  887. this.dataGridViewTextBoxColumn8,
  888. this.dataGridViewTextBoxColumn9,
  889. this.dataGridViewTextBoxColumn10,
  890. this.dataGridViewTextBoxColumn11,
  891. this.Column12});
  892. this.dataGridView2.Location = new System.Drawing.Point(228, 20);
  893. this.dataGridView2.MultiSelect = false;
  894. this.dataGridView2.Name = "dataGridView2";
  895. this.dataGridView2.ReadOnly = true;
  896. this.dataGridView2.RowHeadersVisible = false;
  897. this.dataGridView2.RowTemplate.Height = 23;
  898. this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  899. this.dataGridView2.Size = new System.Drawing.Size(693, 176);
  900. this.dataGridView2.TabIndex = 3;
  901. //
  902. // dataGridViewTextBoxColumn1
  903. //
  904. this.dataGridViewTextBoxColumn1.FillWeight = 59.7742F;
  905. this.dataGridViewTextBoxColumn1.MinimumWidth = 56;
  906. this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
  907. this.dataGridViewTextBoxColumn1.ReadOnly = true;
  908. this.dataGridViewTextBoxColumn1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  909. this.dataGridViewTextBoxColumn1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  910. //
  911. // dataGridViewTextBoxColumn2
  912. //
  913. this.dataGridViewTextBoxColumn2.FillWeight = 57.7742F;
  914. this.dataGridViewTextBoxColumn2.MinimumWidth = 54;
  915. this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
  916. this.dataGridViewTextBoxColumn2.ReadOnly = true;
  917. this.dataGridViewTextBoxColumn2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  918. this.dataGridViewTextBoxColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  919. //
  920. // dataGridViewTextBoxColumn3
  921. //
  922. this.dataGridViewTextBoxColumn3.FillWeight = 59.7742F;
  923. this.dataGridViewTextBoxColumn3.HeaderText = "球状面积";
  924. this.dataGridViewTextBoxColumn3.MinimumWidth = 55;
  925. this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
  926. this.dataGridViewTextBoxColumn3.ReadOnly = true;
  927. this.dataGridViewTextBoxColumn3.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  928. this.dataGridViewTextBoxColumn3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  929. //
  930. // dataGridViewTextBoxColumn4
  931. //
  932. this.dataGridViewTextBoxColumn4.FillWeight = 59.7742F;
  933. this.dataGridViewTextBoxColumn4.HeaderText = "球状个数";
  934. this.dataGridViewTextBoxColumn4.MinimumWidth = 55;
  935. this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
  936. this.dataGridViewTextBoxColumn4.ReadOnly = true;
  937. this.dataGridViewTextBoxColumn4.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  938. this.dataGridViewTextBoxColumn4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  939. //
  940. // dataGridViewTextBoxColumn5
  941. //
  942. this.dataGridViewTextBoxColumn5.FillWeight = 59.7742F;
  943. this.dataGridViewTextBoxColumn5.HeaderText = "团状、团絮状面积";
  944. this.dataGridViewTextBoxColumn5.MinimumWidth = 55;
  945. this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
  946. this.dataGridViewTextBoxColumn5.ReadOnly = true;
  947. this.dataGridViewTextBoxColumn5.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  948. this.dataGridViewTextBoxColumn5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  949. //
  950. // dataGridViewTextBoxColumn6
  951. //
  952. this.dataGridViewTextBoxColumn6.FillWeight = 59.7742F;
  953. this.dataGridViewTextBoxColumn6.HeaderText = "团状、团絮状个数";
  954. this.dataGridViewTextBoxColumn6.MinimumWidth = 55;
  955. this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
  956. this.dataGridViewTextBoxColumn6.ReadOnly = true;
  957. this.dataGridViewTextBoxColumn6.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  958. this.dataGridViewTextBoxColumn6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  959. //
  960. // dataGridViewTextBoxColumn7
  961. //
  962. this.dataGridViewTextBoxColumn7.FillWeight = 59.7742F;
  963. this.dataGridViewTextBoxColumn7.HeaderText = "蠕虫状面积";
  964. this.dataGridViewTextBoxColumn7.MinimumWidth = 55;
  965. this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
  966. this.dataGridViewTextBoxColumn7.ReadOnly = true;
  967. this.dataGridViewTextBoxColumn7.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  968. this.dataGridViewTextBoxColumn7.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  969. //
  970. // dataGridViewTextBoxColumn8
  971. //
  972. this.dataGridViewTextBoxColumn8.FillWeight = 59.7742F;
  973. this.dataGridViewTextBoxColumn8.HeaderText = "蠕虫状个数";
  974. this.dataGridViewTextBoxColumn8.MinimumWidth = 55;
  975. this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
  976. this.dataGridViewTextBoxColumn8.ReadOnly = true;
  977. this.dataGridViewTextBoxColumn8.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  978. this.dataGridViewTextBoxColumn8.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  979. //
  980. // dataGridViewTextBoxColumn9
  981. //
  982. this.dataGridViewTextBoxColumn9.FillWeight = 59.7742F;
  983. this.dataGridViewTextBoxColumn9.MinimumWidth = 55;
  984. this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9";
  985. this.dataGridViewTextBoxColumn9.ReadOnly = true;
  986. this.dataGridViewTextBoxColumn9.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  987. this.dataGridViewTextBoxColumn9.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  988. //
  989. // dataGridViewTextBoxColumn10
  990. //
  991. this.dataGridViewTextBoxColumn10.FillWeight = 59.7742F;
  992. this.dataGridViewTextBoxColumn10.HeaderText = "石墨含量";
  993. this.dataGridViewTextBoxColumn10.MinimumWidth = 55;
  994. this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10";
  995. this.dataGridViewTextBoxColumn10.ReadOnly = true;
  996. this.dataGridViewTextBoxColumn10.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  997. this.dataGridViewTextBoxColumn10.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  998. //
  999. // dataGridViewTextBoxColumn11
  1000. //
  1001. this.dataGridViewTextBoxColumn11.FillWeight = 59.7742F;
  1002. this.dataGridViewTextBoxColumn11.HeaderText = "蠕化率";
  1003. this.dataGridViewTextBoxColumn11.MinimumWidth = 55;
  1004. this.dataGridViewTextBoxColumn11.Name = "dataGridViewTextBoxColumn11";
  1005. this.dataGridViewTextBoxColumn11.ReadOnly = true;
  1006. this.dataGridViewTextBoxColumn11.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  1007. this.dataGridViewTextBoxColumn11.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  1008. //
  1009. // Column12
  1010. //
  1011. this.Column12.FillWeight = 59.7742F;
  1012. this.Column12.HeaderText = "蠕化级别";
  1013. this.Column12.MinimumWidth = 55;
  1014. this.Column12.Name = "Column12";
  1015. this.Column12.ReadOnly = true;
  1016. this.Column12.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  1017. this.Column12.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  1018. //
  1019. // listView2
  1020. //
  1021. this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  1022. | System.Windows.Forms.AnchorStyles.Left)));
  1023. this.listView2.HideSelection = false;
  1024. this.listView2.Location = new System.Drawing.Point(16, 56);
  1025. this.listView2.Name = "listView2";
  1026. this.listView2.Size = new System.Drawing.Size(181, 140);
  1027. this.listView2.TabIndex = 2;
  1028. this.listView2.UseCompatibleStateImageBehavior = false;
  1029. this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
  1030. //
  1031. // button7
  1032. //
  1033. this.button7.Location = new System.Drawing.Point(145, 20);
  1034. this.button7.Name = "button7";
  1035. this.button7.Size = new System.Drawing.Size(52, 26);
  1036. this.button7.TabIndex = 1;
  1037. this.button7.UseVisualStyleBackColor = true;
  1038. this.button7.Click += new System.EventHandler(this.button7_Click);
  1039. //
  1040. // button6
  1041. //
  1042. this.button6.Location = new System.Drawing.Point(16, 20);
  1043. this.button6.Name = "button6";
  1044. this.button6.Size = new System.Drawing.Size(93, 26);
  1045. this.button6.TabIndex = 0;
  1046. this.button6.UseVisualStyleBackColor = true;
  1047. this.button6.Click += new System.EventHandler(this.button6_Click);
  1048. //
  1049. // groupBox7
  1050. //
  1051. this.groupBox7.Controls.Add(this.label5);
  1052. this.groupBox7.Controls.Add(this.numericUpDown6);
  1053. this.groupBox7.Controls.Add(this.label4);
  1054. this.groupBox7.Location = new System.Drawing.Point(149, 511);
  1055. this.groupBox7.Name = "groupBox7";
  1056. this.groupBox7.Size = new System.Drawing.Size(353, 37);
  1057. this.groupBox7.TabIndex = 10;
  1058. this.groupBox7.TabStop = false;
  1059. this.groupBox7.Text = "分类参数设置";
  1060. //
  1061. // label5
  1062. //
  1063. this.label5.AutoSize = true;
  1064. this.label5.Location = new System.Drawing.Point(197, 19);
  1065. this.label5.Name = "label5";
  1066. this.label5.Size = new System.Drawing.Size(71, 12);
  1067. this.label5.TabIndex = 2;
  1068. this.label5.Text = "μm进行分类";
  1069. //
  1070. // numericUpDown6
  1071. //
  1072. this.numericUpDown6.Location = new System.Drawing.Point(135, 13);
  1073. this.numericUpDown6.Maximum = new decimal(new int[] {
  1074. 50,
  1075. 0,
  1076. 0,
  1077. 0});
  1078. this.numericUpDown6.Name = "numericUpDown6";
  1079. this.numericUpDown6.Size = new System.Drawing.Size(58, 21);
  1080. this.numericUpDown6.TabIndex = 1;
  1081. this.numericUpDown6.Value = new decimal(new int[] {
  1082. 10,
  1083. 0,
  1084. 0,
  1085. 0});
  1086. this.numericUpDown6.ValueChanged += new System.EventHandler(this.numericUpDown6_ValueChanged);
  1087. //
  1088. // label4
  1089. //
  1090. this.label4.AutoSize = true;
  1091. this.label4.Location = new System.Drawing.Point(30, 19);
  1092. this.label4.Name = "label4";
  1093. this.label4.Size = new System.Drawing.Size(101, 12);
  1094. this.label4.TabIndex = 0;
  1095. this.label4.Text = "最大中心长度大于";
  1096. //
  1097. // VermiculateCastIronJBT3829Classification
  1098. //
  1099. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  1100. this.ClientSize = new System.Drawing.Size(1107, 881);
  1101. this.Controls.Add(this.groupBox7);
  1102. this.Controls.Add(this.groupBox9);
  1103. this.Controls.Add(this.groupBox8);
  1104. this.Controls.Add(this.groupBox6);
  1105. this.Controls.Add(this.groupBox5);
  1106. this.Controls.Add(this.groupBox3);
  1107. this.Controls.Add(this.groupBox2);
  1108. this.Controls.Add(this.groupBox1);
  1109. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  1110. this.MaximizeBox = false;
  1111. this.MinimizeBox = false;
  1112. this.Name = "VermiculateCastIronJBT3829Classification";
  1113. this.Text = "JB/T 3829-1999(蠕化级别)";
  1114. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InclusionsStandardDialog_FormClosing);
  1115. this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData);
  1116. this.Load += new System.EventHandler(this.GrainSizeDialog_Load);
  1117. this.Controls.SetChildIndex(this.groupBox1, 0);
  1118. this.Controls.SetChildIndex(this.groupBox2, 0);
  1119. this.Controls.SetChildIndex(this.groupBox3, 0);
  1120. this.Controls.SetChildIndex(this.groupBox5, 0);
  1121. this.Controls.SetChildIndex(this.groupBox6, 0);
  1122. this.Controls.SetChildIndex(this.groupBox8, 0);
  1123. this.Controls.SetChildIndex(this.groupBox9, 0);
  1124. this.Controls.SetChildIndex(this.groupBox7, 0);
  1125. this.groupBox1.ResumeLayout(false);
  1126. this.groupBox1.PerformLayout();
  1127. this.groupBox2.ResumeLayout(false);
  1128. this.groupBox5.ResumeLayout(false);
  1129. this.groupBox5.PerformLayout();
  1130. ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).EndInit();
  1131. ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();
  1132. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
  1133. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
  1134. this.groupBox6.ResumeLayout(false);
  1135. this.groupBox6.PerformLayout();
  1136. this.groupBox8.ResumeLayout(false);
  1137. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  1138. this.groupBox9.ResumeLayout(false);
  1139. this.groupBox9.PerformLayout();
  1140. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  1141. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
  1142. this.groupBox7.ResumeLayout(false);
  1143. this.groupBox7.PerformLayout();
  1144. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).EndInit();
  1145. this.ResumeLayout(false);
  1146. }
  1147. /// <summary>
  1148. /// 初始化其他控件
  1149. /// </summary>
  1150. private void InitOtherTools()
  1151. {
  1152. //
  1153. //初始化图像控件
  1154. //
  1155. this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
  1156. this.documentWorkspace.Dock = DockStyle.Fill;
  1157. this.documentWorkspace.HookMouseEvents();
  1158. this.documentWorkspace.AuxiliaryLineEnabled = false;
  1159. this.documentWorkspace.Visible = false;
  1160. this.documentWorkspace.activeTool = Annotation.Enum.DrawToolType.NullTool;
  1161. this.groupBox3.Controls.Add(documentWorkspace);
  1162. //
  1163. //初始化操作按钮
  1164. //
  1165. this.commonControlButtons = new CommonControlButtons();
  1166. this.commonControlButtons.Dock = DockStyle.Top;
  1167. this.commonControlButtons.Height = 30;
  1168. this.commonControlButtons.HideZoomToWindowAndActualSize();
  1169. this.commonControlButtons.Visible = false;
  1170. this.groupBox3.Controls.Add(commonControlButtons);
  1171. //
  1172. //调色板
  1173. //
  1174. this.colorsForm1 = new ColorsForm();
  1175. this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.colorsForm1Changed));
  1176. this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
  1177. //
  1178. //
  1179. //获取系统标尺-微米
  1180. //
  1181. this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength);
  1182. //
  1183. //获取系统放大倍数
  1184. //
  1185. this.gainNumber = this.documentWorkspace.GetGainMultiple();
  1186. if (this.gainNumber == 0)
  1187. this.gainNumber = 1;
  1188. //二值化集成2
  1189. bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
  1190. binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text"), PdnResources.GetString("Menu.Grainboundarytoreproduce.text") }
  1191. , this.bc, this.appWorkspace, this.documentWorkspace, this.listView1);//初始化相的工作结构
  1192. binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
  1193. }
  1194. //二值化集成3
  1195. #region 二值化相关方法
  1196. private void InclusionsStandardDialog_FormClosing(object sender, FormClosingEventArgs e)
  1197. {
  1198. binaryClass.saveParams();
  1199. }
  1200. private void ShownChoiseItemAndInitData(object sender, EventArgs e)
  1201. {
  1202. binaryClass.RefreshHistogramControl1Values();
  1203. }
  1204. /// <summary>
  1205. /// 添加参数改变的监听
  1206. /// </summary>
  1207. /// <param name="sender"></param>
  1208. /// <param name="e"></param>
  1209. private void GrainSizeDialog_Load(object sender, EventArgs e)
  1210. {
  1211. this.binaryClass.loadParams();
  1212. }
  1213. private bool bcBinaryChecked()
  1214. {
  1215. return bc != null && bc.BinaryChecked;
  1216. }
  1217. private bool bcOriginChecked()
  1218. {
  1219. return bc != null && bc.OriginChecked;
  1220. }
  1221. bool isChanegd = false;//判断参数是否变化
  1222. /// <summary>
  1223. /// 参数改变时,重新处理图像
  1224. /// </summary>
  1225. /// <param name="sender"></param>
  1226. /// <param name="e"></param>
  1227. private void bClassBinaryImplFinishAction(object sender, EventArgs e)
  1228. {
  1229. if (this.documentWorkspace.CompositionSurface == null)
  1230. return;
  1231. if (bcBinaryChecked() && this.checkBox3.Checked)
  1232. {
  1233. ResetAreaAndContent();
  1234. ReloadDebrisSelection();
  1235. changeColor = false;
  1236. this.documentWorkspace.PhaseModels[1].choise = true;
  1237. this.documentWorkspace.PhaseModels[0].choise = false;
  1238. }
  1239. else if (bcBinaryChecked() && !this.checkBox3.Checked)
  1240. {
  1241. ResetAreaAndContent();
  1242. changeColor = false;
  1243. this.documentWorkspace.PhaseModels[1].choise = true;
  1244. this.documentWorkspace.PhaseModels[0].choise = false;
  1245. }
  1246. else
  1247. {
  1248. this.documentWorkspace.PhaseModels[0].choise = false;
  1249. this.documentWorkspace.PhaseModels[1].choise = false;
  1250. }
  1251. isChanegd = true;
  1252. this.documentWorkspace.Refresh();
  1253. }
  1254. /// <summary>
  1255. /// 显示原图/原图+二值图
  1256. /// </summary>
  1257. /// <param name="sender"></param>
  1258. /// <param name="e"></param>
  1259. private void bcOriginCheckedChanged(object sender, EventArgs e)
  1260. {
  1261. if (!bcOriginChecked())
  1262. {
  1263. if (bcBinaryChecked())
  1264. {
  1265. //this.documentWorkspace.PhaseModels[0].choise = false;
  1266. this.documentWorkspace.PhaseModels[1].choise = true;
  1267. }
  1268. }
  1269. else
  1270. {
  1271. this.documentWorkspace.PhaseModels[0].choise = false;
  1272. this.documentWorkspace.PhaseModels[1].choise = false;
  1273. }
  1274. this.documentWorkspace.Refresh();
  1275. }
  1276. #endregion
  1277. /// <summary>
  1278. /// 初始化图片列表数据
  1279. /// </summary>
  1280. public void InitPicList()
  1281. {
  1282. //初始化图片列表
  1283. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  1284. {
  1285. this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  1286. this.listView1.Items.Add("", i);
  1287. this.listView1.Items[i].ImageIndex = i;
  1288. this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  1289. this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  1290. }
  1291. }
  1292. /// <summary>
  1293. /// 初始化表头
  1294. /// </summary>
  1295. private void InitGridHeader()
  1296. {
  1297. //
  1298. //结果展示表
  1299. //
  1300. this.dataGridView1.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1301. this.dataGridView1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1302. this.dataGridView1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1303. this.dataGridView1.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1304. this.dataGridView1.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1305. this.dataGridView1.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1306. this.dataGridView1.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1307. this.dataGridView1.Columns[7].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1308. this.dataGridView1.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1309. this.dataGridView1.Columns[9].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1310. this.dataGridView1.Columns[10].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1311. //
  1312. //分析结果表
  1313. //
  1314. this.dataGridView2.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1315. this.dataGridView2.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1316. this.dataGridView2.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1317. this.dataGridView2.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1318. this.dataGridView2.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1319. this.dataGridView2.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1320. this.dataGridView2.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1321. this.dataGridView2.Columns[7].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1322. this.dataGridView2.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1323. this.dataGridView2.Columns[9].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1324. this.dataGridView2.Columns[10].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1325. this.dataGridView2.Columns[11].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1326. //
  1327. //左下表
  1328. //
  1329. this.listView2.View = View.Details;
  1330. ColumnHeader header0 = new ColumnHeader();
  1331. header0.Text = PdnResources.GetString("Menu.Imagelist.Text");
  1332. header0.Width = 175;
  1333. this.listView2.Columns.Add(header0);
  1334. }
  1335. /// <summary>
  1336. /// 初始化画布按键功能
  1337. /// </summary>
  1338. private void InitCommonButtonEvent()
  1339. {
  1340. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  1341. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  1342. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  1343. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  1344. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  1345. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  1346. }
  1347. private void zoomInButton_Click(object sender, EventArgs e)
  1348. {
  1349. this.documentWorkspace.ZoomIn();
  1350. }
  1351. private void zoomOutButton_Click(object sender, EventArgs e)
  1352. {
  1353. this.documentWorkspace.ZoomOut();
  1354. }
  1355. private void zoomToWindowButton_Click(object sender, EventArgs e)
  1356. {
  1357. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  1358. }
  1359. private void actualSizeButton_Click(object sender, EventArgs e)
  1360. {
  1361. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  1362. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  1363. }
  1364. private void pointerButton_Click(object sender, EventArgs e)
  1365. {
  1366. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
  1367. }
  1368. private void mobileModeButton_Click(object sender, EventArgs e)
  1369. {
  1370. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  1371. }
  1372. /// <summary>
  1373. /// 添加画布绑定事件
  1374. /// </summary>
  1375. private void AddPictureBoxEvent()
  1376. {
  1377. this.documentWorkspace.panel.Paint += new PaintEventHandler(this.BoxPaintHandler);
  1378. }
  1379. /// <summary>
  1380. /// 绘制事件
  1381. /// </summary>
  1382. /// <param name="sender"></param>
  1383. /// <param name="e"></param>
  1384. private void BoxPaintHandler(object sender, PaintEventArgs e)
  1385. {
  1386. if (this.documentWorkspace.CompositionSurface != null)
  1387. {
  1388. Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
  1389. int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
  1390. int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
  1391. int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
  1392. int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
  1393. e.Graphics.TranslateTransform(x, y);
  1394. e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
  1395. Draw(e.Graphics);
  1396. e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
  1397. e.Graphics.TranslateTransform(-x, -y);
  1398. }
  1399. }
  1400. /// <summary>
  1401. /// 绘制
  1402. /// </summary>
  1403. private void Draw(Graphics graphics)
  1404. {
  1405. graphics.SmoothingMode = SmoothingMode.AntiAlias;
  1406. Font font = new Font(this.fontStyle, this.fontSize);
  1407. Brush brush = new SolidBrush(this.fontColor);
  1408. //显示圆形系数
  1409. if (this.checkBox4.Checked && !bcOriginChecked() && bcBinaryChecked())
  1410. {
  1411. if(this.ballPoint != null && this.ballPoint.Count > 0)
  1412. {
  1413. for(int i = 0; i < this.ballPoint.Count; i++)
  1414. {
  1415. graphics.DrawString(Math.Round(this.ballCircleList[i], Convert.ToInt32(this.numericUpDown1.Value)) + "", font, brush,
  1416. new PointF(this.ballPoint[i][this.ballPoint[i].Count - 1].X, this.ballPoint[i][this.ballPoint[i].Count - 1].Y));
  1417. }
  1418. }
  1419. if (this.groupPoint != null && this.groupPoint.Count > 0)
  1420. {
  1421. for (int i = 0; i < this.groupPoint.Count; i++)
  1422. {
  1423. graphics.DrawString(Math.Round(this.groupCircleList[i], Convert.ToInt32(this.numericUpDown1.Value)) + "", font, brush,
  1424. new PointF(this.groupPoint[i][this.groupPoint[i].Count - 1].X, this.groupPoint[i][this.groupPoint[i].Count - 1].Y));
  1425. }
  1426. }
  1427. if (this.vermicularPoint != null && this.vermicularPoint.Count > 0)
  1428. {
  1429. for (int i = 0; i < this.vermicularPoint.Count; i++)
  1430. {
  1431. graphics.DrawString(Math.Round(this.vermicularCircleList[i], Convert.ToInt32(this.numericUpDown1.Value)) + "", font, brush,
  1432. new PointF(this.vermicularPoint[i][this.vermicularPoint[i].Count - 1].X, this.vermicularPoint[i][this.vermicularPoint[i].Count - 1].Y));
  1433. }
  1434. }
  1435. }
  1436. brush.Dispose();
  1437. font.Dispose();
  1438. }
  1439. /// <summary>
  1440. /// 添加内容单元格
  1441. /// </summary>
  1442. /// <param name="text"></param>
  1443. /// <param name="tag"></param>
  1444. /// <returns></returns>
  1445. private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag)
  1446. {
  1447. DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
  1448. textboxcell.Value = text;
  1449. textboxcell.Tag = tag;
  1450. return textboxcell;
  1451. }
  1452. /// <summary>
  1453. /// 设置按钮
  1454. /// </summary>
  1455. /// <param name="sender"></param>
  1456. /// <param name="e"></param>
  1457. private void button1_Click(object sender, EventArgs e)
  1458. {
  1459. AnalyzeSettingDialog metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.VermiculateCastIronJBT3829");
  1460. if (metallographicMethodSetDialog.hasModule)
  1461. {
  1462. metallographicMethodSetDialog.StartPosition = FormStartPosition.CenterScreen;
  1463. metallographicMethodSetDialog.ShowDialog();
  1464. }
  1465. else
  1466. {
  1467. metallographicMethodSetDialog = null;
  1468. }
  1469. }
  1470. /// <summary>
  1471. /// 保存结果按钮
  1472. /// </summary>
  1473. /// <param name="sender"></param>
  1474. /// <param name="e"></param>
  1475. private void button2_Click(object sender, EventArgs e)
  1476. {
  1477. if (this.listView1.SelectedItems.Count > 0)
  1478. {
  1479. string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
  1480. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
  1481. bool replace = false;
  1482. int rowIndex = 0;
  1483. if (this.dataGridView1.Rows.Count > 0)
  1484. {
  1485. if (this.listView2.Items.Count > 0)
  1486. {
  1487. foreach (ListViewItem item in this.listView2.Items)
  1488. {
  1489. if (item.Name.Equals(tag))
  1490. {
  1491. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1492. if (dr == DialogResult.OK)
  1493. {
  1494. replace = true;
  1495. }
  1496. else
  1497. {
  1498. return;
  1499. }
  1500. break;
  1501. }
  1502. }
  1503. }
  1504. //有重名需要替换
  1505. if (replace)
  1506. {
  1507. for (int i = 0; i < this.resultTableList.Count; i++)
  1508. {
  1509. if (this.resultTableList[i].TableName.Equals(tag))
  1510. {
  1511. rowIndex = i;
  1512. this.resultTableList.Remove(this.resultTableList[i]);
  1513. DataTable dt = new DataTable(tag);
  1514. dt.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
  1515. dt.Columns.Add(PdnResources.GetString("Menu.view.text"));
  1516. dt.Columns.Add("球状面积");
  1517. dt.Columns.Add("球状个数");
  1518. dt.Columns.Add("团状、团絮状面积");
  1519. dt.Columns.Add("团状、团絮状个数");
  1520. dt.Columns.Add("蠕虫状面积");
  1521. dt.Columns.Add("蠕虫状个数");
  1522. dt.Columns.Add(PdnResources.GetString("Menu.Thetotalarea.text"));
  1523. dt.Columns.Add("石墨含量");
  1524. dt.Columns.Add("蠕化率");
  1525. dt.Columns.Add("蠕化级别");
  1526. DataRow dataRow = dt.NewRow();
  1527. dataRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
  1528. dataRow[PdnResources.GetString("Menu.view.text")] = PdnResources.GetString("Menu.view.text")+"1";
  1529. dataRow["球状面积"] = ballCircleArea;
  1530. dataRow["球状个数"] = ballCircleList.Count;
  1531. dataRow["团状、团絮状面积"] = groupCircleArea;
  1532. dataRow["团状、团絮状个数"] = groupCircleList.Count;
  1533. dataRow["蠕虫状面积"] = vermicularCircleArea;
  1534. dataRow["蠕虫状个数"] = vermicularCircleList.Count;
  1535. int bitArea = this.bitmap.Width * this.bitmap.Height;
  1536. dataRow[PdnResources.GetString("Menu.Thetotalarea.text")] = bitArea;
  1537. dataRow["石墨含量"] = (ballCircleArea + groupCircleArea + vermicularCircleArea) / bitArea;
  1538. double CreepRatio = (vermicularCircleArea + 0.5 * groupCircleArea) / (ballCircleArea + groupCircleArea + vermicularCircleArea);
  1539. dataRow["蠕化率"] = CreepRatio;
  1540. if (CreepRatio >= 0.95)
  1541. dataRow["蠕化级别"] = "蠕95";
  1542. else if (CreepRatio < 0.95 && CreepRatio >= 0.9)
  1543. dataRow["蠕化级别"] = "蠕90";
  1544. else if (CreepRatio < 0.9 && CreepRatio >= 0.85)
  1545. dataRow["蠕化级别"] = "蠕85";
  1546. else if (CreepRatio < 0.85 && CreepRatio >= 0.8)
  1547. dataRow["蠕化级别"] = "蠕80";
  1548. else if (CreepRatio < 0.8 && CreepRatio >= 0.7)
  1549. dataRow["蠕化级别"] = "蠕70";
  1550. else if (CreepRatio < 0.7 && CreepRatio >= 0.6)
  1551. dataRow["蠕化级别"] = "蠕60";
  1552. else if (CreepRatio < 0.6 && CreepRatio >= 0.5)
  1553. dataRow["蠕化级别"] = "蠕50";
  1554. else if (CreepRatio < 0.5 && CreepRatio >= 0.4)
  1555. dataRow["蠕化级别"] = "蠕40";
  1556. else
  1557. dataRow["蠕化级别"] = PdnResources.GetString("Menu.Theunknown.Text");
  1558. dt.Rows.Add(dataRow);
  1559. DataRow avgRow = dt.NewRow();
  1560. avgRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
  1561. avgRow[PdnResources.GetString("Menu.view.text")] = PdnResources.GetString("Menu.Image.Average.Text");
  1562. avgRow["球状面积"] = dt.Rows[0][2].ToString();
  1563. avgRow["球状个数"] = dt.Rows[0][3].ToString();
  1564. avgRow["团状、团絮状面积"] = dt.Rows[0][4].ToString();
  1565. avgRow["团状、团絮状个数"] = dt.Rows[0][5].ToString();
  1566. avgRow["蠕虫状面积"] = dt.Rows[0][6].ToString();
  1567. avgRow["蠕虫状个数"] = dt.Rows[0][7].ToString();
  1568. avgRow[PdnResources.GetString("Menu.Thetotalarea.text")] = dt.Rows[0][8].ToString();
  1569. avgRow["石墨含量"] = dt.Rows[0][9].ToString();
  1570. avgRow["蠕化率"] = dt.Rows[0][10].ToString();
  1571. avgRow["蠕化级别"] = dt.Rows[0][11].ToString();
  1572. dt.Rows.Add(avgRow);
  1573. resultTableList.Insert(rowIndex, dt);
  1574. }
  1575. }
  1576. }
  1577. //新增
  1578. else
  1579. {
  1580. ListViewItem listViewItem = new ListViewItem();
  1581. listViewItem.Name = tag;
  1582. listViewItem.SubItems[0].Text = imgName;
  1583. this.listView2.Items.Add(listViewItem);
  1584. this.listView2.SelectedItems.Clear();
  1585. this.listView2.Items[this.listView2.Items.Count - 1].Selected = true;
  1586. DataTable dt = new DataTable(tag);
  1587. dt.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
  1588. dt.Columns.Add(PdnResources.GetString("Menu.view.text"));
  1589. dt.Columns.Add("球状面积");
  1590. dt.Columns.Add("球状个数");
  1591. dt.Columns.Add("团状、团絮状面积");
  1592. dt.Columns.Add("团状、团絮状个数");
  1593. dt.Columns.Add("蠕虫状面积");
  1594. dt.Columns.Add("蠕虫状个数");
  1595. dt.Columns.Add(PdnResources.GetString("Menu.Thetotalarea.text"));
  1596. dt.Columns.Add("石墨含量");
  1597. dt.Columns.Add("蠕化率");
  1598. dt.Columns.Add("蠕化级别");
  1599. DataRow dataRow = dt.NewRow();
  1600. dataRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
  1601. dataRow[PdnResources.GetString("Menu.view.text")] = PdnResources.GetString("Menu.view.text")+"1";
  1602. dataRow["球状面积"] = ballCircleArea;
  1603. dataRow["球状个数"] = ballCircleList.Count;
  1604. dataRow["团状、团絮状面积"] = groupCircleArea;
  1605. dataRow["团状、团絮状个数"] = groupCircleList.Count;
  1606. dataRow["蠕虫状面积"] = vermicularCircleArea;
  1607. dataRow["蠕虫状个数"] = vermicularCircleList.Count;
  1608. int bitArea = this.bitmap.Width * this.bitmap.Height;
  1609. dataRow[PdnResources.GetString("Menu.Thetotalarea.text")] = bitArea;
  1610. dataRow["石墨含量"] = (ballCircleArea + groupCircleArea + vermicularCircleArea) / bitArea;
  1611. double CreepRatio = (vermicularCircleArea + 0.5 * groupCircleArea) / (ballCircleArea + groupCircleArea + vermicularCircleArea);
  1612. dataRow["蠕化率"] = CreepRatio;
  1613. if (CreepRatio >= 0.95)
  1614. dataRow["蠕化级别"] = "蠕95";
  1615. else if (CreepRatio < 0.95 && CreepRatio >= 0.9)
  1616. dataRow["蠕化级别"] = "蠕90";
  1617. else if (CreepRatio < 0.9 && CreepRatio >= 0.85)
  1618. dataRow["蠕化级别"] = "蠕85";
  1619. else if (CreepRatio < 0.85 && CreepRatio >= 0.8)
  1620. dataRow["蠕化级别"] = "蠕80";
  1621. else if (CreepRatio < 0.8 && CreepRatio >= 0.7)
  1622. dataRow["蠕化级别"] = "蠕70";
  1623. else if (CreepRatio < 0.7 && CreepRatio >= 0.6)
  1624. dataRow["蠕化级别"] = "蠕60";
  1625. else if (CreepRatio < 0.6 && CreepRatio >= 0.5)
  1626. dataRow["蠕化级别"] = "蠕50";
  1627. else if (CreepRatio < 0.5 && CreepRatio >= 0.4)
  1628. dataRow["蠕化级别"] = "蠕40";
  1629. else
  1630. dataRow["蠕化级别"] = PdnResources.GetString("Menu.Theunknown.Text");
  1631. dt.Rows.Add(dataRow);
  1632. DataRow avgRow = dt.NewRow();
  1633. avgRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
  1634. avgRow[PdnResources.GetString("Menu.view.text")] = PdnResources.GetString("Menu.Image.Average.Text");
  1635. avgRow["球状面积"] = dt.Rows[0][2].ToString();
  1636. avgRow["球状个数"] = dt.Rows[0][3].ToString();
  1637. avgRow["团状、团絮状面积"] = dt.Rows[0][4].ToString();
  1638. avgRow["团状、团絮状个数"] = dt.Rows[0][5].ToString();
  1639. avgRow["蠕虫状面积"] = dt.Rows[0][6].ToString();
  1640. avgRow["蠕虫状个数"] = dt.Rows[0][7].ToString();
  1641. avgRow[PdnResources.GetString("Menu.Thetotalarea.text")] = dt.Rows[0][8].ToString();
  1642. avgRow["石墨含量"] = dt.Rows[0][9].ToString();
  1643. avgRow["蠕化率"] = dt.Rows[0][10].ToString();
  1644. avgRow["蠕化级别"] = dt.Rows[0][11].ToString();
  1645. dt.Rows.Add(avgRow);
  1646. resultTableList.Add(dt);
  1647. }
  1648. RefreshDataGridView2();
  1649. //保存处理后的图片
  1650. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  1651. List<Bitmap> tempBit = new List<Bitmap>();
  1652. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1653. originalBit.Tag = pantographRatio;
  1654. tempBit.Add(originalBit);
  1655. Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[1].mat);
  1656. Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  1657. Graphics graphics = Graphics.FromImage(newBit);
  1658. graphics.DrawImage(processedBit, new PointF(0, 0));
  1659. Draw(graphics);
  1660. newBit.Tag = pantographRatio;
  1661. tempBit.Add(newBit);
  1662. if (bitDic.ContainsKey(tag))
  1663. bitDic[tag] = tempBit;
  1664. else
  1665. bitDic.Add(tag, tempBit);
  1666. //拼接中间数据
  1667. List<List<string>> dataList = new List<List<string>>();
  1668. List<string> columnName = new List<string>();
  1669. columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
  1670. columnName.Add(PdnResources.GetString("Menu.area.text"));
  1671. columnName.Add(PdnResources.GetString("Menu.Maximumcaliperdiameter.text"));
  1672. columnName.Add("圆形系数");
  1673. dataList.Add(columnName);
  1674. if (this.tempArea.Count > 0)
  1675. {
  1676. for (int i = 0; i < this.tempArea.Count; i++)
  1677. {
  1678. List<string> strList = new List<string>();
  1679. strList.Add((i + 1).ToString());
  1680. strList.Add(this.tempArea[i]);
  1681. strList.Add(this.maxCaliperDiameter[i]);
  1682. strList.Add(this.circleCoefficientList[i]);
  1683. dataList.Add(strList);
  1684. }
  1685. }
  1686. bool isExist = false;//是否已存在进行替换
  1687. int modelIndex = -1;//要替换的下标
  1688. for (int j = 0; j < tempDataModel.Count; j++)
  1689. {
  1690. if (tempDataModel[j].tagName.Equals(tag))
  1691. {
  1692. isExist = true;
  1693. modelIndex = j;
  1694. break;
  1695. }
  1696. }
  1697. if (isExist && modelIndex > -1)
  1698. tempDataModel[modelIndex].dataList = dataList;
  1699. else
  1700. {
  1701. ExportProjectModel newModel = new ExportProjectModel();
  1702. newModel.tagName = tag;
  1703. newModel.picName = imgName;
  1704. newModel.dataList = dataList;
  1705. tempDataModel.Add(newModel);
  1706. }
  1707. }
  1708. else
  1709. {
  1710. MessageBox.Show(PdnResources.GetString("Menu.Noinformationtosave.text"));
  1711. }
  1712. }
  1713. else
  1714. {
  1715. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapictaurefirst.Text"));
  1716. }
  1717. }
  1718. /// <summary>
  1719. /// 刷新分析结果表
  1720. /// </summary>
  1721. private void RefreshDataGridView2()
  1722. {
  1723. this.dataGridView2.Rows.Clear();
  1724. if (this.showAll)
  1725. {
  1726. if (this.resultTableList.Count > 0)
  1727. {
  1728. foreach (DataTable dt in resultTableList)
  1729. {
  1730. for(int i = 0; i < dt.Rows.Count; i++)
  1731. {
  1732. DataGridViewRow row = new DataGridViewRow();
  1733. row.Height = 30;
  1734. row.Cells.Add(CreateTextBoxCell(dt.Rows[i][0].ToString(), ""));
  1735. row.Cells.Add(CreateTextBoxCell(dt.Rows[i][1].ToString(), ""));
  1736. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][2].ToString()) ? "0" :
  1737. dt.Rows[i][2].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1738. row.Cells.Add(CreateTextBoxCell(dt.Rows[i][3].ToString(), ""));
  1739. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][4].ToString()) ? "0" :
  1740. dt.Rows[i][4].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1741. row.Cells.Add(CreateTextBoxCell(dt.Rows[i][5].ToString(), ""));
  1742. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][6].ToString()) ? "0" :
  1743. dt.Rows[i][6].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1744. row.Cells.Add(CreateTextBoxCell(dt.Rows[i][7].ToString(), ""));
  1745. row.Cells.Add(CreateTextBoxCell(dt.Rows[i][8].ToString(), ""));
  1746. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][9].ToString()) ? "0" :
  1747. dt.Rows[i][9].ToString()) * 100, Convert.ToInt32(this.numericUpDown1.Value)) + "%", ""));
  1748. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][10].ToString()) ? "0" :
  1749. dt.Rows[i][10].ToString()) * 100, Convert.ToInt32(this.numericUpDown1.Value)) + "%", ""));
  1750. row.Cells.Add(CreateTextBoxCell(dt.Rows[i][11].ToString(), ""));
  1751. this.dataGridView2.Rows.Add(row);
  1752. }
  1753. }
  1754. }
  1755. }
  1756. else
  1757. {
  1758. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  1759. {
  1760. for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
  1761. {
  1762. string tableName = this.listView2.SelectedItems[i].Name;
  1763. foreach (DataTable dt in resultTableList)
  1764. {
  1765. if (dt.TableName.Equals(tableName))
  1766. {
  1767. for (int j = 0; j < dt.Rows.Count; j++)
  1768. {
  1769. DataGridViewRow row = new DataGridViewRow();
  1770. row.Height = 30;
  1771. row.Cells.Add(CreateTextBoxCell(dt.Rows[j][0].ToString(), ""));
  1772. row.Cells.Add(CreateTextBoxCell(dt.Rows[j][1].ToString(), ""));
  1773. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][2].ToString()) ? "0" :
  1774. dt.Rows[j][2].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1775. row.Cells.Add(CreateTextBoxCell(dt.Rows[j][3].ToString(), ""));
  1776. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][4].ToString()) ? "0" :
  1777. dt.Rows[j][4].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1778. row.Cells.Add(CreateTextBoxCell(dt.Rows[j][5].ToString(), ""));
  1779. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][6].ToString()) ? "0" :
  1780. dt.Rows[j][6].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1781. row.Cells.Add(CreateTextBoxCell(dt.Rows[j][7].ToString(), ""));
  1782. row.Cells.Add(CreateTextBoxCell(dt.Rows[j][8].ToString(), ""));
  1783. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][9].ToString()) ? "0" :
  1784. dt.Rows[j][9].ToString()) * 100, Convert.ToInt32(this.numericUpDown1.Value)) + "%", ""));
  1785. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][10].ToString()) ? "0" :
  1786. dt.Rows[j][10].ToString()) * 100, Convert.ToInt32(this.numericUpDown1.Value)) + "%", ""));
  1787. row.Cells.Add(CreateTextBoxCell(dt.Rows[j][11].ToString(), ""));
  1788. this.dataGridView2.Rows.Add(row);
  1789. }
  1790. }
  1791. }
  1792. }
  1793. }
  1794. }
  1795. }
  1796. /// <summary>
  1797. /// 全部显示按钮
  1798. /// </summary>
  1799. /// <param name="sender"></param>
  1800. /// <param name="e"></param>
  1801. private void button6_Click(object sender, EventArgs e)
  1802. {
  1803. if(this.button6.Text == PdnResources.GetString("Menu.Showall.text"))
  1804. {
  1805. this.button6.Text = PdnResources.GetString("Menu.Cancelshowall.text");
  1806. this.showAll = true;
  1807. RefreshDataGridView2();
  1808. }
  1809. else if (this.button6.Text == PdnResources.GetString("Menu.Cancelshowall.text"))
  1810. {
  1811. this.button6.Text = PdnResources.GetString("Menu.Showall.text");
  1812. this.showAll = false;
  1813. RefreshDataGridView2();
  1814. }
  1815. }
  1816. /// <summary>
  1817. /// 删除按钮
  1818. /// </summary>
  1819. /// <param name="sender"></param>
  1820. /// <param name="e"></param>
  1821. private void button7_Click(object sender, EventArgs e)
  1822. {
  1823. if(this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  1824. {
  1825. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Determineallanalysisrlete.text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1826. if (dr == DialogResult.OK)
  1827. {
  1828. for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
  1829. {
  1830. string tableName = this.listView2.SelectedItems[i].Name;
  1831. foreach (DataTable dt in resultTableList)
  1832. {
  1833. if (dt.TableName.Equals(tableName))
  1834. {
  1835. resultTableList.Remove(dt);
  1836. break;
  1837. }
  1838. }
  1839. if (bitDic.ContainsKey(tableName))
  1840. bitDic.Remove(tableName);
  1841. }
  1842. foreach (ListViewItem item in this.listView2.Items)
  1843. {
  1844. if (item.Selected)
  1845. this.listView2.Items.Remove(item);
  1846. }
  1847. RefreshDataGridView2();
  1848. }
  1849. }
  1850. }
  1851. /// <summary>
  1852. /// 生成报告按钮
  1853. /// </summary>
  1854. /// <param name="sender"></param>
  1855. /// <param name="e"></param>
  1856. private void button8_Click(object sender, EventArgs e)
  1857. {
  1858. if (this.checkBox1.Checked)
  1859. this.button1.PerformClick();
  1860. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  1861. {
  1862. //获取word书签与excel单元格的关系,以字典方式存储
  1863. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  1864. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  1865. if (mic_module_infos != null && mic_module_infos.Count > 0)
  1866. {
  1867. foreach (mic_module_infos info in mic_module_infos)
  1868. {
  1869. tagInfos.Add(info.tag_name, info.cell_position);
  1870. }
  1871. }
  1872. //分析结果
  1873. List<List<string>> analysisContent = new List<List<string>>();
  1874. List<string> contentHead = new List<string>();
  1875. contentHead.Add(PdnResources.GetString("Menu.picture.Text"));
  1876. contentHead.Add(PdnResources.GetString("Menu.view.text"));
  1877. contentHead.Add("球状面积");
  1878. contentHead.Add("球状个数");
  1879. contentHead.Add("团状、团絮状面积");
  1880. contentHead.Add("团状、团絮状个数");
  1881. contentHead.Add("蠕虫状面积");
  1882. contentHead.Add("蠕虫状个数");
  1883. contentHead.Add(PdnResources.GetString("Menu.Thetotalarea.text"));
  1884. contentHead.Add("石墨含量");
  1885. contentHead.Add("蠕化率");
  1886. contentHead.Add("蠕化级别");
  1887. analysisContent.Add(contentHead);
  1888. foreach (DataGridViewRow item in this.dataGridView2.Rows)
  1889. {
  1890. List<string> content = new List<string>();
  1891. content.Add(item.Cells[0].Value.ToString());
  1892. content.Add(item.Cells[1].Value.ToString());
  1893. content.Add(item.Cells[2].Value.ToString());
  1894. content.Add(item.Cells[3].Value.ToString());
  1895. content.Add(item.Cells[4].Value.ToString());
  1896. content.Add(item.Cells[5].Value.ToString());
  1897. content.Add(item.Cells[6].Value.ToString());
  1898. content.Add(item.Cells[7].Value.ToString());
  1899. content.Add(item.Cells[8].Value.ToString());
  1900. content.Add(item.Cells[9].Value.ToString());
  1901. content.Add(item.Cells[10].Value.ToString());
  1902. content.Add(item.Cells[11].Value.ToString());
  1903. analysisContent.Add(content);
  1904. }
  1905. //图片
  1906. bitList = new List<Bitmap>();
  1907. if (this.showAll)
  1908. {
  1909. foreach(KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  1910. {
  1911. bitList.Add(kv.Value[0]);
  1912. bitList.Add(kv.Value[1]);
  1913. }
  1914. }
  1915. else
  1916. {
  1917. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  1918. {
  1919. foreach (ListViewItem item in this.listView2.SelectedItems)
  1920. {
  1921. if (bitDic.ContainsKey(item.Name))
  1922. {
  1923. bitList.Add(bitDic[item.Name][0]);
  1924. bitList.Add(bitDic[item.Name][1]);
  1925. }
  1926. }
  1927. }
  1928. }
  1929. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  1930. }
  1931. else
  1932. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  1933. }
  1934. /// <summary>
  1935. /// 导出结果按钮
  1936. /// </summary>
  1937. /// <param name="sender"></param>
  1938. /// <param name="e"></param>
  1939. private void button9_Click(object sender, EventArgs e)
  1940. {
  1941. if (this.dataGridView2.Rows.Count > 0)
  1942. {
  1943. SaveFileDialog exe = new SaveFileDialog();
  1944. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  1945. exe.FilterIndex = 0;
  1946. exe.RestoreDirectory = true;
  1947. exe.Title = "Export Excel File";
  1948. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  1949. exe.FileName = "蠕化级别" + PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddHHmmss");
  1950. DialogResult dr = exe.ShowDialog();
  1951. if (dr == DialogResult.OK)
  1952. {
  1953. DataTable dtb = new DataTable();
  1954. dtb.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
  1955. dtb.Columns.Add(PdnResources.GetString("Menu.view.text"));
  1956. dtb.Columns.Add("球状面积");
  1957. dtb.Columns.Add("球状个数");
  1958. dtb.Columns.Add("团状、团絮状面积");
  1959. dtb.Columns.Add("团状、团絮状个数");
  1960. dtb.Columns.Add("蠕虫状面积");
  1961. dtb.Columns.Add("蠕虫状个数");
  1962. dtb.Columns.Add(PdnResources.GetString("Menu.Thetotalarea.text"));
  1963. dtb.Columns.Add("石墨含量");
  1964. dtb.Columns.Add("蠕化率");
  1965. dtb.Columns.Add("蠕化级别");
  1966. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  1967. {
  1968. DataRow dataRow = dtb.NewRow();
  1969. dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView2.Rows[i].Cells[0].Value;
  1970. dataRow[PdnResources.GetString("Menu.view.text")] = this.dataGridView2.Rows[i].Cells[1].Value;
  1971. dataRow["球状面积"] = this.dataGridView2.Rows[i].Cells[2].Value;
  1972. dataRow["球状个数"] = this.dataGridView2.Rows[i].Cells[3].Value;
  1973. dataRow["团状、团絮状面积"] = this.dataGridView2.Rows[i].Cells[4].Value;
  1974. dataRow["团状、团絮状个数"] = this.dataGridView2.Rows[i].Cells[5].Value;
  1975. dataRow["蠕虫状面积"] = this.dataGridView2.Rows[i].Cells[6].Value;
  1976. dataRow["蠕虫状个数"] = this.dataGridView2.Rows[i].Cells[7].Value;
  1977. dataRow[PdnResources.GetString("Menu.Thetotalarea.text")] = this.dataGridView2.Rows[i].Cells[8].Value;
  1978. dataRow["石墨含量"] = this.dataGridView2.Rows[i].Cells[9].Value;
  1979. dataRow["蠕化率"] = this.dataGridView2.Rows[i].Cells[10].Value;
  1980. dataRow["蠕化级别"] = this.dataGridView2.Rows[i].Cells[11].Value;
  1981. dtb.Rows.Add(dataRow);
  1982. }
  1983. List<DataTable> list = new List<DataTable>();
  1984. list.Add(dtb);
  1985. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
  1986. }
  1987. }
  1988. else
  1989. { MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text") + "!"); }
  1990. }
  1991. /// <summary>
  1992. /// 图像索引切换选中事件
  1993. /// </summary>
  1994. /// <param name="sender"></param>
  1995. /// <param name="e"></param>
  1996. private void listView1_SelectedIndexChanged(object sender, EventArgs e)
  1997. {
  1998. if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
  1999. {
  2000. isChanegd = false;
  2001. this.bitmap = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  2002. //二值化集成4
  2003. binaryClass.listView1_SelectedIndexChangedNoCheckedChanged(this.bitmap);
  2004. this.documentWorkspace.Visible = true;
  2005. this.commonControlButtons.Visible = true;
  2006. //获得图像对应的mat
  2007. ballCircleArea = 0;
  2008. groupCircleArea = 0;
  2009. vermicularCircleArea = 0;
  2010. //清除计算并存储的数据
  2011. ballPoint = null;
  2012. groupPoint = null;
  2013. vermicularPoint = null;
  2014. ballCircleList = null;
  2015. groupCircleList = null;
  2016. vermicularCircleList = null;
  2017. changeColor = false;
  2018. isFirstSwitch = true;
  2019. if (isChanegd == false)
  2020. {
  2021. ResetAreaAndContent();
  2022. }
  2023. }
  2024. }
  2025. /// <summary>
  2026. /// 计算指定索引列的平均值-暂时没用到
  2027. /// </summary>
  2028. /// <param name="ColumnIndex"></param>
  2029. /// <returns></returns>
  2030. private double CalculateAverage(int ColumnIndex)
  2031. {
  2032. double sum = 0;
  2033. double avg = 0;
  2034. if (this.dataGridView1.Rows.Count > 0)
  2035. {
  2036. for (int i = 0; i < this.dataGridView1.Rows.Count - 1; i++)
  2037. {
  2038. try
  2039. {
  2040. double cellValue = double.Parse(this.dataGridView1.Rows[i].Cells[ColumnIndex].Value.ToString());
  2041. sum += cellValue;
  2042. }
  2043. catch (Exception e)
  2044. {
  2045. continue;
  2046. }
  2047. }
  2048. avg = sum / this.dataGridView1.Rows.Count - 1;
  2049. }
  2050. return avg;
  2051. }
  2052. /// <summary>
  2053. /// 分析结果列表选择切换
  2054. /// </summary>
  2055. /// <param name="sender"></param>
  2056. /// <param name="e"></param>
  2057. private void listView2_SelectedIndexChanged(object sender, EventArgs e)
  2058. {
  2059. if (this.showAll)
  2060. return;
  2061. RefreshDataGridView2();
  2062. }
  2063. /// <summary>
  2064. /// 刷新数据展示表
  2065. /// </summary>
  2066. private void RefreshDataGridView1()
  2067. {
  2068. //没处理多市场的索引
  2069. int selectedRowIndex = -1;
  2070. if (this.dataGridView1.Rows.Count > 0)
  2071. selectedRowIndex = this.dataGridView1.SelectedRows[0].Index;
  2072. this.dataGridView1.Rows.Clear();
  2073. if(ballCircleList.Count == 0 && groupCircleList.Count == 0 && vermicularCircleList.Count == 0)
  2074. {
  2075. }
  2076. else
  2077. {
  2078. DataGridViewRow row = new DataGridViewRow();
  2079. row.Height = 37;
  2080. row.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.view.text")+"1", ""));
  2081. //球状面积
  2082. row.Cells.Add(CreateTextBoxCell(Math.Round(ballCircleArea, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  2083. //球状个数
  2084. row.Cells.Add(CreateTextBoxCell(ballCircleList.Count + "", ""));
  2085. //团状、团絮状面积
  2086. row.Cells.Add(CreateTextBoxCell(Math.Round(groupCircleArea, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  2087. //团状、团絮状个数
  2088. row.Cells.Add(CreateTextBoxCell(groupCircleList.Count + "", ""));
  2089. //蠕虫状面积
  2090. row.Cells.Add(CreateTextBoxCell(Math.Round(vermicularCircleArea, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  2091. //蠕虫状个数
  2092. row.Cells.Add(CreateTextBoxCell(vermicularCircleList.Count + "", ""));
  2093. //总面积
  2094. int bitArea = this.bitmap.Width * this.bitmap.Height;
  2095. row.Cells.Add(CreateTextBoxCell(bitArea + "", ""));
  2096. //石墨含量
  2097. row.Cells.Add(CreateTextBoxCell(Math.Round((ballCircleArea + groupCircleArea + vermicularCircleArea) / bitArea * 100, Convert.ToInt32(this.numericUpDown1.Value)) + "%", ""));
  2098. //蠕化率
  2099. double CreepRatio = (vermicularCircleArea + 0.5 * groupCircleArea) / (ballCircleArea + groupCircleArea + vermicularCircleArea);
  2100. row.Cells.Add(CreateTextBoxCell(Math.Round(CreepRatio * 100, Convert.ToInt32(this.numericUpDown1.Value)) + "%", ""));
  2101. //蠕化级别
  2102. if (CreepRatio >= 0.95)
  2103. row.Cells.Add(CreateTextBoxCell("蠕95", ""));
  2104. else if (CreepRatio < 0.95 && CreepRatio >= 0.9)
  2105. row.Cells.Add(CreateTextBoxCell("蠕90", ""));
  2106. else if (CreepRatio < 0.9 && CreepRatio >= 0.85)
  2107. row.Cells.Add(CreateTextBoxCell("蠕85", ""));
  2108. else if (CreepRatio < 0.85 && CreepRatio >= 0.8)
  2109. row.Cells.Add(CreateTextBoxCell("蠕80", ""));
  2110. else if (CreepRatio < 0.8 && CreepRatio >= 0.7)
  2111. row.Cells.Add(CreateTextBoxCell("蠕70", ""));
  2112. else if (CreepRatio < 0.7 && CreepRatio >= 0.6)
  2113. row.Cells.Add(CreateTextBoxCell("蠕60", ""));
  2114. else if (CreepRatio < 0.6 && CreepRatio >= 0.5)
  2115. row.Cells.Add(CreateTextBoxCell("蠕50", ""));
  2116. else if (CreepRatio < 0.5 && CreepRatio >= 0.4)
  2117. row.Cells.Add(CreateTextBoxCell("蠕40", ""));
  2118. else
  2119. row.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.Theunknown.Text"), ""));
  2120. this.dataGridView1.Rows.Add(row);
  2121. //平均列写死
  2122. DataGridViewRow rowAvg = new DataGridViewRow();
  2123. rowAvg.Height = 36;
  2124. rowAvg.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.Image.Average.Text"), ""));
  2125. rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[1].Value.ToString(), ""));
  2126. rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[2].Value.ToString(), ""));
  2127. rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[3].Value.ToString(), ""));
  2128. rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[4].Value.ToString(), ""));
  2129. rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[5].Value.ToString(), ""));
  2130. rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[6].Value.ToString(), ""));
  2131. rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[7].Value.ToString(), ""));
  2132. rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[8].Value.ToString(), ""));
  2133. rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[9].Value.ToString(), ""));
  2134. rowAvg.Cells.Add(CreateTextBoxCell(this.dataGridView1.Rows[0].Cells[10].Value.ToString(), ""));
  2135. this.dataGridView1.Rows.Add(rowAvg);
  2136. this.dataGridView1.ClearSelection();
  2137. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 2].Selected = true;//目前固定一个图只有一个视场,没做特殊处理
  2138. }
  2139. }
  2140. private void colorsForm1Changed(object sender, EventArgs e)
  2141. {
  2142. binaryClass.SetBinaryBackColor(this.colorsForm1.UserPrimaryColor.ToColor());
  2143. this.colorsForm1.Close();
  2144. changeColor = true;
  2145. ReLoadBinarization();
  2146. this.documentWorkspace.Refresh();
  2147. }
  2148. /// <summary>
  2149. /// 小数数字框值改变
  2150. /// </summary>
  2151. /// <param name="sender"></param>
  2152. /// <param name="e"></param>
  2153. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  2154. {
  2155. if (this.numericUpDown1.Value > this.numericUpDown1.Maximum)
  2156. this.numericUpDown1.Value = this.numericUpDown1.Maximum;
  2157. if (this.numericUpDown1.Value < this.numericUpDown1.Minimum)
  2158. this.numericUpDown1.Value = this.numericUpDown1.Minimum;
  2159. RefreshDataGridView1();
  2160. RefreshDataGridView2();
  2161. if (this.checkBox4.Checked)
  2162. this.documentWorkspace.Refresh();
  2163. }
  2164. /// <summary>
  2165. /// 是否筛选
  2166. /// </summary>
  2167. /// <param name="sender"></param>
  2168. /// <param name="e"></param>
  2169. private void checkBox3_CheckedChanged(object sender, EventArgs e)
  2170. {
  2171. if (this.documentWorkspace.CompositionSurface == null)
  2172. return;
  2173. if (bcBinaryChecked() && this.checkBox3.Checked)
  2174. {
  2175. ReloadDebrisSelection();
  2176. changeColor = false;
  2177. if (!bcOriginChecked())
  2178. {
  2179. if (bcBinaryChecked())
  2180. {
  2181. this.documentWorkspace.PhaseModels[0].choise = false;
  2182. this.documentWorkspace.PhaseModels[1].choise = true;
  2183. }
  2184. }
  2185. }
  2186. else if (bcBinaryChecked() && !this.checkBox3.Checked)
  2187. {
  2188. changeColor = false;
  2189. ReLoadBinarization();
  2190. if (!bcOriginChecked())
  2191. {
  2192. if (bcBinaryChecked())
  2193. {
  2194. this.documentWorkspace.PhaseModels[0].choise = false;
  2195. this.documentWorkspace.PhaseModels[1].choise = true;
  2196. }
  2197. }
  2198. }
  2199. this.documentWorkspace.Refresh();
  2200. }
  2201. /// <summary>
  2202. /// 二值处理
  2203. /// </summary>
  2204. /// <param name="colorOneStart"></param>
  2205. /// <param name="colorOneEnd"></param>
  2206. /// <param name="phaseColor"></param>
  2207. /// <returns></returns>
  2208. private unsafe Mat Binarization(int colorOneStart, int colorOneEnd, Color phaseColor)
  2209. {
  2210. Mat srcGray;
  2211. if (mat.Type() == MatType.CV_8UC1)
  2212. srcGray = mat;
  2213. else
  2214. srcGray = mat.CvtColor(ColorConversionCodes.BGR2GRAY);
  2215. Mat src = new Mat(mat.Rows, mat.Cols, MatType.CV_8UC4, new Scalar(0, 0, 0, 0));
  2216. int index0 = 0;
  2217. byte* ptr0 = (byte*)mat.Data;
  2218. int index1 = 0;
  2219. byte* ptr1 = (byte*)srcGray.Data;
  2220. int index2 = 0;
  2221. byte* ptr2 = (byte*)src.Data;
  2222. for (int o = 0; o < srcGray.Height; o++)
  2223. {
  2224. for (int p = 0; p < srcGray.Width; p++)
  2225. {
  2226. index0 = (int)((mat.Step() * o) + (p * 4));
  2227. index1 = (int)((srcGray.Step() * o) + (p * 1));
  2228. index2 = (int)((src.Step() * o) + (p * 4));
  2229. if (ptr1[index1] >= colorOneStart && ptr1[index1] <= colorOneEnd)
  2230. {
  2231. if (isHadView)
  2232. {
  2233. if (ptr0[index0 + 3] != 0)
  2234. {
  2235. ptr2[index2] = phaseColor.B;
  2236. ptr2[index2 + 1] = phaseColor.G;
  2237. ptr2[index2 + 2] = phaseColor.R;
  2238. ptr2[index2 + 3] = 255;
  2239. }
  2240. }
  2241. else
  2242. {
  2243. ptr2[index2] = phaseColor.B;
  2244. ptr2[index2 + 1] = phaseColor.G;
  2245. ptr2[index2 + 2] = phaseColor.R;
  2246. ptr2[index2 + 3] = 255;
  2247. }
  2248. }
  2249. }
  2250. }
  2251. return src;
  2252. }
  2253. /// <summary>
  2254. /// 刷新二值效果
  2255. /// </summary>
  2256. private void ReLoadBinarization()
  2257. {
  2258. if (this.documentWorkspace.CompositionSurface == null)
  2259. return;
  2260. if (bcBinaryChecked())
  2261. {
  2262. ResetAreaAndContent();
  2263. if (this.checkBox3.Checked)
  2264. ReloadDebrisSelection();
  2265. }
  2266. else
  2267. {
  2268. this.documentWorkspace.PhaseModels[0].mat = null;
  2269. this.documentWorkspace.PhaseModels[0].choise = false;
  2270. //清除计算并存储的数据
  2271. ballPoint = null;
  2272. groupPoint = null;
  2273. vermicularPoint = null;
  2274. ballCircleList = null;
  2275. groupCircleList = null;
  2276. vermicularCircleList = null;
  2277. tempArea = null;
  2278. maxCaliperDiameter = null;
  2279. circleCoefficientList = null;
  2280. isFirstSwitch = false;
  2281. this.dataGridView1.Rows.Clear();
  2282. }
  2283. this.documentWorkspace.Refresh();
  2284. }
  2285. /// <summary>
  2286. /// 刷新颗粒筛选效果
  2287. /// </summary>
  2288. private void ReloadDebrisSelection()
  2289. {
  2290. if (this.documentWorkspace.PhaseModels[0].mat != null)
  2291. {
  2292. OpenCvSharp.Point[][] contours;//原始轮廓信息
  2293. HierarchyIndex[] hierachy;
  2294. List<List<OpenCvSharp.Point>> ps = new List<List<OpenCvSharp.Point>>();//轮廓的拓扑信息
  2295. Mat temp = new Mat();//中间变量
  2296. this.documentWorkspace.PhaseModels[0].mat.CopyTo(temp);
  2297. Cv2.FindContours(BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone);
  2298. ballPoint = new List<List<OpenCvSharp.Point>>();
  2299. groupPoint = new List<List<OpenCvSharp.Point>>();
  2300. vermicularPoint = new List<List<OpenCvSharp.Point>>();
  2301. ballCircleList = new List<double>();
  2302. groupCircleList = new List<double>();
  2303. vermicularCircleList = new List<double>();
  2304. ballCircleArea = 0;
  2305. groupCircleArea = 0;
  2306. vermicularCircleArea = 0;
  2307. tempArea = new List<string>();
  2308. maxCaliperDiameter = new List<string>();
  2309. circleCoefficientList = new List<string>();
  2310. for (int i = 0; i < hierachy.Length; i++)
  2311. {
  2312. if(hierachy[i].Parent == -1)
  2313. {
  2314. double area = Math.Abs(Cv2.ContourArea(contours[i]));
  2315. if (area >= (this.trackBar2.Value / unitLength) && area <= (this.trackBar4.Value / unitLength))
  2316. {
  2317. ps.Add(contours[i].ToList());
  2318. }
  2319. else
  2320. {
  2321. if (contours[i].Length < 5)
  2322. continue;
  2323. else
  2324. {
  2325. double radius = BasicCalculationHelper.CalcLongTrail(contours[i]);//半径
  2326. if ((decimal)(radius * 2 * unitLength) >= this.numericUpDown6.Value)
  2327. {
  2328. double circleCoefficient = (4 * area) / (Math.PI * (radius * 2) * (radius * 2));
  2329. tempArea.Add((area * unitLength).ToString());
  2330. maxCaliperDiameter.Add((radius * 2 * unitLength).ToString());
  2331. circleCoefficientList.Add(circleCoefficient.ToString());
  2332. if (circleCoefficient > CircularityCoefficient[1])
  2333. {
  2334. ballPoint.Add(contours[i].ToList());
  2335. ballCircleList.Add(circleCoefficient);
  2336. ballCircleArea += area;
  2337. }
  2338. else if (circleCoefficient >= CircularityCoefficient[0] && circleCoefficient <= CircularityCoefficient[1])
  2339. {
  2340. groupPoint.Add(contours[i].ToList());
  2341. groupCircleList.Add(circleCoefficient);
  2342. groupCircleArea += area;
  2343. }
  2344. else if (circleCoefficient < CircularityCoefficient[0])
  2345. {
  2346. vermicularPoint.Add(contours[i].ToList());
  2347. vermicularCircleList.Add(circleCoefficient);
  2348. vermicularCircleArea += area;
  2349. }
  2350. }
  2351. }
  2352. }
  2353. }
  2354. }
  2355. Cv2.FillPoly(temp, ps, new Scalar(0, 0, 0, 0));
  2356. if (this.checkBox5.Checked)
  2357. {
  2358. Cv2.FillPoly(temp, ballPoint, new Scalar(this.BallColor.B, this.BallColor.G, this.BallColor.R, 255));
  2359. Cv2.FillPoly(temp, groupPoint, new Scalar(this.GroupColor.B, this.GroupColor.G, this.GroupColor.R, 255));
  2360. Cv2.FillPoly(temp, vermicularPoint, new Scalar(this.VermicularColor.B, this.VermicularColor.G, this.VermicularColor.R, 255));
  2361. }
  2362. this.documentWorkspace.PhaseModels[1].mat = temp;
  2363. RefreshDataGridView1();
  2364. this.documentWorkspace.Refresh();
  2365. }
  2366. }
  2367. /// <summary>
  2368. /// 刷新其他信息
  2369. /// </summary>
  2370. private void ResetAreaAndContent()
  2371. {
  2372. if(this.documentWorkspace.PhaseModels[0].mat != null && bcBinaryChecked())
  2373. {
  2374. OpenCvSharp.Point[][] contours;//原始轮廓信息
  2375. HierarchyIndex[] hierachy;
  2376. Mat temp = new Mat();
  2377. this.documentWorkspace.PhaseModels[0].mat.CopyTo(temp);
  2378. Cv2.FindContours(BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone);
  2379. if (hierachy.Length > 0)
  2380. {
  2381. double maxArea = 0;//面积最大值
  2382. double minArea = 9999999999;//面积最小值
  2383. ballPoint = new List<List<OpenCvSharp.Point>>();
  2384. groupPoint = new List<List<OpenCvSharp.Point>>();
  2385. vermicularPoint = new List<List<OpenCvSharp.Point>>();
  2386. ballCircleList = new List<double>();
  2387. groupCircleList = new List<double>();
  2388. vermicularCircleList = new List<double>();
  2389. ballCircleArea = 0;
  2390. groupCircleArea = 0;
  2391. vermicularCircleArea = 0;
  2392. tempArea = new List<string>();
  2393. maxCaliperDiameter = new List<string>();
  2394. circleCoefficientList = new List<string>();
  2395. for (int i = 0; i < hierachy.Length; i++)
  2396. {
  2397. double area = Math.Abs(Cv2.ContourArea(contours[i]));
  2398. if (maxArea < area)
  2399. maxArea = area;
  2400. if (minArea > area)
  2401. minArea = area;
  2402. if (contours[i].Length < 5)
  2403. continue;
  2404. else
  2405. {
  2406. double radius = BasicCalculationHelper.CalcLongTrail(contours[i]);//半径
  2407. if ((decimal)(radius * 2 * unitLength) >= this.numericUpDown6.Value)
  2408. {
  2409. double circleCoefficient = (4 * area) / (Math.PI * (radius * 2) * (radius * 2));//原型系数
  2410. tempArea.Add((area * unitLength).ToString());
  2411. maxCaliperDiameter.Add((radius * 2 * unitLength).ToString());
  2412. circleCoefficientList.Add(circleCoefficient.ToString());
  2413. if(circleCoefficient > CircularityCoefficient[1])
  2414. {
  2415. ballPoint.Add(contours[i].ToList());
  2416. ballCircleList.Add(circleCoefficient);
  2417. ballCircleArea += area;
  2418. }
  2419. else if(circleCoefficient >= CircularityCoefficient[0] && circleCoefficient <= CircularityCoefficient[1])
  2420. {
  2421. groupPoint.Add(contours[i].ToList());
  2422. groupCircleList.Add(circleCoefficient);
  2423. groupCircleArea += area;
  2424. }
  2425. else if (circleCoefficient < CircularityCoefficient[0])
  2426. {
  2427. vermicularPoint.Add(contours[i].ToList());
  2428. vermicularCircleList.Add(circleCoefficient);
  2429. vermicularCircleArea += area;
  2430. }
  2431. }
  2432. }
  2433. }
  2434. //显示不同级别石墨颜色
  2435. if (this.checkBox5.Checked)
  2436. {
  2437. Cv2.FillPoly(temp, ballPoint, new Scalar(this.BallColor.B, this.BallColor.G, this.BallColor.R, 255));
  2438. Cv2.FillPoly(temp, groupPoint, new Scalar(this.GroupColor.B, this.GroupColor.G, this.GroupColor.R, 255));
  2439. Cv2.FillPoly(temp, vermicularPoint, new Scalar(this.VermicularColor.B, this.VermicularColor.G, this.VermicularColor.R, 255));
  2440. }
  2441. this.documentWorkspace.PhaseModels[1].mat = temp;
  2442. if (!changeColor)
  2443. {
  2444. maxArea = maxArea * unitLength;
  2445. minArea = minArea * unitLength;
  2446. int maxNum = (int)Math.Ceiling(maxArea);//获取面积最大值
  2447. int minNum = (int)Math.Floor(minArea);//获取面积最小值
  2448. //先解绑事件以防数据赋值异常
  2449. this.numericUpDown4.ValueChanged -= numericUpDown4_ValueChanged;
  2450. this.numericUpDown5.ValueChanged -= numericUpDown5_ValueChanged;
  2451. this.trackBar2.Scroll -= trackBar2_Scroll;
  2452. this.trackBar4.Scroll -= trackBar4_Scroll;
  2453. this.numericUpDown4.Maximum = maxNum;
  2454. this.numericUpDown4.Minimum = minNum;
  2455. this.trackBar2.Maximum = maxNum;
  2456. this.trackBar2.Minimum = minNum;
  2457. this.numericUpDown5.Maximum = maxNum;
  2458. this.numericUpDown5.Minimum = minNum;
  2459. this.trackBar4.Maximum = maxNum;
  2460. this.trackBar4.Minimum = minNum;
  2461. this.numericUpDown4.Value = minNum;
  2462. this.trackBar2.Value = minNum;
  2463. this.numericUpDown5.Value = maxNum;
  2464. this.trackBar4.Value = maxNum;
  2465. this.numericUpDown4.ValueChanged += new EventHandler(numericUpDown4_ValueChanged);
  2466. this.numericUpDown5.ValueChanged += new EventHandler(numericUpDown5_ValueChanged);
  2467. this.trackBar2.Scroll += new EventHandler(trackBar2_Scroll);
  2468. this.trackBar4.Scroll += new EventHandler(trackBar4_Scroll);
  2469. RefreshDataGridView1();
  2470. }
  2471. }
  2472. }
  2473. }
  2474. /// <summary>
  2475. /// 颗粒筛选范围最小值
  2476. /// </summary>
  2477. /// <param name="sender"></param>
  2478. /// <param name="e"></param>
  2479. private void numericUpDown4_ValueChanged(object sender, EventArgs e)
  2480. {
  2481. if (this.numericUpDown4.Value > this.numericUpDown5.Value)
  2482. this.numericUpDown4.Value = this.numericUpDown5.Value;
  2483. this.trackBar2.Value = Convert.ToInt32(this.numericUpDown4.Value);
  2484. if(this.checkBox3.Checked && bcBinaryChecked())
  2485. ReloadDebrisSelection();
  2486. }
  2487. /// <summary>
  2488. /// 颗粒筛选范围最大值
  2489. /// </summary>
  2490. /// <param name="sender"></param>
  2491. /// <param name="e"></param>
  2492. private void numericUpDown5_ValueChanged(object sender, EventArgs e)
  2493. {
  2494. if (this.numericUpDown5.Value < this.numericUpDown4.Value)
  2495. this.numericUpDown5.Value = this.numericUpDown4.Value;
  2496. this.trackBar4.Value = Convert.ToInt32(this.numericUpDown5.Value);
  2497. //zhuhsi
  2498. // if(this.checkBox3.Checked && bcBinaryChecked())
  2499. // ReloadDebrisSelection();
  2500. }
  2501. /// <summary>
  2502. /// 颗粒筛选最小值滚动条
  2503. /// </summary>
  2504. /// <param name="sender"></param>
  2505. /// <param name="e"></param>
  2506. private void trackBar2_Scroll(object sender, EventArgs e)
  2507. {
  2508. this.numericUpDown4.Value = this.trackBar2.Value;
  2509. }
  2510. /// <summary>
  2511. /// 颗粒筛选最大值滚动条
  2512. /// </summary>
  2513. /// <param name="sender"></param>
  2514. /// <param name="e"></param>
  2515. private void trackBar4_Scroll(object sender, EventArgs e)
  2516. {
  2517. this.numericUpDown5.Value = this.trackBar4.Value;
  2518. }
  2519. /// <summary>
  2520. /// 是否二值化
  2521. /// </summary>
  2522. /// <param name="sender"></param>
  2523. /// <param name="e"></param>
  2524. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  2525. {
  2526. if (this.documentWorkspace.CompositionSurface == null)
  2527. return;
  2528. if (!bcBinaryChecked())
  2529. this.checkBox3.Checked = false;
  2530. changeColor = false;
  2531. ReLoadBinarization();
  2532. }
  2533. /// <summary>
  2534. /// 显示参数设置按钮
  2535. /// </summary>
  2536. /// <param name="sender"></param>
  2537. /// <param name="e"></param>
  2538. private void button3_Click(object sender, EventArgs e)
  2539. {
  2540. using (VermiculateCastIronSetFontDialog vermiculateCastIronSetFontDialog = new VermiculateCastIronSetFontDialog(this))
  2541. {
  2542. vermiculateCastIronSetFontDialog.StartPosition = FormStartPosition.CenterScreen;
  2543. vermiculateCastIronSetFontDialog.ShowDialog();
  2544. }
  2545. }
  2546. /// <summary>
  2547. /// 颜色设置按钮
  2548. /// </summary>
  2549. /// <param name="sender"></param>
  2550. /// <param name="e"></param>
  2551. private void button4_Click(object sender, EventArgs e)
  2552. {
  2553. using (VermiculateCastIronSetColorDialog vermiculateCastIronSetColorDialog = new VermiculateCastIronSetColorDialog(this))
  2554. {
  2555. vermiculateCastIronSetColorDialog.StartPosition = FormStartPosition.CenterScreen;
  2556. vermiculateCastIronSetColorDialog.ShowDialog();
  2557. }
  2558. }
  2559. /// <summary>
  2560. /// 设置页修改颜色
  2561. /// </summary>
  2562. /// <param name="BallColor"></param>
  2563. /// <param name="GroupColor"></param>
  2564. /// <param name="VermicularColor"></param>
  2565. public void SetVermiculateCastIronColor(Color BallColor, Color GroupColor, Color VermicularColor)
  2566. {
  2567. this.BallColor = BallColor;
  2568. this.GroupColor = GroupColor;
  2569. this.VermicularColor = VermicularColor;
  2570. if (this.documentWorkspace.CompositionSurface == null)
  2571. return;
  2572. if (bcBinaryChecked() && this.checkBox3.Checked)
  2573. ReloadDebrisSelection();
  2574. else if (bcBinaryChecked() && !this.checkBox3.Checked)
  2575. {
  2576. changeColor = false;
  2577. ReLoadBinarization();
  2578. }
  2579. }
  2580. /// <summary>
  2581. /// 设置页修改字体
  2582. /// </summary>
  2583. /// <param name="BallColor"></param>
  2584. /// <param name="GroupColor"></param>
  2585. /// <param name="VermicularColor"></param>
  2586. public void SetVermiculateCastIronFont(string fontStyle, float fontSize, Color fontColor)
  2587. {
  2588. this.fontStyle = fontStyle;
  2589. this.fontSize = fontSize;
  2590. this.fontColor = fontColor;
  2591. if (this.documentWorkspace.CompositionSurface == null)
  2592. return;
  2593. if (bcBinaryChecked() && this.checkBox3.Checked)
  2594. ReloadDebrisSelection();
  2595. else if (bcBinaryChecked() && !this.checkBox3.Checked)
  2596. {
  2597. changeColor = false;
  2598. ReLoadBinarization();
  2599. }
  2600. }
  2601. /// <summary>
  2602. /// 选中显示不同级别石墨颜色
  2603. /// </summary>
  2604. /// <param name="sender"></param>
  2605. /// <param name="e"></param>
  2606. private void checkBox5_CheckedChanged(object sender, EventArgs e)
  2607. {
  2608. if (this.documentWorkspace.CompositionSurface == null)
  2609. return;
  2610. if (bcBinaryChecked() && this.checkBox3.Checked)
  2611. ReloadDebrisSelection();
  2612. else if (bcBinaryChecked() && !this.checkBox3.Checked)
  2613. {
  2614. changeColor = false;
  2615. ReLoadBinarization();
  2616. }
  2617. }
  2618. /// <summary>
  2619. /// 修改限制长度
  2620. /// </summary>
  2621. /// <param name="sender"></param>
  2622. /// <param name="e"></param>
  2623. private void numericUpDown6_ValueChanged(object sender, EventArgs e)
  2624. {
  2625. if (this.documentWorkspace.CompositionSurface == null)
  2626. return;
  2627. if (bcBinaryChecked() && this.checkBox3.Checked)
  2628. ReloadDebrisSelection();
  2629. else if (bcBinaryChecked() && !this.checkBox3.Checked)
  2630. {
  2631. changeColor = false;
  2632. ReLoadBinarization();
  2633. }
  2634. }
  2635. /// <summary>
  2636. /// 是否显示圆形系数
  2637. /// </summary>
  2638. /// <param name="sender"></param>
  2639. /// <param name="e"></param>
  2640. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  2641. {
  2642. this.documentWorkspace.Refresh();
  2643. }
  2644. /// <summary>
  2645. /// 导出项目按钮
  2646. /// </summary>
  2647. /// <param name="sender"></param>
  2648. /// <param name="e"></param>
  2649. private void button5_Click(object sender, EventArgs e)
  2650. {
  2651. try
  2652. {
  2653. if (this.analyzeSettingModel == null)
  2654. {
  2655. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");
  2656. return;
  2657. }
  2658. //获取项目工程内的文件夹路径
  2659. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.VermiculateCastIron.Text", this.analyzeSettingModel.savePath);
  2660. if (item != null)
  2661. {
  2662. //向文件夹内保存图片和报告
  2663. if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  2664. {
  2665. //获取word书签与excel单元格的关系,以字典方式存储
  2666. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  2667. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  2668. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2669. {
  2670. foreach (mic_module_infos info in mic_module_infos)
  2671. {
  2672. tagInfos.Add(info.tag_name, info.cell_position);
  2673. }
  2674. }
  2675. //分析结果
  2676. List<List<string>> analysisContent = new List<List<string>>();
  2677. List<string> contentHead = new List<string>();
  2678. contentHead.Add(PdnResources.GetString("Menu.picture.Text"));
  2679. contentHead.Add(PdnResources.GetString("Menu.view.text"));
  2680. contentHead.Add("球状面积");
  2681. contentHead.Add("球状个数");
  2682. contentHead.Add("团状、团絮状面积");
  2683. contentHead.Add("团状、团絮状个数");
  2684. contentHead.Add("蠕虫状面积");
  2685. contentHead.Add("蠕虫状个数");
  2686. contentHead.Add(PdnResources.GetString("Menu.Thetotalarea.text"));
  2687. contentHead.Add("石墨含量");
  2688. contentHead.Add("蠕化率");
  2689. contentHead.Add("蠕化级别");
  2690. analysisContent.Add(contentHead);
  2691. foreach (DataGridViewRow rowItem in this.dataGridView2.Rows)
  2692. {
  2693. List<string> content = new List<string>();
  2694. content.Add(rowItem.Cells[0].Value.ToString());
  2695. content.Add(rowItem.Cells[1].Value.ToString());
  2696. content.Add(rowItem.Cells[2].Value.ToString());
  2697. content.Add(rowItem.Cells[3].Value.ToString());
  2698. content.Add(rowItem.Cells[4].Value.ToString());
  2699. content.Add(rowItem.Cells[5].Value.ToString());
  2700. content.Add(rowItem.Cells[6].Value.ToString());
  2701. content.Add(rowItem.Cells[7].Value.ToString());
  2702. content.Add(rowItem.Cells[8].Value.ToString());
  2703. content.Add(rowItem.Cells[9].Value.ToString());
  2704. content.Add(rowItem.Cells[10].Value.ToString());
  2705. content.Add(rowItem.Cells[11].Value.ToString());
  2706. analysisContent.Add(content);
  2707. }
  2708. //图片
  2709. bitList = new List<Bitmap>();
  2710. if (this.showAll)
  2711. {
  2712. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  2713. {
  2714. bitList.Add(kv.Value[0]);
  2715. bitList.Add(kv.Value[1]);
  2716. }
  2717. }
  2718. else
  2719. {
  2720. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  2721. {
  2722. foreach (ListViewItem rowItem in this.listView2.SelectedItems)
  2723. {
  2724. if (bitDic.ContainsKey(rowItem.Name))
  2725. {
  2726. bitList.Add(bitDic[rowItem.Name][0]);
  2727. bitList.Add(bitDic[rowItem.Name][1]);
  2728. }
  2729. }
  2730. }
  2731. }
  2732. //中间数据
  2733. if (!this.showAll)
  2734. {
  2735. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  2736. {
  2737. List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
  2738. foreach (ListViewItem rowItem in this.listView2.SelectedItems)
  2739. {
  2740. foreach (ExportProjectModel model in this.tempDataModel)
  2741. {
  2742. if (model.tagName.Equals(rowItem.Name))
  2743. {
  2744. ExportProjectModel tempModel = new ExportProjectModel();
  2745. tempModel.tagName = model.tagName;
  2746. tempModel.picName = model.picName;
  2747. tempModel.dataList = model.dataList;
  2748. exportModel.Add(tempModel);
  2749. break;
  2750. }
  2751. }
  2752. }
  2753. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);
  2754. }
  2755. }
  2756. else
  2757. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, item.path, item.code);
  2758. }
  2759. else
  2760. {
  2761. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  2762. return;
  2763. }
  2764. //保存项目信息到数据库
  2765. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  2766. }
  2767. }
  2768. catch (Exception)
  2769. {
  2770. }
  2771. }
  2772. }
  2773. }