OrganizationLevelDialog.cs 219 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416
  1. using OpenCvSharp;
  2. using OpenCvSharp.Extensions;
  3. using PaintDotNet.Annotation;
  4. using PaintDotNet.Annotation.Enum;
  5. using PaintDotNet.Base.Functionodel;
  6. using PaintDotNet.CustomControl;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Data;
  11. using System.Drawing;
  12. using System.Drawing.Drawing2D;
  13. using System.Linq;
  14. using System.Text;
  15. using System.Threading.Tasks;
  16. using System.Windows.Forms;
  17. using PaintDotNet.DbOpreate.DbBll;
  18. using PaintDotNet.DbOpreate.DbModel;
  19. using PaintDotNet.Base.CommTool;
  20. using System.IO;
  21. using PaintDotNet.Base.SettingModel;
  22. using PaintDotNet.Data.Param;
  23. using PaintDotNet.Base;
  24. using PaintDotNet.GeneralAnalysis;
  25. using PaintDotNet.DedicatedAnalysis.DuctileIron.Common;
  26. using PaintDotNet;
  27. using Metis.ParameterSet;
  28. namespace Metis.DedicatedAnalysis.DeterminationOfNitridingDepth.GBT11354_2005.OrganizationLevel
  29. {
  30. internal class OrganizationLevelDialog : PdnBaseForm
  31. {
  32. #region
  33. /// <summary>
  34. /// Required designer variable.
  35. /// </summary>
  36. private System.ComponentModel.IContainer components = null;
  37. /// <summary>
  38. /// Clean up any resources being used.
  39. /// </summary>
  40. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  41. protected override void Dispose(bool disposing)
  42. {
  43. if (disposing && (components != null))
  44. {
  45. components.Dispose();
  46. }
  47. base.Dispose(disposing);
  48. }
  49. #region Windows Form Designer generated code
  50. private void InitializeLanguageText()
  51. {
  52. this.bc = new PaintDotNet.CustomControl.BinaryControl();
  53. //
  54. // bc
  55. //
  56. this.bc.BinaryBackColor = System.Drawing.Color.Red;
  57. this.bc.BinaryChecked = false;
  58. this.bc.BinaryStyle = 1;
  59. this.bc.Location = new System.Drawing.Point(151, 56);
  60. this.bc.Name = "bc";
  61. this.bc.OriginChecked = false;
  62. this.bc.scope1End = 0D;
  63. this.bc.scope1Start = 0D;
  64. this.bc.scope2End = 0D;
  65. this.bc.scope2Start = 0D;
  66. this.bc.scope3End = 0D;
  67. this.bc.scope3Start = 0D;
  68. this.bc.Size = new System.Drawing.Size(360, 292);
  69. this.bc.TabIndex = 36;
  70. this.Controls.Add(this.bc);
  71. this.Controls.SetChildIndex(this.bc, 0);
  72. this.Text = "GBT11354-2005(" + PdnResources.GetString("Menu.Theleveloftheoriginalorganization.text") + ")";
  73. this.checkBox3.Text = PdnResources.GetString("Menu.filter.text");
  74. this.checkBox2.Text = PdnResources.GetString("Menu.filter.text");
  75. this.label3.Text = PdnResources.GetString("Menu.range.text") + ":";
  76. this.groupBox5.Text = PdnResources.GetString("Menu.Particlescreening.text");
  77. this.btnSetUp.Text = PdnResources.GetString("Menu.Setting.Text");
  78. this.checkBox1.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  79. this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
  80. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  81. this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  82. this.groupBox3.Text = PdnResources.GetString("Menu.Preview.text");
  83. this.checkBox4.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Showdifofcolor.text");
  84. this.checkBox5.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Displayarearate.text");
  85. this.btnColour.Text = PdnResources.GetString("Menu.Colorsetting.text");
  86. this.btnDisplay.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
  87. this.checkBox6.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Particleshecalculation.text");
  88. this.groupBox6.Text = PdnResources.GetString("Menu.paramssettings.text");
  89. this.groupBox8.Text = PdnResources.GetString("Menu.Theesultshow.text");
  90. this.button6.Text = PdnResources.GetString("Menu.Showall.text");
  91. this.button7.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  92. this.button8.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  93. this.button9.Text = PdnResources.GetString("Menu.Exportresults.text");
  94. this.label8.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
  95. this.button1.Text = PdnResources.GetString("Menu.Exportproject.text");
  96. this.groupBox9.Text = PdnResources.GetString("Menu.Analysisresult.text");
  97. this.label4.Text = PdnResources.GetString("Menu.minimum.text");
  98. this.label5.Text = PdnResources.GetString("Menu.max.text");
  99. this.groupBox7.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Graphitearearaterange.text") + "(%)";
  100. }
  101. /// <summary>
  102. /// Required method for Designer support - do not modify
  103. /// the contents of this method with the code editor.
  104. /// </summary>
  105. private void InitializeComponent()
  106. {
  107. this.components = new System.ComponentModel.Container();
  108. this.groupBox7 = new System.Windows.Forms.GroupBox();
  109. this.checkBox2 = new System.Windows.Forms.CheckBox();
  110. this.trackBar6 = new System.Windows.Forms.TrackBar();
  111. this.trackBar5 = new System.Windows.Forms.TrackBar();
  112. this.numericUpDown7 = new System.Windows.Forms.NumericUpDown();
  113. this.numericUpDown6 = new System.Windows.Forms.NumericUpDown();
  114. this.label5 = new System.Windows.Forms.Label();
  115. this.label4 = new System.Windows.Forms.Label();
  116. this.groupBox9 = new System.Windows.Forms.GroupBox();
  117. this.dataGridView3 = new System.Windows.Forms.DataGridView();
  118. this.button1 = new System.Windows.Forms.Button();
  119. this.label10 = new System.Windows.Forms.Label();
  120. this.label9 = new System.Windows.Forms.Label();
  121. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  122. this.label8 = new System.Windows.Forms.Label();
  123. this.button9 = new System.Windows.Forms.Button();
  124. this.button8 = new System.Windows.Forms.Button();
  125. this.dataGridView2 = new System.Windows.Forms.DataGridView();
  126. this.listView2 = new System.Windows.Forms.ListView();
  127. this.button7 = new System.Windows.Forms.Button();
  128. this.button6 = new System.Windows.Forms.Button();
  129. this.groupBox8 = new System.Windows.Forms.GroupBox();
  130. this.dataGridView1 = new System.Windows.Forms.DataGridView();
  131. this.groupBox6 = new System.Windows.Forms.GroupBox();
  132. this.checkBox6 = new System.Windows.Forms.CheckBox();
  133. this.btnDisplay = new System.Windows.Forms.Button();
  134. this.btnColour = new System.Windows.Forms.Button();
  135. this.checkBox5 = new System.Windows.Forms.CheckBox();
  136. this.checkBox4 = new System.Windows.Forms.CheckBox();
  137. this.groupBox3 = new System.Windows.Forms.GroupBox();
  138. this.groupBox2 = new System.Windows.Forms.GroupBox();
  139. this.listView1 = new System.Windows.Forms.ListView();
  140. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  141. this.groupBox1 = new System.Windows.Forms.GroupBox();
  142. this.button2 = new System.Windows.Forms.Button();
  143. this.checkBox1 = new System.Windows.Forms.CheckBox();
  144. this.btnSetUp = new System.Windows.Forms.Button();
  145. this.groupBox5 = new System.Windows.Forms.GroupBox();
  146. this.trackBar4 = new System.Windows.Forms.TrackBar();
  147. this.trackBar2 = new System.Windows.Forms.TrackBar();
  148. this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
  149. this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
  150. this.label3 = new System.Windows.Forms.Label();
  151. this.checkBox3 = new System.Windows.Forms.CheckBox();
  152. this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
  153. this.groupBox7.SuspendLayout();
  154. ((System.ComponentModel.ISupportInitialize)(this.trackBar6)).BeginInit();
  155. ((System.ComponentModel.ISupportInitialize)(this.trackBar5)).BeginInit();
  156. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).BeginInit();
  157. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).BeginInit();
  158. this.groupBox9.SuspendLayout();
  159. ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit();
  160. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  161. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
  162. this.groupBox8.SuspendLayout();
  163. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
  164. this.groupBox6.SuspendLayout();
  165. this.groupBox2.SuspendLayout();
  166. this.groupBox1.SuspendLayout();
  167. this.groupBox5.SuspendLayout();
  168. ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).BeginInit();
  169. ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();
  170. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
  171. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
  172. this.SuspendLayout();
  173. //
  174. // groupBox7
  175. //
  176. this.groupBox7.Controls.Add(this.checkBox2);
  177. this.groupBox7.Controls.Add(this.trackBar6);
  178. this.groupBox7.Controls.Add(this.trackBar5);
  179. this.groupBox7.Controls.Add(this.numericUpDown7);
  180. this.groupBox7.Controls.Add(this.numericUpDown6);
  181. this.groupBox7.Controls.Add(this.label5);
  182. this.groupBox7.Controls.Add(this.label4);
  183. this.groupBox7.Location = new System.Drawing.Point(154, 504);
  184. this.groupBox7.Name = "groupBox7";
  185. this.groupBox7.Size = new System.Drawing.Size(357, 72);
  186. this.groupBox7.TabIndex = 35;
  187. this.groupBox7.TabStop = false;
  188. //
  189. // checkBox2
  190. //
  191. this.checkBox2.AutoEllipsis = true;
  192. this.checkBox2.Location = new System.Drawing.Point(18, 17);
  193. this.checkBox2.Name = "checkBox2";
  194. this.checkBox2.Size = new System.Drawing.Size(100, 16);
  195. this.checkBox2.TabIndex = 19;
  196. this.checkBox2.UseVisualStyleBackColor = true;
  197. this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
  198. //
  199. // trackBar6
  200. //
  201. this.trackBar6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  202. this.trackBar6.AutoSize = false;
  203. this.trackBar6.Location = new System.Drawing.Point(180, 40);
  204. this.trackBar6.Maximum = 0;
  205. this.trackBar6.Name = "trackBar6";
  206. this.trackBar6.Size = new System.Drawing.Size(87, 25);
  207. this.trackBar6.TabIndex = 17;
  208. this.trackBar6.TickStyle = System.Windows.Forms.TickStyle.None;
  209. //
  210. // trackBar5
  211. //
  212. this.trackBar5.AutoSize = false;
  213. this.trackBar5.Location = new System.Drawing.Point(88, 40);
  214. this.trackBar5.Maximum = 0;
  215. this.trackBar5.Name = "trackBar5";
  216. this.trackBar5.Size = new System.Drawing.Size(87, 25);
  217. this.trackBar5.TabIndex = 16;
  218. this.trackBar5.TickStyle = System.Windows.Forms.TickStyle.None;
  219. //
  220. // numericUpDown7
  221. //
  222. this.numericUpDown7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  223. this.numericUpDown7.Location = new System.Drawing.Point(277, 39);
  224. this.numericUpDown7.Maximum = new decimal(new int[] {
  225. 0,
  226. 0,
  227. 0,
  228. 0});
  229. this.numericUpDown7.Name = "numericUpDown7";
  230. this.numericUpDown7.Size = new System.Drawing.Size(46, 21);
  231. this.numericUpDown7.TabIndex = 15;
  232. //
  233. // numericUpDown6
  234. //
  235. this.numericUpDown6.Location = new System.Drawing.Point(35, 39);
  236. this.numericUpDown6.Maximum = new decimal(new int[] {
  237. 0,
  238. 0,
  239. 0,
  240. 0});
  241. this.numericUpDown6.Name = "numericUpDown6";
  242. this.numericUpDown6.Size = new System.Drawing.Size(48, 21);
  243. this.numericUpDown6.TabIndex = 14;
  244. //
  245. // label5
  246. //
  247. this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  248. this.label5.AutoEllipsis = true;
  249. this.label5.Location = new System.Drawing.Point(325, 41);
  250. this.label5.Name = "label5";
  251. this.label5.Size = new System.Drawing.Size(30, 16);
  252. this.label5.TabIndex = 11;
  253. //
  254. // label4
  255. //
  256. this.label4.AutoEllipsis = true;
  257. this.label4.Location = new System.Drawing.Point(3, 41);
  258. this.label4.Name = "label4";
  259. this.label4.Size = new System.Drawing.Size(30, 16);
  260. this.label4.TabIndex = 10;
  261. //
  262. // groupBox9
  263. //
  264. this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  265. | System.Windows.Forms.AnchorStyles.Right)));
  266. this.groupBox9.Controls.Add(this.dataGridView3);
  267. this.groupBox9.Controls.Add(this.button1);
  268. this.groupBox9.Controls.Add(this.label10);
  269. this.groupBox9.Controls.Add(this.label9);
  270. this.groupBox9.Controls.Add(this.numericUpDown1);
  271. this.groupBox9.Controls.Add(this.label8);
  272. this.groupBox9.Controls.Add(this.button9);
  273. this.groupBox9.Controls.Add(this.button8);
  274. this.groupBox9.Controls.Add(this.dataGridView2);
  275. this.groupBox9.Controls.Add(this.listView2);
  276. this.groupBox9.Controls.Add(this.button7);
  277. this.groupBox9.Controls.Add(this.button6);
  278. this.groupBox9.Location = new System.Drawing.Point(13, 759);
  279. this.groupBox9.Name = "groupBox9";
  280. this.groupBox9.Size = new System.Drawing.Size(1306, 204);
  281. this.groupBox9.TabIndex = 34;
  282. this.groupBox9.TabStop = false;
  283. //
  284. // dataGridView3
  285. //
  286. this.dataGridView3.AllowUserToAddRows = false;
  287. this.dataGridView3.AllowUserToDeleteRows = false;
  288. this.dataGridView3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  289. | System.Windows.Forms.AnchorStyles.Left)
  290. | System.Windows.Forms.AnchorStyles.Right)));
  291. this.dataGridView3.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  292. this.dataGridView3.BackgroundColor = System.Drawing.Color.White;
  293. this.dataGridView3.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
  294. this.dataGridView3.Location = new System.Drawing.Point(202, 122);
  295. this.dataGridView3.MultiSelect = false;
  296. this.dataGridView3.Name = "dataGridView3";
  297. this.dataGridView3.RowHeadersVisible = false;
  298. this.dataGridView3.RowTemplate.Height = 23;
  299. this.dataGridView3.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  300. this.dataGridView3.Size = new System.Drawing.Size(950, 76);
  301. this.dataGridView3.TabIndex = 11;
  302. //
  303. // button1
  304. //
  305. this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  306. this.button1.AutoEllipsis = true;
  307. this.button1.Location = new System.Drawing.Point(1167, 108);
  308. this.button1.Name = "button1";
  309. this.button1.Size = new System.Drawing.Size(128, 26);
  310. this.button1.TabIndex = 10;
  311. this.button1.UseVisualStyleBackColor = true;
  312. this.button1.Click += new System.EventHandler(this.button1_Click);
  313. //
  314. // label10
  315. //
  316. this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  317. | System.Windows.Forms.AnchorStyles.Right)));
  318. this.label10.AutoSize = true;
  319. this.label10.ForeColor = System.Drawing.SystemColors.ScrollBar;
  320. this.label10.Location = new System.Drawing.Point(1152, 9);
  321. this.label10.Name = "label10";
  322. this.label10.Size = new System.Drawing.Size(11, 192);
  323. this.label10.TabIndex = 9;
  324. 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|";
  325. //
  326. // label9
  327. //
  328. this.label9.AutoSize = true;
  329. this.label9.ForeColor = System.Drawing.SystemColors.ScrollBar;
  330. this.label9.Location = new System.Drawing.Point(191, 9);
  331. this.label9.Name = "label9";
  332. this.label9.Size = new System.Drawing.Size(11, 192);
  333. this.label9.TabIndex = 8;
  334. 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|";
  335. //
  336. // numericUpDown1
  337. //
  338. this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  339. this.numericUpDown1.Location = new System.Drawing.Point(1219, 162);
  340. this.numericUpDown1.Maximum = new decimal(new int[] {
  341. 10,
  342. 0,
  343. 0,
  344. 0});
  345. this.numericUpDown1.Name = "numericUpDown1";
  346. this.numericUpDown1.Size = new System.Drawing.Size(70, 21);
  347. this.numericUpDown1.TabIndex = 7;
  348. this.numericUpDown1.Value = new decimal(new int[] {
  349. 2,
  350. 0,
  351. 0,
  352. 0});
  353. this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
  354. //
  355. // label8
  356. //
  357. this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  358. this.label8.AutoEllipsis = true;
  359. this.label8.Location = new System.Drawing.Point(1180, 167);
  360. this.label8.Name = "label8";
  361. this.label8.Size = new System.Drawing.Size(35, 16);
  362. this.label8.TabIndex = 6;
  363. //
  364. // button9
  365. //
  366. this.button9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  367. this.button9.AutoEllipsis = true;
  368. this.button9.Location = new System.Drawing.Point(1167, 71);
  369. this.button9.Name = "button9";
  370. this.button9.Size = new System.Drawing.Size(128, 26);
  371. this.button9.TabIndex = 5;
  372. this.button9.UseVisualStyleBackColor = true;
  373. this.button9.Click += new System.EventHandler(this.button9_Click);
  374. //
  375. // button8
  376. //
  377. this.button8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  378. this.button8.AutoEllipsis = true;
  379. this.button8.Location = new System.Drawing.Point(1167, 34);
  380. this.button8.Name = "button8";
  381. this.button8.Size = new System.Drawing.Size(128, 26);
  382. this.button8.TabIndex = 4;
  383. this.button8.UseVisualStyleBackColor = true;
  384. this.button8.Click += new System.EventHandler(this.button8_Click);
  385. //
  386. // dataGridView2
  387. //
  388. this.dataGridView2.AllowUserToAddRows = false;
  389. this.dataGridView2.AllowUserToDeleteRows = false;
  390. this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  391. | System.Windows.Forms.AnchorStyles.Left)
  392. | System.Windows.Forms.AnchorStyles.Right)));
  393. this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  394. this.dataGridView2.BackgroundColor = System.Drawing.Color.White;
  395. this.dataGridView2.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
  396. this.dataGridView2.Location = new System.Drawing.Point(202, 14);
  397. this.dataGridView2.MultiSelect = false;
  398. this.dataGridView2.Name = "dataGridView2";
  399. this.dataGridView2.RowHeadersVisible = false;
  400. this.dataGridView2.RowTemplate.Height = 23;
  401. this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  402. this.dataGridView2.Size = new System.Drawing.Size(950, 102);
  403. this.dataGridView2.TabIndex = 3;
  404. //
  405. // listView2
  406. //
  407. this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  408. | System.Windows.Forms.AnchorStyles.Left)));
  409. this.listView2.HideSelection = false;
  410. this.listView2.Location = new System.Drawing.Point(7, 54);
  411. this.listView2.Name = "listView2";
  412. this.listView2.Size = new System.Drawing.Size(181, 140);
  413. this.listView2.TabIndex = 2;
  414. this.listView2.UseCompatibleStateImageBehavior = false;
  415. this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
  416. //
  417. // button7
  418. //
  419. this.button7.AutoEllipsis = true;
  420. this.button7.Location = new System.Drawing.Point(136, 18);
  421. this.button7.Name = "button7";
  422. this.button7.Size = new System.Drawing.Size(52, 26);
  423. this.button7.TabIndex = 1;
  424. this.button7.UseVisualStyleBackColor = true;
  425. this.button7.Click += new System.EventHandler(this.button7_Click);
  426. //
  427. // button6
  428. //
  429. this.button6.AutoEllipsis = true;
  430. this.button6.Location = new System.Drawing.Point(7, 18);
  431. this.button6.Name = "button6";
  432. this.button6.Size = new System.Drawing.Size(93, 26);
  433. this.button6.TabIndex = 0;
  434. this.button6.UseVisualStyleBackColor = true;
  435. this.button6.Click += new System.EventHandler(this.button6_Click);
  436. //
  437. // groupBox8
  438. //
  439. this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  440. | System.Windows.Forms.AnchorStyles.Left)));
  441. this.groupBox8.Controls.Add(this.dataGridView1);
  442. this.groupBox8.Location = new System.Drawing.Point(154, 579);
  443. this.groupBox8.Name = "groupBox8";
  444. this.groupBox8.Size = new System.Drawing.Size(356, 174);
  445. this.groupBox8.TabIndex = 33;
  446. this.groupBox8.TabStop = false;
  447. //
  448. // dataGridView1
  449. //
  450. this.dataGridView1.AllowUserToAddRows = false;
  451. this.dataGridView1.AllowUserToDeleteRows = false;
  452. this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  453. | System.Windows.Forms.AnchorStyles.Left)));
  454. this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  455. this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
  456. this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
  457. this.dataGridView1.Location = new System.Drawing.Point(7, 21);
  458. this.dataGridView1.MultiSelect = false;
  459. this.dataGridView1.Name = "dataGridView1";
  460. this.dataGridView1.RowHeadersVisible = false;
  461. this.dataGridView1.RowTemplate.Height = 23;
  462. this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  463. this.dataGridView1.Size = new System.Drawing.Size(345, 147);
  464. this.dataGridView1.TabIndex = 0;
  465. //
  466. // groupBox6
  467. //
  468. this.groupBox6.Controls.Add(this.checkBox6);
  469. this.groupBox6.Controls.Add(this.btnDisplay);
  470. this.groupBox6.Controls.Add(this.btnColour);
  471. this.groupBox6.Controls.Add(this.checkBox5);
  472. this.groupBox6.Controls.Add(this.checkBox4);
  473. this.groupBox6.Location = new System.Drawing.Point(154, 416);
  474. this.groupBox6.Name = "groupBox6";
  475. this.groupBox6.Size = new System.Drawing.Size(357, 87);
  476. this.groupBox6.TabIndex = 32;
  477. this.groupBox6.TabStop = false;
  478. //
  479. // checkBox6
  480. //
  481. this.checkBox6.AutoEllipsis = true;
  482. this.checkBox6.Location = new System.Drawing.Point(18, 17);
  483. this.checkBox6.Name = "checkBox6";
  484. this.checkBox6.Size = new System.Drawing.Size(230, 16);
  485. this.checkBox6.TabIndex = 11;
  486. this.checkBox6.UseVisualStyleBackColor = true;
  487. this.checkBox6.CheckedChanged += new System.EventHandler(this.checkBox6_CheckedChanged);
  488. //
  489. // btnDisplay
  490. //
  491. this.btnDisplay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  492. this.btnDisplay.AutoEllipsis = true;
  493. this.btnDisplay.Location = new System.Drawing.Point(250, 55);
  494. this.btnDisplay.Name = "btnDisplay";
  495. this.btnDisplay.Size = new System.Drawing.Size(85, 26);
  496. this.btnDisplay.TabIndex = 10;
  497. this.btnDisplay.UseVisualStyleBackColor = true;
  498. this.btnDisplay.Click += new System.EventHandler(this.btnDisplay_Click);
  499. //
  500. // btnColour
  501. //
  502. this.btnColour.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  503. this.btnColour.AutoEllipsis = true;
  504. this.btnColour.Location = new System.Drawing.Point(260, 29);
  505. this.btnColour.Name = "btnColour";
  506. this.btnColour.Size = new System.Drawing.Size(75, 23);
  507. this.btnColour.TabIndex = 9;
  508. this.btnColour.UseVisualStyleBackColor = true;
  509. this.btnColour.Click += new System.EventHandler(this.btnColour_Click);
  510. //
  511. // checkBox5
  512. //
  513. this.checkBox5.AutoEllipsis = true;
  514. this.checkBox5.Location = new System.Drawing.Point(18, 63);
  515. this.checkBox5.Name = "checkBox5";
  516. this.checkBox5.Size = new System.Drawing.Size(220, 16);
  517. this.checkBox5.TabIndex = 8;
  518. this.checkBox5.UseVisualStyleBackColor = true;
  519. this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
  520. //
  521. // checkBox4
  522. //
  523. this.checkBox4.AutoEllipsis = true;
  524. this.checkBox4.Location = new System.Drawing.Point(18, 40);
  525. this.checkBox4.Name = "checkBox4";
  526. this.checkBox4.Size = new System.Drawing.Size(230, 16);
  527. this.checkBox4.TabIndex = 7;
  528. this.checkBox4.UseVisualStyleBackColor = true;
  529. this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
  530. //
  531. // groupBox3
  532. //
  533. this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  534. | System.Windows.Forms.AnchorStyles.Left)
  535. | System.Windows.Forms.AnchorStyles.Right)));
  536. this.groupBox3.Location = new System.Drawing.Point(517, 68);
  537. this.groupBox3.Name = "groupBox3";
  538. this.groupBox3.Size = new System.Drawing.Size(802, 685);
  539. this.groupBox3.TabIndex = 31;
  540. this.groupBox3.TabStop = false;
  541. //
  542. // groupBox2
  543. //
  544. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  545. | System.Windows.Forms.AnchorStyles.Left)));
  546. this.groupBox2.Controls.Add(this.listView1);
  547. this.groupBox2.Location = new System.Drawing.Point(13, 58);
  548. this.groupBox2.Name = "groupBox2";
  549. this.groupBox2.Size = new System.Drawing.Size(135, 696);
  550. this.groupBox2.TabIndex = 30;
  551. this.groupBox2.TabStop = false;
  552. //
  553. // listView1
  554. //
  555. this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  556. | System.Windows.Forms.AnchorStyles.Left)
  557. | System.Windows.Forms.AnchorStyles.Right)));
  558. this.listView1.HideSelection = false;
  559. this.listView1.LargeImageList = this.imageList1;
  560. this.listView1.Location = new System.Drawing.Point(5, 17);
  561. this.listView1.MultiSelect = false;
  562. this.listView1.Name = "listView1";
  563. this.listView1.Size = new System.Drawing.Size(124, 673);
  564. this.listView1.TabIndex = 0;
  565. this.listView1.UseCompatibleStateImageBehavior = false;
  566. this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
  567. //
  568. // imageList1
  569. //
  570. this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  571. this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
  572. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  573. //
  574. // groupBox1
  575. //
  576. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  577. | System.Windows.Forms.AnchorStyles.Right)));
  578. this.groupBox1.Controls.Add(this.button2);
  579. this.groupBox1.Controls.Add(this.checkBox1);
  580. this.groupBox1.Controls.Add(this.btnSetUp);
  581. this.groupBox1.Location = new System.Drawing.Point(13, 4);
  582. this.groupBox1.Name = "groupBox1";
  583. this.groupBox1.Size = new System.Drawing.Size(1306, 50);
  584. this.groupBox1.TabIndex = 29;
  585. this.groupBox1.TabStop = false;
  586. //
  587. // button2
  588. //
  589. this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  590. | System.Windows.Forms.AnchorStyles.Right)));
  591. this.button2.AutoEllipsis = true;
  592. this.button2.Location = new System.Drawing.Point(1184, 14);
  593. this.button2.Name = "button2";
  594. this.button2.Size = new System.Drawing.Size(84, 30);
  595. this.button2.TabIndex = 2;
  596. this.button2.UseVisualStyleBackColor = true;
  597. this.button2.Click += new System.EventHandler(this.button2_Click);
  598. //
  599. // checkBox1
  600. //
  601. this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  602. | System.Windows.Forms.AnchorStyles.Left)));
  603. this.checkBox1.AutoEllipsis = true;
  604. this.checkBox1.Location = new System.Drawing.Point(141, 21);
  605. this.checkBox1.Name = "checkBox1";
  606. this.checkBox1.Size = new System.Drawing.Size(140, 16);
  607. this.checkBox1.TabIndex = 1;
  608. this.checkBox1.UseVisualStyleBackColor = true;
  609. //
  610. // btnSetUp
  611. //
  612. this.btnSetUp.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  613. | System.Windows.Forms.AnchorStyles.Left)));
  614. this.btnSetUp.AutoEllipsis = true;
  615. this.btnSetUp.Location = new System.Drawing.Point(15, 14);
  616. this.btnSetUp.Name = "btnSetUp";
  617. this.btnSetUp.Size = new System.Drawing.Size(84, 30);
  618. this.btnSetUp.TabIndex = 0;
  619. this.btnSetUp.UseVisualStyleBackColor = true;
  620. this.btnSetUp.Click += new System.EventHandler(this.btnSetUp_Click);
  621. //
  622. // groupBox5
  623. //
  624. this.groupBox5.Controls.Add(this.trackBar4);
  625. this.groupBox5.Controls.Add(this.trackBar2);
  626. this.groupBox5.Controls.Add(this.numericUpDown5);
  627. this.groupBox5.Controls.Add(this.numericUpDown4);
  628. this.groupBox5.Controls.Add(this.label3);
  629. this.groupBox5.Controls.Add(this.checkBox3);
  630. this.groupBox5.Location = new System.Drawing.Point(154, 348);
  631. this.groupBox5.Name = "groupBox5";
  632. this.groupBox5.Size = new System.Drawing.Size(356, 65);
  633. this.groupBox5.TabIndex = 37;
  634. this.groupBox5.TabStop = false;
  635. //
  636. // trackBar4
  637. //
  638. this.trackBar4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  639. this.trackBar4.AutoSize = false;
  640. this.trackBar4.Location = new System.Drawing.Point(180, 33);
  641. this.trackBar4.Maximum = 0;
  642. this.trackBar4.Name = "trackBar4";
  643. this.trackBar4.Size = new System.Drawing.Size(87, 25);
  644. this.trackBar4.TabIndex = 15;
  645. this.trackBar4.TickStyle = System.Windows.Forms.TickStyle.None;
  646. //
  647. // trackBar2
  648. //
  649. this.trackBar2.AutoSize = false;
  650. this.trackBar2.Location = new System.Drawing.Point(91, 32);
  651. this.trackBar2.Maximum = 0;
  652. this.trackBar2.Name = "trackBar2";
  653. this.trackBar2.Size = new System.Drawing.Size(87, 25);
  654. this.trackBar2.TabIndex = 14;
  655. this.trackBar2.TickStyle = System.Windows.Forms.TickStyle.None;
  656. //
  657. // numericUpDown5
  658. //
  659. this.numericUpDown5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  660. this.numericUpDown5.Location = new System.Drawing.Point(278, 33);
  661. this.numericUpDown5.Maximum = new decimal(new int[] {
  662. 0,
  663. 0,
  664. 0,
  665. 0});
  666. this.numericUpDown5.Name = "numericUpDown5";
  667. this.numericUpDown5.Size = new System.Drawing.Size(62, 21);
  668. this.numericUpDown5.TabIndex = 12;
  669. //
  670. // numericUpDown4
  671. //
  672. this.numericUpDown4.Location = new System.Drawing.Point(27, 33);
  673. this.numericUpDown4.Maximum = new decimal(new int[] {
  674. 0,
  675. 0,
  676. 0,
  677. 0});
  678. this.numericUpDown4.Name = "numericUpDown4";
  679. this.numericUpDown4.Size = new System.Drawing.Size(62, 21);
  680. this.numericUpDown4.TabIndex = 10;
  681. //
  682. // label3
  683. //
  684. this.label3.AutoEllipsis = true;
  685. this.label3.Location = new System.Drawing.Point(9, 67);
  686. this.label3.Name = "label3";
  687. this.label3.Size = new System.Drawing.Size(50, 12);
  688. this.label3.TabIndex = 9;
  689. //
  690. // checkBox3
  691. //
  692. this.checkBox3.AutoEllipsis = true;
  693. this.checkBox3.Location = new System.Drawing.Point(18, 14);
  694. this.checkBox3.Name = "checkBox3";
  695. this.checkBox3.Size = new System.Drawing.Size(100, 16);
  696. this.checkBox3.TabIndex = 0;
  697. this.checkBox3.UseVisualStyleBackColor = true;
  698. this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
  699. //
  700. // OrganizationLevelDialog
  701. //
  702. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  703. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  704. this.ClientSize = new System.Drawing.Size(1332, 967);
  705. this.Controls.Add(this.groupBox5);
  706. this.Controls.Add(this.groupBox7);
  707. this.Controls.Add(this.groupBox9);
  708. this.Controls.Add(this.groupBox8);
  709. this.Controls.Add(this.groupBox6);
  710. this.Controls.Add(this.groupBox3);
  711. this.Controls.Add(this.groupBox2);
  712. this.Controls.Add(this.groupBox1);
  713. this.Name = "OrganizationLevelDialog";
  714. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InclusionsStandardDialog_FormClosing);
  715. this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData);
  716. this.Load += new System.EventHandler(this.GrainSizeDialog_Load);
  717. this.Controls.SetChildIndex(this.groupBox1, 0);
  718. this.Controls.SetChildIndex(this.groupBox2, 0);
  719. this.Controls.SetChildIndex(this.groupBox3, 0);
  720. this.Controls.SetChildIndex(this.groupBox6, 0);
  721. this.Controls.SetChildIndex(this.groupBox8, 0);
  722. this.Controls.SetChildIndex(this.groupBox9, 0);
  723. this.Controls.SetChildIndex(this.groupBox7, 0);
  724. this.Controls.SetChildIndex(this.groupBox5, 0);
  725. this.groupBox7.ResumeLayout(false);
  726. ((System.ComponentModel.ISupportInitialize)(this.trackBar6)).EndInit();
  727. ((System.ComponentModel.ISupportInitialize)(this.trackBar5)).EndInit();
  728. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown7)).EndInit();
  729. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown6)).EndInit();
  730. this.groupBox9.ResumeLayout(false);
  731. this.groupBox9.PerformLayout();
  732. ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit();
  733. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  734. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
  735. this.groupBox8.ResumeLayout(false);
  736. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  737. this.groupBox6.ResumeLayout(false);
  738. this.groupBox2.ResumeLayout(false);
  739. this.groupBox1.ResumeLayout(false);
  740. this.groupBox5.ResumeLayout(false);
  741. ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).EndInit();
  742. ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();
  743. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
  744. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
  745. this.ResumeLayout(false);
  746. }
  747. #endregion
  748. private PaintDotNet.CustomControl.BinaryControl bc;
  749. private System.Windows.Forms.GroupBox groupBox7;
  750. private System.Windows.Forms.TrackBar trackBar6;
  751. private System.Windows.Forms.TrackBar trackBar5;
  752. private System.Windows.Forms.NumericUpDown numericUpDown7;
  753. private System.Windows.Forms.NumericUpDown numericUpDown6;
  754. private System.Windows.Forms.Label label5;
  755. private System.Windows.Forms.Label label4;
  756. private System.Windows.Forms.GroupBox groupBox9;
  757. private System.Windows.Forms.DataGridView dataGridView3;
  758. private System.Windows.Forms.Button button1;
  759. private System.Windows.Forms.Label label10;
  760. private System.Windows.Forms.Label label9;
  761. private System.Windows.Forms.NumericUpDown numericUpDown1;
  762. private System.Windows.Forms.Label label8;
  763. private System.Windows.Forms.Button button9;
  764. private System.Windows.Forms.Button button8;
  765. private System.Windows.Forms.DataGridView dataGridView2;
  766. private System.Windows.Forms.ListView listView2;
  767. private System.Windows.Forms.Button button7;
  768. private System.Windows.Forms.Button button6;
  769. private System.Windows.Forms.GroupBox groupBox8;
  770. private System.Windows.Forms.DataGridView dataGridView1;
  771. private System.Windows.Forms.GroupBox groupBox6;
  772. private System.Windows.Forms.CheckBox checkBox6;
  773. private System.Windows.Forms.Button btnDisplay;
  774. private System.Windows.Forms.Button btnColour;
  775. public System.Windows.Forms.CheckBox checkBox5;
  776. public System.Windows.Forms.CheckBox checkBox4;
  777. private System.Windows.Forms.GroupBox groupBox3;
  778. private System.Windows.Forms.GroupBox groupBox2;
  779. private System.Windows.Forms.ListView listView1;
  780. private System.Windows.Forms.GroupBox groupBox1;
  781. private System.Windows.Forms.Button button2;
  782. private System.Windows.Forms.CheckBox checkBox1;
  783. private System.Windows.Forms.Button btnSetUp;
  784. private System.Windows.Forms.ImageList imageList1;
  785. private System.Windows.Forms.GroupBox groupBox5;
  786. private System.Windows.Forms.TrackBar trackBar4;
  787. private System.Windows.Forms.TrackBar trackBar2;
  788. private System.Windows.Forms.NumericUpDown numericUpDown5;
  789. private System.Windows.Forms.NumericUpDown numericUpDown4;
  790. private System.Windows.Forms.Label label3;
  791. private System.Windows.Forms.CheckBox checkBox3;
  792. #endregion
  793. public static OrganizationLevelDialog organizationLevelDialog;
  794. /// <summary>
  795. /// 调色板
  796. /// </summary>
  797. PaintDotNet.ColorsForm colorsForm1;
  798. PaintDotNet.ColorsForm colorsForm2;
  799. /// <summary>
  800. /// 主控件
  801. /// </summary>
  802. private AppWorkspace appWorkspace;
  803. /// <summary>
  804. /// 图像面板
  805. /// </summary>
  806. public DocumentWorkspaceWindow documentWorkspace;
  807. /// <summary>
  808. /// 公共按钮
  809. /// </summary>
  810. private CommonControlButtons commonControlButtons;
  811. /// <summary>
  812. /// 选中图片的mat
  813. /// </summary>
  814. private Mat imageMat;
  815. /// <summary>
  816. /// 计算结果的表格集合
  817. /// </summary>
  818. private List<DataTable> resultTableList = new List<DataTable>();
  819. /// <summary>
  820. /// 保存用于生成报告的图片
  821. /// </summary>
  822. private List<Bitmap> bitList;
  823. /// <summary>
  824. /// 储存点击保存结果后的所有原图与分析图
  825. /// </summary>
  826. private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
  827. /// <summary>
  828. /// 是否显示全部
  829. /// </summary>
  830. private bool showAll = false;
  831. /// <summary>
  832. /// 当前图片是否有视场
  833. /// </summary>
  834. private bool isHadView = false;
  835. /// <summary>
  836. /// 二值处理后的mat
  837. /// </summary>
  838. private Mat binarizationMat;
  839. /// <summary>
  840. /// 面积率为0.8-1的mat
  841. /// </summary>
  842. private Mat binarizationMat08_1;
  843. /// <summary>
  844. /// 面积率为0.6-0.8的mat
  845. /// </summary>
  846. private Mat binarizationMat06_08;
  847. /// <summary>
  848. /// 面积率为0.4-0.6的mat
  849. /// </summary>
  850. private Mat binarizationMat04_06;
  851. /// <summary>
  852. /// 面积率为0.2-0.4的mat
  853. /// </summary>
  854. private Mat binarizationMat02_04;
  855. /// <summary>
  856. /// 面积率为0.1-0.2的mat
  857. /// </summary>
  858. private Mat binarizationMat01_02;
  859. /// <summary>
  860. /// 面积率为0-0.1的mat
  861. /// </summary>
  862. private Mat binarizationMat0_01;
  863. /// <summary>
  864. /// 相的集合
  865. /// </summary>
  866. private PhaseModel phaseModel;
  867. /// <summary>
  868. /// 相的集合
  869. /// </summary>
  870. private PhaseModel phaseModel08_1;
  871. /// <summary>
  872. /// 相的集合
  873. /// </summary>
  874. private PhaseModel phaseModel06_08;
  875. /// <summary>
  876. /// 相的集合
  877. /// </summary>
  878. private PhaseModel phaseModel04_06;
  879. /// <summary>
  880. /// 相的集合
  881. /// </summary>
  882. private PhaseModel phaseModel02_04;
  883. /// <summary>
  884. /// 相的集合
  885. /// </summary>
  886. private PhaseModel phaseModel01_02;
  887. /// <summary>
  888. /// 相的集合
  889. /// </summary>
  890. private PhaseModel phaseModel0_01;
  891. /// <summary>
  892. /// 单位标尺
  893. /// </summary>
  894. private double unitLength = 1;
  895. /// <summary>
  896. /// 放大倍数
  897. /// </summary>
  898. private double multiple = 1;
  899. /// <summary>
  900. /// 坐标集合
  901. /// </summary>
  902. private List<OpenCvSharp.Point> pointList = new List<OpenCvSharp.Point>();
  903. /// <summary>
  904. /// 绘制点
  905. /// </summary>
  906. private List<double> leList = new List<double>();
  907. /// <summary>
  908. /// 最大点碳化物点集合
  909. /// </summary>
  910. private List<List<OpenCvSharp.Point>> maxPoint;
  911. /// <summary>
  912. /// 面积率0.8_1碳化物点集合
  913. /// </summary>
  914. private List<List<OpenCvSharp.Point>> lstPoint08_1;
  915. /// <summary>
  916. /// 面积率0.6_0.8化物点集合
  917. /// </summary>
  918. private List<List<OpenCvSharp.Point>> lstPoint06_08;
  919. /// <summary>
  920. /// 面积率0.4_0.6化物点集合
  921. /// </summary>
  922. private List<List<OpenCvSharp.Point>> lstPoint04_06;
  923. /// <summary>
  924. /// 面积率0.2_0.4化物点集合
  925. /// </summary>
  926. private List<List<OpenCvSharp.Point>> lstPoint02_04;
  927. /// <summary>
  928. /// 面积率0.1_0.2化物点集合
  929. /// </summary>
  930. private List<List<OpenCvSharp.Point>> lstPoint01_02;
  931. /// <summary>
  932. /// 面积率0_0.1化物点集合
  933. /// </summary>
  934. private List<List<OpenCvSharp.Point>> lstPoint0_01;
  935. /// <summary>
  936. /// 钨系A标准
  937. /// </summary>
  938. private double[] tungstenA = new double[] { 18, 21, 23, 25 };
  939. /// <summary>
  940. /// 钨系B标准
  941. /// </summary>
  942. private double[] tungstenB = new double[] { 16, 18, 21, 23 };
  943. /// <summary>
  944. /// 钼系标准
  945. /// </summary>
  946. private double[] molybdenum = new double[] { 6.1, 8.3, 12.5, 15.6, 22.1 };
  947. /// <summary>
  948. /// 面积率
  949. /// </summary>
  950. private double areaRatio = 0;
  951. /// <summary>
  952. /// 面积率最大值
  953. /// </summary>
  954. double maxAreaRatio = 0;
  955. /// <summary>
  956. /// 面积率最小值
  957. /// </summary>
  958. double minAreaRatio = 100;
  959. /// <summary>
  960. /// 单视场球化率
  961. /// </summary>
  962. double spheroidizationRate = 0;
  963. /// <summary>
  964. /// 石墨含量
  965. /// </summary>
  966. double spheroidizationAreaRate = 0;
  967. /// <summary>
  968. /// 存储面积率颜色字典
  969. /// </summary>
  970. public Dictionary<string, Color> colour = new Dictionary<string, Color>();
  971. // <summary>
  972. /// 存储字号与颜色字典
  973. /// </summary>
  974. public Dictionary<string, Color> colourFont = new Dictionary<string, Color>();
  975. /// <summary>
  976. /// 碳化物尺寸最大值
  977. /// </summary>
  978. private double maxSize = 0;
  979. /// <summary>
  980. /// 是否仅修改相的颜色
  981. /// </summary>
  982. private bool changeColor = false;
  983. /// <summary>
  984. /// 是否未对图片做其他操作
  985. /// </summary>
  986. private bool isFirstSwitch = false;
  987. /// <summary>
  988. /// 中间数据
  989. /// </summary>
  990. private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
  991. private bool needChange = true;
  992. private int defaultIndex = -1;
  993. /// <summary>
  994. /// 是否脚本运行
  995. /// </summary>
  996. private Boolean initScriptValues = false;
  997. /// <summary>
  998. /// 保存窗口参数
  999. /// </summary>
  1000. private GrainSizeAnalysisModel analysisModel;
  1001. private const string ParamKey_Report = "report";//报告设置
  1002. private const string ParamKey_Screen = "screen";//筛选
  1003. private const string ParamKey_ScreenMin = "screenMin";//面积最小值
  1004. private const string ParamKey_ScreenMax = "screenMax";//面积最大值
  1005. private const string ParamKey_Diameter = "diameter";//直径小于20um不参与计算
  1006. private const string ParamKey_Colour = "colour";//显示不同级别颜色
  1007. private const string ParamKey_AreaRatio = "areaRatio";//显示面积率
  1008. private const string ParamKey_AreaRatioRange = "areaRatioRange";//面积率区间
  1009. private const string ParamKey_AreaRatioRangeMin = "areaRatioRangeMin";//面积率区间最小值
  1010. private const string ParamKey_AreaRatioRangeMax = "areaRatioRangeMax";//面积率区间最大值
  1011. private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数
  1012. private const string ParamKey_panelColour1_08 = "panelColour1_08";//不同区间颜色
  1013. private const string ParamKey_panelColour08_06 = "panelColour08_06";//不同区间颜色
  1014. private const string ParamKey_panelColour06_04 = "panelColour06_04";//不同区间颜色
  1015. private const string ParamKey_panelColour04_02 = "panelColour04_02";//不同区间颜色
  1016. private const string ParamKey_panelColour02_01 = "panelColour02_01";//不同区间颜色
  1017. private const string ParamKey_panelColour01_0 = "panelColour01_0";//不同区间颜色
  1018. private const string ParamKey_FontSize = "fontSize";//字体大小
  1019. private const string ParamKey_FontColour = "fontColour";//字体颜色
  1020. private decimal areaRatioRangeMin = -1;
  1021. private decimal areaRatioRangeMax = -1;
  1022. private decimal areaMin = -1;//面积区间最小
  1023. private decimal areaMax = -1;//面积区间最大
  1024. private string fontSize = "12";
  1025. private Color fontColour = Color.Black;
  1026. #region 二值化相关
  1027. /// <summary>
  1028. /// 调色板
  1029. /// </summary>
  1030. private ColorsForm colorsFormGrid;
  1031. private CheckBox checkBox2;
  1032. private ToolTip toolTip1;
  1033. //二值化集成1
  1034. BinaryClass binaryClass;
  1035. private int menuId;
  1036. private string menuName;
  1037. #endregion
  1038. public OrganizationLevelDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem)
  1039. {
  1040. this.menuId = menuItem.MenuId;
  1041. this.menuName = menuItem.Text;
  1042. binaryClass = new BinaryClass(menuId);
  1043. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  1044. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  1045. this.analysisModel = analysisModelXml.cloneListParamModel(this.menuId);
  1046. foreach (var item in this.analysisModel.ListParam)
  1047. item.setValue();
  1048. organizationLevelDialog = this;
  1049. this.appWorkspace = appWorkspace;
  1050. InitializeComponent();
  1051. InitializeLanguageText();
  1052. InitColour();
  1053. InitPicList();
  1054. InitOtherTools();
  1055. //如果是脚本执行,将参数带入
  1056. if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
  1057. {
  1058. this.initScriptValues = true;//ScriptAutomatic
  1059. //Boolean initScriptValues = true;
  1060. ////在这里反射出对应功能的参数类
  1061. string className = InvariantData.path_Action + ".Action" + menuId;
  1062. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  1063. foreach (Args arg in param.Lists)
  1064. {
  1065. Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
  1066. if (param1.value != null)
  1067. arg.Value = param1.value;
  1068. getValue(arg.key, arg.Value);
  1069. }
  1070. appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
  1071. }
  1072. else
  1073. {//读取上次关闭窗口时保存的参数
  1074. GetListParamModel();
  1075. }
  1076. InitCommonButtonEvent();
  1077. InitGridHeader();
  1078. SetAnalyzeModelFromXml("Template.Manager.item3.DeterminationGBT11354Level");
  1079. }
  1080. private void ShowImgEvent(object sender, EventArgs e)
  1081. {
  1082. listView1.Focus();
  1083. if (this.defaultIndex != -1)
  1084. {
  1085. this.listView1.Items[defaultIndex].Focused = true;
  1086. this.listView1.Items[defaultIndex].Selected = true;
  1087. }
  1088. }
  1089. /// <summary>
  1090. /// 初始化面积率颜色、字号颜色
  1091. /// </summary>
  1092. private void InitColour()
  1093. {
  1094. colour.Add("panelColour1_08", Color.Orange);
  1095. colour.Add("panelColour08_06", Color.Blue);
  1096. colour.Add("panelColour06_04", Color.Green);
  1097. colour.Add("panelColour04_02", Color.Pink);
  1098. colour.Add("panelColour02_01", Color.Violet);
  1099. colour.Add("panelColour01_0", Color.Yellow);
  1100. colourFont.Add("10", Color.Black);
  1101. }
  1102. /// <summary>
  1103. /// 初始化表头
  1104. /// </summary>
  1105. private void InitGridHeader()
  1106. {
  1107. //
  1108. //结果展示表
  1109. //
  1110. this.dataGridView1.ColumnHeadersHeight = 30;
  1111. DataGridViewTextBoxColumn h1 = new DataGridViewTextBoxColumn();
  1112. h1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1113. h1.Width = 95;
  1114. DataGridViewTextBoxColumn h2 = new DataGridViewTextBoxColumn();
  1115. h2.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1116. h2.Width = 95;
  1117. DataGridViewTextBoxColumn h3 = new DataGridViewTextBoxColumn();
  1118. h3.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1119. h3.Width = 95;
  1120. DataGridViewTextBoxColumn h4 = new DataGridViewTextBoxColumn();
  1121. h4.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1122. h4.Width = 95;
  1123. DataGridViewTextBoxColumn h5 = new DataGridViewTextBoxColumn();
  1124. h5.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1125. h5.Width = 95;
  1126. DataGridViewTextBoxColumn h6 = new DataGridViewTextBoxColumn();
  1127. h6.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1128. h6.Width = 95;
  1129. DataGridViewTextBoxColumn h7 = new DataGridViewTextBoxColumn();
  1130. h7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1131. h7.Width = 95;
  1132. DataGridViewTextBoxColumn h8 = new DataGridViewTextBoxColumn();
  1133. h8.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1134. h8.Width = 95;
  1135. DataGridViewTextBoxColumn h9 = new DataGridViewTextBoxColumn();
  1136. h9.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1137. h9.Width = 95;
  1138. this.dataGridView1.Columns.Add(h1);
  1139. this.dataGridView1.Columns.Add(h2);
  1140. this.dataGridView1.Columns.Add(h3);
  1141. this.dataGridView1.Columns.Add(h4);
  1142. this.dataGridView1.Columns.Add(h5);
  1143. this.dataGridView1.Columns.Add(h6);
  1144. this.dataGridView1.Columns.Add(h7);
  1145. this.dataGridView1.Columns.Add(h8);
  1146. this.dataGridView1.Columns.Add(h9);
  1147. DataGridViewHelper helper = new DataGridViewHelper(this.dataGridView1);
  1148. helper.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.view.text")));
  1149. helper.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, "1-0.8"));
  1150. helper.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, "0.8-0.6"));
  1151. helper.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, "0.6-0.4"));
  1152. helper.Headers.Add(new DataGridViewHelper.TopHeader(4, 1, "0.4-0.2"));
  1153. helper.Headers.Add(new DataGridViewHelper.TopHeader(5, 1, "0.2-0.1"));
  1154. helper.Headers.Add(new DataGridViewHelper.TopHeader(6, 1, "0.1-0"));
  1155. helper.Headers.Add(new DataGridViewHelper.TopHeader(7, 1, PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)"));
  1156. helper.Headers.Add(new DataGridViewHelper.TopHeader(8, 1, PdnResources.GetString("Menu.Levelname.text")));
  1157. this.dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
  1158. this.dataGridView1.Columns[0].ReadOnly = true;
  1159. this.dataGridView1.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;//文字居中
  1160. this.dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
  1161. this.dataGridView1.Columns[1].ReadOnly = true;
  1162. this.dataGridView1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1163. this.dataGridView1.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
  1164. this.dataGridView1.Columns[2].ReadOnly = true;
  1165. this.dataGridView1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1166. this.dataGridView1.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
  1167. this.dataGridView1.Columns[3].ReadOnly = true;
  1168. this.dataGridView1.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1169. this.dataGridView1.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
  1170. this.dataGridView1.Columns[4].ReadOnly = true;
  1171. this.dataGridView1.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1172. this.dataGridView1.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable;
  1173. this.dataGridView1.Columns[5].ReadOnly = true;
  1174. this.dataGridView1.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1175. this.dataGridView1.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable;
  1176. this.dataGridView1.Columns[6].ReadOnly = true;
  1177. this.dataGridView1.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1178. this.dataGridView1.Columns[7].SortMode = DataGridViewColumnSortMode.NotSortable;
  1179. this.dataGridView1.Columns[7].ReadOnly = true;
  1180. this.dataGridView1.Columns[7].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1181. this.dataGridView1.Columns[8].SortMode = DataGridViewColumnSortMode.NotSortable;
  1182. this.dataGridView1.Columns[8].ReadOnly = true;
  1183. this.dataGridView1.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1184. this.dataGridView1.AllowUserToResizeRows = false;
  1185. this.dataGridView1.AllowUserToResizeColumns = false;
  1186. //
  1187. //分析结果表
  1188. //
  1189. this.dataGridView2.ColumnHeadersHeight = 30;
  1190. DataGridViewTextBoxColumn h11 = new DataGridViewTextBoxColumn();
  1191. //h11.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1192. h11.Width = 115;
  1193. DataGridViewTextBoxColumn h12 = new DataGridViewTextBoxColumn();
  1194. //h12.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1195. h12.Width = 115;
  1196. DataGridViewTextBoxColumn h13 = new DataGridViewTextBoxColumn();
  1197. //h13.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1198. h13.Width = 115;
  1199. DataGridViewTextBoxColumn h14 = new DataGridViewTextBoxColumn();
  1200. //h14.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1201. h14.Width = 115;
  1202. DataGridViewTextBoxColumn h15 = new DataGridViewTextBoxColumn();
  1203. //h15.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1204. h15.Width = 115;
  1205. DataGridViewTextBoxColumn h16 = new DataGridViewTextBoxColumn();
  1206. //h16.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1207. h16.Width = 115;
  1208. DataGridViewTextBoxColumn h17 = new DataGridViewTextBoxColumn();
  1209. //h17.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1210. h17.Width = 115;
  1211. DataGridViewTextBoxColumn h18 = new DataGridViewTextBoxColumn();
  1212. //h18.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1213. h18.Width = 115;
  1214. DataGridViewTextBoxColumn h19 = new DataGridViewTextBoxColumn();
  1215. //h19.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1216. h19.Width = 115;
  1217. DataGridViewTextBoxColumn h20 = new DataGridViewTextBoxColumn();
  1218. //h20.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1219. h20.Width = 115;
  1220. this.dataGridView2.Columns.Add(h11);
  1221. this.dataGridView2.Columns.Add(h12);
  1222. this.dataGridView2.Columns.Add(h13);
  1223. this.dataGridView2.Columns.Add(h14);
  1224. this.dataGridView2.Columns.Add(h15);
  1225. this.dataGridView2.Columns.Add(h16);
  1226. this.dataGridView2.Columns.Add(h17);
  1227. this.dataGridView2.Columns.Add(h18);
  1228. this.dataGridView2.Columns.Add(h19);
  1229. this.dataGridView2.Columns.Add(h20);
  1230. DataGridViewHelper helper2 = new DataGridViewHelper(this.dataGridView2);
  1231. helper2.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.picture.Text")));
  1232. helper2.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.view.text")));
  1233. helper2.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, "1-0.8"));
  1234. helper2.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, "0.8-0.6"));
  1235. helper2.Headers.Add(new DataGridViewHelper.TopHeader(4, 1, "0.6-0.4"));
  1236. helper2.Headers.Add(new DataGridViewHelper.TopHeader(5, 1, "0.4-0.2"));
  1237. helper2.Headers.Add(new DataGridViewHelper.TopHeader(6, 1, "0.2-0.1"));
  1238. helper2.Headers.Add(new DataGridViewHelper.TopHeader(7, 1, "0.1-0"));
  1239. helper2.Headers.Add(new DataGridViewHelper.TopHeader(8, 1, PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)"));
  1240. helper2.Headers.Add(new DataGridViewHelper.TopHeader(9, 1, PdnResources.GetString("Menu.Levelname.text")));
  1241. this.dataGridView2.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
  1242. this.dataGridView2.Columns[0].ReadOnly = true;
  1243. this.dataGridView2.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
  1244. this.dataGridView2.Columns[1].ReadOnly = true;
  1245. this.dataGridView2.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
  1246. this.dataGridView2.Columns[2].ReadOnly = true;
  1247. this.dataGridView2.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
  1248. this.dataGridView2.Columns[3].ReadOnly = true;
  1249. this.dataGridView2.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
  1250. this.dataGridView2.Columns[4].ReadOnly = true;
  1251. this.dataGridView2.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable;
  1252. this.dataGridView2.Columns[5].ReadOnly = true;
  1253. this.dataGridView2.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable;
  1254. this.dataGridView2.Columns[6].ReadOnly = true;
  1255. this.dataGridView2.Columns[7].SortMode = DataGridViewColumnSortMode.NotSortable;
  1256. this.dataGridView2.Columns[7].ReadOnly = true;
  1257. this.dataGridView2.Columns[8].SortMode = DataGridViewColumnSortMode.NotSortable;
  1258. this.dataGridView2.Columns[8].ReadOnly = true;
  1259. this.dataGridView2.Columns[9].SortMode = DataGridViewColumnSortMode.NotSortable;
  1260. this.dataGridView2.Columns[9].ReadOnly = true;
  1261. this.dataGridView2.AllowUserToResizeRows = false;
  1262. this.dataGridView2.AllowUserToResizeColumns = false;
  1263. this.dataGridView3.ColumnHeadersHeight = 30;
  1264. DataGridViewTextBoxColumn h22 = new DataGridViewTextBoxColumn();
  1265. //h22.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1266. h22.Width = 115;
  1267. DataGridViewTextBoxColumn h23 = new DataGridViewTextBoxColumn();
  1268. //h23.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1269. h23.Width = 115;
  1270. DataGridViewTextBoxColumn h24 = new DataGridViewTextBoxColumn();
  1271. //h24.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1272. h24.Width = 115;
  1273. DataGridViewTextBoxColumn h25 = new DataGridViewTextBoxColumn();
  1274. //h25.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1275. h25.Width = 115;
  1276. DataGridViewTextBoxColumn h26 = new DataGridViewTextBoxColumn();
  1277. //h26.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1278. h26.Width = 115;
  1279. DataGridViewTextBoxColumn h27 = new DataGridViewTextBoxColumn();
  1280. //h27.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1281. h27.Width = 115;
  1282. DataGridViewTextBoxColumn h28 = new DataGridViewTextBoxColumn();
  1283. //h28.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1284. h28.Width = 115;
  1285. DataGridViewTextBoxColumn h29 = new DataGridViewTextBoxColumn();
  1286. //h29.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1287. h29.Width = 115;
  1288. DataGridViewTextBoxColumn h30 = new DataGridViewTextBoxColumn();
  1289. //h30.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1290. h30.Width = 115;
  1291. DataGridViewTextBoxColumn h31 = new DataGridViewTextBoxColumn();
  1292. //h31.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
  1293. h31.Width = 115;
  1294. this.dataGridView3.Columns.Add(h22);
  1295. this.dataGridView3.Columns.Add(h23);
  1296. this.dataGridView3.Columns.Add(h24);
  1297. this.dataGridView3.Columns.Add(h25);
  1298. this.dataGridView3.Columns.Add(h26);
  1299. this.dataGridView3.Columns.Add(h27);
  1300. this.dataGridView3.Columns.Add(h28);
  1301. this.dataGridView3.Columns.Add(h29);
  1302. this.dataGridView3.Columns.Add(h30);
  1303. this.dataGridView3.Columns.Add(h31);
  1304. DataGridViewHelper helper3 = new DataGridViewHelper(this.dataGridView3);
  1305. helper3.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.picture.Text")));
  1306. helper3.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.view.text")));
  1307. helper3.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, "1-0.8"));
  1308. helper3.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, "0.8-0.6"));
  1309. helper3.Headers.Add(new DataGridViewHelper.TopHeader(4, 1, "0.6-0.4"));
  1310. helper3.Headers.Add(new DataGridViewHelper.TopHeader(5, 1, "0.4-0.2"));
  1311. helper3.Headers.Add(new DataGridViewHelper.TopHeader(6, 1, "0.2-0.1"));
  1312. helper3.Headers.Add(new DataGridViewHelper.TopHeader(7, 1, "0.1-0"));
  1313. helper3.Headers.Add(new DataGridViewHelper.TopHeader(8, 1, PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)"));
  1314. helper3.Headers.Add(new DataGridViewHelper.TopHeader(9, 1, PdnResources.GetString("Menu.Levelname.text")));
  1315. this.dataGridView3.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
  1316. this.dataGridView3.Columns[0].ReadOnly = true;
  1317. this.dataGridView3.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
  1318. this.dataGridView3.Columns[1].ReadOnly = true;
  1319. this.dataGridView3.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
  1320. this.dataGridView3.Columns[2].ReadOnly = true;
  1321. this.dataGridView3.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;
  1322. this.dataGridView3.Columns[3].ReadOnly = true;
  1323. this.dataGridView3.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;
  1324. this.dataGridView3.Columns[4].ReadOnly = true;
  1325. this.dataGridView3.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable;
  1326. this.dataGridView3.Columns[5].ReadOnly = true;
  1327. this.dataGridView3.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable;
  1328. this.dataGridView3.Columns[6].ReadOnly = true;
  1329. this.dataGridView3.Columns[7].SortMode = DataGridViewColumnSortMode.NotSortable;
  1330. this.dataGridView3.Columns[7].ReadOnly = true;
  1331. this.dataGridView3.Columns[8].SortMode = DataGridViewColumnSortMode.NotSortable;
  1332. this.dataGridView3.Columns[8].ReadOnly = true;
  1333. this.dataGridView3.Columns[9].SortMode = DataGridViewColumnSortMode.NotSortable;
  1334. this.dataGridView3.Columns[9].ReadOnly = true;
  1335. this.dataGridView3.AllowUserToResizeRows = false;
  1336. this.dataGridView3.AllowUserToResizeColumns = false;
  1337. //
  1338. //左下表
  1339. //
  1340. this.listView2.View = View.Details;
  1341. ColumnHeader header0 = new ColumnHeader();
  1342. header0.Text = PdnResources.GetString("Menu.Imagelist.Text");
  1343. header0.Width = 175;
  1344. this.listView2.Columns.Add(header0);
  1345. }
  1346. /// <summary>
  1347. /// 初始化画布按键功能
  1348. /// </summary>
  1349. private void InitCommonButtonEvent()
  1350. {
  1351. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  1352. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  1353. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  1354. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  1355. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  1356. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  1357. }
  1358. private void zoomInButton_Click(object sender, EventArgs e)
  1359. {
  1360. this.documentWorkspace.ZoomIn();
  1361. }
  1362. private void zoomOutButton_Click(object sender, EventArgs e)
  1363. {
  1364. this.documentWorkspace.ZoomOut();
  1365. }
  1366. private void zoomToWindowButton_Click(object sender, EventArgs e)
  1367. {
  1368. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  1369. }
  1370. private void actualSizeButton_Click(object sender, EventArgs e)
  1371. {
  1372. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  1373. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  1374. }
  1375. private void pointerButton_Click(object sender, EventArgs e)
  1376. {
  1377. this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
  1378. }
  1379. private void mobileModeButton_Click(object sender, EventArgs e)
  1380. {
  1381. this.documentWorkspace.ActiveTool = DrawToolType.MoveMode;
  1382. }
  1383. /// <summary>
  1384. /// 调色板回调函数
  1385. /// </summary>
  1386. /// <param name="sender"></param>
  1387. /// <param name="ce"></param>
  1388. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  1389. {
  1390. }
  1391. /// <summary>
  1392. /// 初始化其他控件
  1393. /// </summary>
  1394. private void InitOtherTools()
  1395. {
  1396. //
  1397. //初始化图像控件
  1398. //
  1399. this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
  1400. this.documentWorkspace.Dock = DockStyle.Fill;
  1401. this.documentWorkspace.HookMouseEvents();
  1402. this.documentWorkspace.AuxiliaryLineEnabled = false;
  1403. this.documentWorkspace.Visible = false;
  1404. this.documentWorkspace.ActiveTool = DrawToolType.NullTool;
  1405. this.groupBox3.Controls.Add(documentWorkspace);
  1406. //
  1407. //初始化操作按钮
  1408. //
  1409. this.commonControlButtons = new CommonControlButtons();
  1410. this.commonControlButtons.Dock = DockStyle.Top;
  1411. this.commonControlButtons.Height = 30;
  1412. this.commonControlButtons.HideZoomToWindowAndActualSize();
  1413. this.commonControlButtons.Visible = false;
  1414. this.groupBox3.Controls.Add(commonControlButtons);
  1415. //二值化集成2
  1416. bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
  1417. binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text"), PdnResources.GetString("Menu.Particlescreening.text")}
  1418. , this.bc, this.appWorkspace, this.documentWorkspace, this.listView1);//初始化相的工作结构
  1419. binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
  1420. //
  1421. //调色板
  1422. //
  1423. //this.colorsForm1 = new ColorsForm();
  1424. //this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
  1425. //this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  1426. //
  1427. //调色板
  1428. //
  1429. this.colorsForm1 = new ColorsForm();
  1430. this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
  1431. this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  1432. this.colorsFormGrid = new ColorsForm();
  1433. this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
  1434. this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
  1435. //
  1436. //颜色panel给定初始值
  1437. //
  1438. //this.panel1.BackColor = Color.Red;
  1439. //获取系统标尺-微米
  1440. //
  1441. //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength);
  1442. //
  1443. //获取系统标尺-放大倍数
  1444. //
  1445. if (this.documentWorkspace.GetGainMultiple() != 0)
  1446. {
  1447. multiple = double.Parse(this.documentWorkspace.GetGainMultiple().ToString());
  1448. }
  1449. }
  1450. //二值化集成3
  1451. #region 二值化相关方法
  1452. private void InclusionsStandardDialog_FormClosing(object sender, FormClosingEventArgs e)
  1453. {
  1454. #region [开启脚本录制]
  1455. if (appWorkspace.startScriptRecording)
  1456. {
  1457. getScriptRecording();
  1458. }
  1459. #endregion
  1460. this.saveDialogParamValues();
  1461. binaryClass.saveParams();
  1462. //xml保存路径
  1463. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  1464. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  1465. foreach (var analysisItem in this.analysisModel.ListParam)
  1466. {
  1467. bool foundItem = false;
  1468. foreach (var item in analysisModelXml.ListParam)
  1469. {
  1470. if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
  1471. {
  1472. item.param_value = analysisItem.param_value;
  1473. foundItem = true;
  1474. break;
  1475. }
  1476. }
  1477. if (!foundItem)
  1478. analysisModelXml.ListParam.Add(analysisItem.cloneModel());
  1479. }
  1480. //按路径和名称保存xml文件
  1481. string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
  1482. //保存xml
  1483. FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
  1484. }
  1485. private void ShownChoiseItemAndInitData(object sender, EventArgs e)
  1486. {
  1487. binaryClass.RefreshHistogramControl1Values();
  1488. }
  1489. /// <summary>
  1490. /// 添加参数改变的监听
  1491. /// </summary>
  1492. /// <param name="sender"></param>
  1493. /// <param name="e"></param>
  1494. private void GrainSizeDialog_Load(object sender, EventArgs e)
  1495. {
  1496. this.binaryClass.loadParams();
  1497. }
  1498. private bool bcBinaryChecked()
  1499. {
  1500. return bc != null && bc.BinaryChecked;
  1501. }
  1502. private bool bcOriginChecked()
  1503. {
  1504. return bc != null && bc.OriginChecked;
  1505. }
  1506. /// <summary>
  1507. /// Panel2的调色板颜色改变
  1508. /// </summary>
  1509. /// <param name="sender"></param>
  1510. /// <param name="e"></param>
  1511. private void gridColorChanged(object sender, EventArgs e)
  1512. {
  1513. this.colorsForm1.Close();
  1514. changeColor = true;
  1515. //ReLoadBinarization();
  1516. this.documentWorkspace.Refresh();
  1517. }
  1518. /// <summary>
  1519. /// 参数改变时,重新处理图像
  1520. /// </summary>
  1521. /// <param name="sender"></param>
  1522. /// <param name="e"></param>
  1523. private void bClassBinaryImplFinishAction(object sender, EventArgs e)
  1524. {
  1525. if (phaseModel != null)
  1526. {
  1527. sum++;
  1528. this.documentWorkspace.PhaseModels[0].choise = false;
  1529. if (bcBinaryChecked())
  1530. {
  1531. if (bcOriginChecked())
  1532. {
  1533. phaseModel.choise = false;
  1534. }
  1535. else
  1536. {
  1537. phaseModel.choise = true;
  1538. }
  1539. binarizationMat = this.documentWorkspace.PhaseModels[0].mat;
  1540. //changeColor = false;
  1541. ResetAreaAndContent();
  1542. ReloadDebrisSelection();
  1543. //appCommonDisplay.DisplayData(this.dataGridView1, true);
  1544. }
  1545. else
  1546. {
  1547. phaseModel.choise = false;
  1548. if (this.checkBox5.Checked)
  1549. {
  1550. this.documentWorkspace.panel.Paint -= new PaintEventHandler(this.BoxPaintHandler);
  1551. }
  1552. appCommonDisplay.DisplayData(this.dataGridView1, false);
  1553. }
  1554. this.documentWorkspace.Refresh();
  1555. }
  1556. else
  1557. {
  1558. //MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  1559. }
  1560. }
  1561. AppCommon appCommonDisplay = new AppCommon();
  1562. /// <summary>
  1563. /// 显示原图/原图+二值图
  1564. /// </summary>
  1565. /// <param name="sender"></param>
  1566. /// <param name="e"></param>
  1567. private void bcOriginCheckedChanged(object sender, EventArgs e)
  1568. {
  1569. if (phaseModel != null)
  1570. {
  1571. this.documentWorkspace.PhaseModels[0].choise = false;
  1572. if (!bcBinaryChecked())
  1573. {
  1574. phaseModel.choise = false;
  1575. appCommonDisplay.DisplayData(this.dataGridView1, false);
  1576. }
  1577. else
  1578. {
  1579. if (bcOriginChecked())
  1580. {
  1581. phaseModel.choise = false;
  1582. if (this.checkBox5.Checked)
  1583. {
  1584. this.documentWorkspace.panel.Paint -= new PaintEventHandler(this.BoxPaintHandler);
  1585. }
  1586. appCommonDisplay.DisplayData(this.dataGridView1, false);
  1587. }
  1588. else
  1589. {
  1590. phaseModel.choise = true;
  1591. if (this.checkBox5.Checked)
  1592. {
  1593. this.documentWorkspace.panel.Paint += new PaintEventHandler(this.BoxPaintHandler);
  1594. }
  1595. appCommonDisplay.DisplayData(this.dataGridView1, true);
  1596. }
  1597. }
  1598. this.documentWorkspace.Refresh();
  1599. }
  1600. else
  1601. {
  1602. //MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  1603. }
  1604. }
  1605. #endregion
  1606. /// <summary>
  1607. /// 初始化图片列表数据
  1608. /// </summary>
  1609. public void InitPicList()
  1610. {
  1611. //初始化图片列表
  1612. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  1613. {
  1614. this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  1615. this.listView1.Items.Add("", i);
  1616. this.listView1.Items[i].ImageIndex = i;
  1617. this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  1618. this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  1619. if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
  1620. {
  1621. defaultIndex = i;
  1622. }
  1623. }
  1624. this.Shown += ShowImgEvent;
  1625. }
  1626. /// <summary>
  1627. /// 颜色设置设置按钮
  1628. /// </summary>
  1629. /// <param name="sender"></param>
  1630. /// <param name="e"></param>
  1631. private void btnColour_Click(object sender, EventArgs e)
  1632. {
  1633. ColorSetting colorSetting = new ColorSetting();
  1634. colorSetting.ShowDialog();
  1635. }
  1636. /// <summary>
  1637. /// 显示参数设置按钮
  1638. /// </summary>
  1639. /// <param name="sender"></param>
  1640. /// <param name="e"></param>
  1641. private void btnDisplay_Click(object sender, EventArgs e)
  1642. {
  1643. DisplaySetting displaySetting = new DisplaySetting();
  1644. displaySetting.ShowDialog();
  1645. }
  1646. /// <summary>
  1647. /// 设置按钮
  1648. /// </summary>
  1649. /// <param name="sender"></param>
  1650. /// <param name="e"></param>
  1651. private void btnSetUp_Click(object sender, EventArgs e)
  1652. {
  1653. AnalyzeSettingDialog metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.DeterminationGBT11354Level");
  1654. if (metallographicMethodSetDialog.hasModule)
  1655. {
  1656. metallographicMethodSetDialog.StartPosition = FormStartPosition.CenterScreen;
  1657. metallographicMethodSetDialog.ShowDialog();
  1658. }
  1659. else
  1660. {
  1661. metallographicMethodSetDialog = null;
  1662. }
  1663. }
  1664. /// <summary>
  1665. /// 图像索引切换选中事件
  1666. /// </summary>
  1667. /// <param name="sender"></param>
  1668. /// <param name="e"></param>
  1669. double picArea = 0;//图片面积
  1670. int sum;//判断是否二值过
  1671. private void listView1_SelectedIndexChanged(object sender, EventArgs e)
  1672. {
  1673. if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
  1674. {
  1675. unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
  1676. sum = 0;
  1677. if (this.checkBox5.Checked)
  1678. {
  1679. this.documentWorkspace.panel.Paint -= new PaintEventHandler(this.BoxPaintHandler);
  1680. }
  1681. this.dataGridView1.Rows.Clear();
  1682. this.documentWorkspace.PhaseModels.Clear();
  1683. this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList;
  1684. this.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
  1685. //总面积
  1686. picArea = AnalysisTools.GetPointsFromMat(this.imageMat.Clone());
  1687. changeColor = false;
  1688. phaseModel = new PhaseModel();//同上
  1689. phaseModel.choise = true;
  1690. //二值化集成4
  1691. binaryClass.listView1_SelectedIndexChanged(this.imageMat.Clone(), this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]);
  1692. //binaryClass.listView1_SelectedIndexChanged(this.bitmap, this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]);
  1693. //binaryClass.listView1_SelectedIndexChangedNoCheckedChanged(this.bitmap);
  1694. this.documentWorkspace.PhaseModels[0].choise = false;
  1695. if (binaryClass.getModelMat(this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]) != null)
  1696. {
  1697. this.binarizationMat = binaryClass.getModelMat(this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]).Clone();
  1698. }
  1699. else
  1700. {
  1701. if (this.documentWorkspace.PhaseModels[0].mat == null)
  1702. {
  1703. this.binarizationMat = new Mat();
  1704. }
  1705. else
  1706. {
  1707. this.binarizationMat = this.documentWorkspace.PhaseModels[0].mat.Clone();
  1708. }
  1709. }
  1710. this.documentWorkspace.phaseModels.Add(phaseModel);
  1711. if (sum == 0)
  1712. {
  1713. if (bcOriginChecked())
  1714. {
  1715. phaseModel.choise = false;
  1716. }
  1717. ResetAreaAndContent();
  1718. ReloadDebrisSelection();
  1719. }
  1720. else
  1721. {
  1722. if (bcOriginChecked())
  1723. {
  1724. phaseModel.choise = false;
  1725. }
  1726. else
  1727. {
  1728. phaseModel.choise = true;
  1729. }
  1730. this.documentWorkspace.Refresh();
  1731. }
  1732. sum = 0;
  1733. ////总面积
  1734. //picArea = AnalysisTools.GetPointsFromMat(this.imageMat.Clone());
  1735. //changeColor = false;
  1736. }
  1737. }
  1738. Mat temp;//中间变量
  1739. List<List<OpenCvSharp.Point>> ps;//轮廓的拓扑信息
  1740. List<double> lstEqualDiameter;
  1741. DataTable dtDataGridView1 = null;
  1742. DataTable dtResult = null;
  1743. AppCommon appCommon;
  1744. List<double> lstCarbideArea;//组织分级面积集合
  1745. List<double> lstCarbideAreaRatio;//组织分级面积率集合
  1746. /// <summary>
  1747. /// 刷新颗粒筛选颜色面积率效果
  1748. /// </summary>
  1749. private void ReloadDebrisSelection()
  1750. {
  1751. if (binarizationMat != null && bcBinaryChecked())
  1752. {
  1753. this.dataGridView1.Rows.Clear();
  1754. appCommon = new AppCommon();
  1755. dtDataGridView1 = new DataTable();
  1756. //记录条件范围内石墨
  1757. lstPoint08_1 = new List<List<OpenCvSharp.Point>>();
  1758. lstPoint06_08 = new List<List<OpenCvSharp.Point>>();
  1759. lstPoint04_06 = new List<List<OpenCvSharp.Point>>();
  1760. lstPoint02_04 = new List<List<OpenCvSharp.Point>>();
  1761. lstPoint01_02 = new List<List<OpenCvSharp.Point>>();
  1762. lstPoint0_01 = new List<List<OpenCvSharp.Point>>();
  1763. //记录上个视场内石墨个数
  1764. int prevLstPoint08_1 = 0;
  1765. int prevLstPoint06_08 = 0;
  1766. int prevLstPoint04_06 = 0;
  1767. int prevLstPoint02_04 = 0;
  1768. int prevLstPoint01_02 = 0;
  1769. int prevLstPoint0_01 = 0;
  1770. //记录视场珠光体含量总和
  1771. double carbideNumSum = 0;
  1772. double sumSpheroidizationAreaRate = 0;//石墨含量总和
  1773. lstEqualDiameter = new List<double>();//大于20um等积圆直径集合
  1774. lstCarbideArea = new List<double>();//组织分级面积集合
  1775. lstCarbideAreaRatio = new List<double>();//组织分级面积率集合
  1776. ps = new List<List<OpenCvSharp.Point>>();//轮廓的拓扑信息
  1777. pointList.Clear();
  1778. leList.Clear();
  1779. temp = new Mat();
  1780. if (this.documentWorkspace.GraphicsList.IsExsitView())
  1781. {
  1782. List<OpenCvSharp.Point[][]> points = new List<OpenCvSharp.Point[][]>();//各石墨轮廓集合
  1783. List<List<int>> lstAttribute = new List<List<int>>();//各个视场属性集合,索引0-横坐标,1-纵坐标,2-视场宽度,3-视场高度,4-视场面积
  1784. int sumFieldl = 0; //视场个数
  1785. Mat tempCopy = BinaryClass.BGRA2GRAY(binarizationMat);
  1786. //调用处理视场方法
  1787. appCommon.MultiFieldView(appWorkspace, binarizationMat, listView1, documentWorkspace, out points, out lstAttribute, out sumFieldl);
  1788. int h = 0;
  1789. foreach (OpenCvSharp.Point[][] contours in points)
  1790. {
  1791. h++;
  1792. double spheroidizationSum = 0;//石墨个数
  1793. double totalSum = 0;//石墨总数
  1794. double totalAreaSum = 0;//面积总数
  1795. double screenArea = 0;//筛选的面积
  1796. //Mat tempCopy;
  1797. Rect rectCopy;
  1798. for (int i = 0; i < contours.Length; i++)
  1799. {
  1800. for (int f = 0; f < contours[i].Length; f++)
  1801. {
  1802. contours[i][f].X = contours[i][f].X + lstAttribute[h - 1][0];
  1803. contours[i][f].Y = contours[i][f].Y + lstAttribute[h - 1][1];
  1804. }
  1805. double radius; //外接圆半径
  1806. //tempCopy = BinaryClass.BGRA2GRAY(binarizationMat);
  1807. int length = Cv2.FloodFill(tempCopy, contours[i][0], new Scalar(0, 0, 0, 0), out rectCopy, null, null, FloodFillFlags.Link8);
  1808. double area = length;
  1809. double equalDiameter = Math.Sqrt(area / Math.PI) * 2 * unitLength;
  1810. if (this.checkBox3.Checked)
  1811. {
  1812. if (this.checkBox6.Checked)
  1813. {
  1814. if (equalDiameter < 20)
  1815. {
  1816. ps.Add(contours[i].ToList());
  1817. continue;
  1818. }
  1819. if (area >= (this.trackBar2.Value / (unitLength * unitLength)) && area <= (this.trackBar4.Value / (unitLength * unitLength)))
  1820. {
  1821. ps.Add(contours[i].ToList());
  1822. }
  1823. else
  1824. {
  1825. if (contours[i].Length < 5)
  1826. {
  1827. continue;
  1828. }
  1829. else
  1830. {
  1831. OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
  1832. radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
  1833. double outerCircle = radius * radius * Math.PI;//外接圆面积
  1834. double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
  1835. if (areaRatio > 0 && areaRatio <= 1)
  1836. {
  1837. totalAreaSum += area;
  1838. totalSum++;
  1839. lstEqualDiameter.Add(equalDiameter);
  1840. if (this.checkBox2.Checked)
  1841. {
  1842. if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
  1843. {
  1844. spheroidizationSum++;
  1845. screenArea += area;
  1846. }
  1847. else
  1848. {
  1849. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  1850. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  1851. }
  1852. }
  1853. else
  1854. {
  1855. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  1856. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  1857. }
  1858. pointList.Add(contours[i][0]);
  1859. leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
  1860. areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
  1861. if (areaRatio > 0.8 && areaRatio <= 1)
  1862. {
  1863. lstPoint08_1.Add(contours[i].ToList());
  1864. }
  1865. else if (areaRatio > 0.6 && areaRatio <= 0.8)
  1866. {
  1867. lstPoint06_08.Add(contours[i].ToList());
  1868. }
  1869. else if (areaRatio > 0.4 && areaRatio <= 0.6)
  1870. {
  1871. lstPoint04_06.Add(contours[i].ToList());
  1872. }
  1873. else if (areaRatio > 0.2 && areaRatio <= 0.4)
  1874. {
  1875. lstPoint02_04.Add(contours[i].ToList());
  1876. }
  1877. else if (areaRatio > 0.1 && areaRatio <= 0.2)
  1878. {
  1879. lstPoint01_02.Add(contours[i].ToList());
  1880. }
  1881. else if (areaRatio > 0 && areaRatio <= 0.1)
  1882. {
  1883. lstPoint0_01.Add(contours[i].ToList());
  1884. }
  1885. }
  1886. else
  1887. {
  1888. ps.Add(contours[i].ToList());
  1889. }
  1890. }
  1891. }
  1892. }
  1893. else
  1894. {
  1895. if (area >= (this.trackBar2.Value / (unitLength * unitLength)) && area <= (this.trackBar4.Value / (unitLength * unitLength)))
  1896. {
  1897. ps.Add(contours[i].ToList());
  1898. }
  1899. else
  1900. {
  1901. if (contours[i].Length < 5)
  1902. {
  1903. continue;
  1904. }
  1905. else
  1906. {
  1907. OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
  1908. radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
  1909. double outerCircle = radius * radius * Math.PI;//外接圆面积
  1910. double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
  1911. if (areaRatio > 0 && areaRatio <= 1)
  1912. {
  1913. lstEqualDiameter.Add(equalDiameter);
  1914. totalAreaSum += area;
  1915. totalSum++;
  1916. if (this.checkBox2.Checked)
  1917. {
  1918. if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
  1919. {
  1920. spheroidizationSum++;
  1921. screenArea += area;
  1922. }
  1923. else
  1924. {
  1925. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  1926. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  1927. }
  1928. }
  1929. else
  1930. {
  1931. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  1932. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  1933. }
  1934. pointList.Add(contours[i][0]);
  1935. leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
  1936. areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
  1937. if (areaRatio > 0.8 && areaRatio <= 1)
  1938. {
  1939. lstPoint08_1.Add(contours[i].ToList());
  1940. }
  1941. else if (areaRatio > 0.6 && areaRatio <= 0.8)
  1942. {
  1943. lstPoint06_08.Add(contours[i].ToList());
  1944. }
  1945. else if (areaRatio > 0.4 && areaRatio <= 0.6)
  1946. {
  1947. lstPoint04_06.Add(contours[i].ToList());
  1948. }
  1949. else if (areaRatio > 0.2 && areaRatio <= 0.4)
  1950. {
  1951. lstPoint02_04.Add(contours[i].ToList());
  1952. }
  1953. else if (areaRatio > 0.1 && areaRatio <= 0.2)
  1954. {
  1955. lstPoint01_02.Add(contours[i].ToList());
  1956. }
  1957. else if (areaRatio > 0 && areaRatio <= 0.1)
  1958. {
  1959. lstPoint0_01.Add(contours[i].ToList());
  1960. }
  1961. }
  1962. else
  1963. {
  1964. ps.Add(contours[i].ToList());
  1965. }
  1966. }
  1967. }
  1968. }
  1969. }
  1970. else
  1971. {
  1972. if (this.checkBox6.Checked)
  1973. {
  1974. if (equalDiameter < 20)
  1975. {
  1976. ps.Add(contours[i].ToList());
  1977. }
  1978. }
  1979. if (contours[i].Length < 5)
  1980. continue;
  1981. else
  1982. {
  1983. if (this.checkBox6.Checked)
  1984. {
  1985. //if (equalDiameter < 20)
  1986. //{
  1987. // ps.Add(contours[i].ToList());
  1988. //}
  1989. if (equalDiameter >= 20)
  1990. {
  1991. OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
  1992. radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
  1993. double outerCircle = radius * radius * Math.PI;//外接圆面积
  1994. double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
  1995. if (areaRatio > 0 && areaRatio <= 1)
  1996. {
  1997. lstEqualDiameter.Add(equalDiameter);
  1998. totalAreaSum += area;
  1999. totalSum++;
  2000. if (this.checkBox2.Checked)
  2001. {
  2002. if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
  2003. {
  2004. spheroidizationSum++;
  2005. screenArea += area;
  2006. }
  2007. else
  2008. {
  2009. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  2010. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  2011. }
  2012. }
  2013. else
  2014. {
  2015. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  2016. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  2017. }
  2018. pointList.Add(contours[i][0]);
  2019. leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
  2020. areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
  2021. if (areaRatio > 0.8 && areaRatio <= 1)
  2022. {
  2023. lstPoint08_1.Add(contours[i].ToList());
  2024. }
  2025. else if (areaRatio > 0.6 && areaRatio <= 0.8)
  2026. {
  2027. lstPoint06_08.Add(contours[i].ToList());
  2028. }
  2029. else if (areaRatio > 0.4 && areaRatio <= 0.6)
  2030. {
  2031. lstPoint04_06.Add(contours[i].ToList());
  2032. }
  2033. else if (areaRatio > 0.2 && areaRatio <= 0.4)
  2034. {
  2035. lstPoint02_04.Add(contours[i].ToList());
  2036. }
  2037. else if (areaRatio > 0.1 && areaRatio <= 0.2)
  2038. {
  2039. lstPoint01_02.Add(contours[i].ToList());
  2040. }
  2041. else if (areaRatio > 0 && areaRatio <= 0.1)
  2042. {
  2043. lstPoint0_01.Add(contours[i].ToList());
  2044. }
  2045. }
  2046. else
  2047. {
  2048. ps.Add(contours[i].ToList());
  2049. }
  2050. }
  2051. }
  2052. else
  2053. {
  2054. OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
  2055. radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
  2056. double outerCircle = radius * radius * Math.PI;//外接圆面积
  2057. double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
  2058. if (areaRatio > 0 && areaRatio <= 1)
  2059. {
  2060. lstEqualDiameter.Add(equalDiameter);
  2061. totalAreaSum += area;
  2062. totalSum++;
  2063. if (this.checkBox2.Checked)
  2064. {
  2065. if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
  2066. {
  2067. spheroidizationSum++;
  2068. screenArea += area;
  2069. }
  2070. else
  2071. {
  2072. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  2073. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  2074. }
  2075. }
  2076. else
  2077. {
  2078. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  2079. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  2080. }
  2081. pointList.Add(contours[i][0]);
  2082. leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
  2083. areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
  2084. if (areaRatio > 0.8 && areaRatio <= 1)
  2085. {
  2086. lstPoint08_1.Add(contours[i].ToList());
  2087. }
  2088. else if (areaRatio > 0.6 && areaRatio <= 0.8)
  2089. {
  2090. lstPoint06_08.Add(contours[i].ToList());
  2091. }
  2092. else if (areaRatio > 0.4 && areaRatio <= 0.6)
  2093. {
  2094. lstPoint04_06.Add(contours[i].ToList());
  2095. }
  2096. else if (areaRatio > 0.2 && areaRatio <= 0.4)
  2097. {
  2098. lstPoint02_04.Add(contours[i].ToList());
  2099. }
  2100. else if (areaRatio > 0.1 && areaRatio <= 0.2)
  2101. {
  2102. lstPoint01_02.Add(contours[i].ToList());
  2103. }
  2104. else if (areaRatio > 0 && areaRatio <= 0.1)
  2105. {
  2106. lstPoint0_01.Add(contours[i].ToList());
  2107. }
  2108. }
  2109. else
  2110. {
  2111. ps.Add(contours[i].ToList());
  2112. }
  2113. }
  2114. }
  2115. }
  2116. }
  2117. if (pointList.Count > 0)
  2118. {
  2119. //spheroidizationRate = spheroidizationSum / totalSum;//球化率
  2120. //spheroidizationAreaRate = totalAreaSum / lstAttribute[h - 1][4];//石墨含量
  2121. string level = string.Empty; //组织级别
  2122. double carbideNum = (totalAreaSum - screenArea) / (lstAttribute[h - 1][4] - screenArea); //组织级别数量
  2123. if (carbideNum < 0.01)
  2124. {
  2125. level = "1";
  2126. }
  2127. else if (carbideNum >= 0.01 && carbideNum < 0.05)
  2128. {
  2129. level = "2";
  2130. }
  2131. else if (carbideNum >= 0.05 && carbideNum < 0.15)
  2132. {
  2133. level = "3";
  2134. }
  2135. else if (carbideNum >= 0.15 && carbideNum < 0.25)
  2136. {
  2137. level = "4";
  2138. }
  2139. else if (carbideNum >= 0.25)
  2140. {
  2141. level = "5";
  2142. }
  2143. else
  2144. {
  2145. level = "-";
  2146. }
  2147. this.dataGridView1.Rows.Add($"{PdnResources.GetString("Menu.view.text")}{h}", lstPoint08_1.Count - prevLstPoint08_1, lstPoint06_08.Count - prevLstPoint06_08, lstPoint04_06.Count - prevLstPoint04_06, lstPoint02_04.Count - prevLstPoint02_04, lstPoint01_02.Count - prevLstPoint01_02, lstPoint0_01.Count - prevLstPoint0_01, carbideNum * 100, level);
  2148. carbideNumSum += carbideNum;
  2149. //sumSpheroidizationAreaRate += spheroidizationAreaRate;//石墨含量总和
  2150. prevLstPoint08_1 = lstPoint08_1.Count;
  2151. prevLstPoint06_08 = lstPoint06_08.Count;
  2152. prevLstPoint04_06 = lstPoint04_06.Count;
  2153. prevLstPoint02_04 = lstPoint02_04.Count;
  2154. prevLstPoint01_02 = lstPoint01_02.Count;
  2155. prevLstPoint0_01 = lstPoint0_01.Count;
  2156. }
  2157. }
  2158. if (sumFieldl > 1 && pointList.Count > 0)
  2159. {
  2160. string avgLevel = string.Empty;
  2161. double avgCarbideNum = carbideNumSum / sumFieldl;
  2162. if (avgCarbideNum < 0.01)
  2163. {
  2164. avgLevel = "1";
  2165. }
  2166. else if (avgCarbideNum >= 0.01 && avgCarbideNum < 0.05)
  2167. {
  2168. avgLevel = "2";
  2169. }
  2170. else if (avgCarbideNum >= 0.05 && avgCarbideNum < 0.15)
  2171. {
  2172. avgLevel = "3";
  2173. }
  2174. else if (avgCarbideNum >= 0.15 && avgCarbideNum < 0.25)
  2175. {
  2176. avgLevel = "4";
  2177. }
  2178. else if (avgCarbideNum >= 0.25)
  2179. {
  2180. avgLevel = "5";
  2181. }
  2182. else
  2183. {
  2184. avgLevel = "-";
  2185. }
  2186. this.dataGridView1.Rows.Add(PdnResources.GetString("Menu.Image.Average.Text"), (double)prevLstPoint08_1 / sumFieldl, (double)prevLstPoint06_08 / sumFieldl, (double)prevLstPoint04_06 / sumFieldl, (double)prevLstPoint02_04 / sumFieldl, (double)prevLstPoint01_02 / sumFieldl, (double)prevLstPoint0_01 / sumFieldl, 100 * avgCarbideNum, avgLevel);
  2187. }
  2188. }
  2189. else
  2190. {
  2191. OpenCvSharp.Point[][] contours;//原始轮廓信息
  2192. HierarchyIndex[] hierachy;
  2193. Mat tempCopy = BinaryClass.BGRA2GRAY(binarizationMat);
  2194. Rect rectCopy;
  2195. Cv2.FindContours(BinaryClass.BGRA2GRAY(binarizationMat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone);
  2196. double spheroidizationSum = 0;//石墨个数
  2197. double totalSum = 0;//石墨总数
  2198. double totalAreaSum = 0;//面积总数
  2199. double screenArea = 0;
  2200. for (int i = 0; i < hierachy.Length; i++)
  2201. {
  2202. if (hierachy[i].Parent == -1)
  2203. {
  2204. double radius; //外接圆半径
  2205. //tempCopy = BinaryClass.BGRA2GRAY(binarizationMat);
  2206. //int length = Cv2.FloodFill(temp1234, contours[i][0], new Scalar(0, 0, 0) );
  2207. //int length = Cv2.FloodFill(tempCopy, contours[i][0], new Scalar(0, 0, 0, 0), out rectCopy, null, null, FloodFillFlags.Link8);
  2208. double area = appCommon.Area(tempCopy, contours[i][0]);
  2209. double equalDiameter = Math.Sqrt(area / Math.PI) * 2 * unitLength;
  2210. if (this.checkBox3.Checked)
  2211. {
  2212. if (this.checkBox6.Checked)
  2213. {
  2214. if (equalDiameter < 20)
  2215. {
  2216. ps.Add(contours[i].ToList());
  2217. continue;
  2218. }
  2219. if (area >= (this.trackBar2.Value / (unitLength * unitLength)) && area <= (this.trackBar4.Value / (unitLength * unitLength)))
  2220. {
  2221. ps.Add(contours[i].ToList());
  2222. }
  2223. else
  2224. {
  2225. if (contours[i].Length < 5)
  2226. {
  2227. continue;
  2228. }
  2229. else
  2230. {
  2231. OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
  2232. radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
  2233. double outerCircle = radius * radius * Math.PI;//外接圆面积
  2234. double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
  2235. if (areaRatio > 0 && areaRatio <= 1)
  2236. {
  2237. totalAreaSum += area;
  2238. totalSum++;
  2239. lstEqualDiameter.Add(equalDiameter);
  2240. if (this.checkBox2.Checked)
  2241. {
  2242. if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
  2243. {
  2244. spheroidizationSum++;
  2245. screenArea += area;
  2246. }
  2247. else
  2248. {
  2249. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  2250. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  2251. }
  2252. }
  2253. else
  2254. {
  2255. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  2256. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  2257. }
  2258. pointList.Add(contours[i][0]);
  2259. leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
  2260. areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
  2261. if (areaRatio > 0.8 && areaRatio <= 1)
  2262. {
  2263. lstPoint08_1.Add(contours[i].ToList());
  2264. }
  2265. else if (areaRatio > 0.6 && areaRatio <= 0.8)
  2266. {
  2267. lstPoint06_08.Add(contours[i].ToList());
  2268. }
  2269. else if (areaRatio > 0.4 && areaRatio <= 0.6)
  2270. {
  2271. lstPoint04_06.Add(contours[i].ToList());
  2272. }
  2273. else if (areaRatio > 0.2 && areaRatio <= 0.4)
  2274. {
  2275. lstPoint02_04.Add(contours[i].ToList());
  2276. }
  2277. else if (areaRatio > 0.1 && areaRatio <= 0.2)
  2278. {
  2279. lstPoint01_02.Add(contours[i].ToList());
  2280. }
  2281. else if (areaRatio > 0 && areaRatio <= 0.1)
  2282. {
  2283. lstPoint0_01.Add(contours[i].ToList());
  2284. }
  2285. }
  2286. else
  2287. {
  2288. ps.Add(contours[i].ToList());
  2289. }
  2290. }
  2291. }
  2292. }
  2293. else
  2294. {
  2295. if (area >= (this.trackBar2.Value / (unitLength * unitLength)) && area <= (this.trackBar4.Value / (unitLength * unitLength)))
  2296. {
  2297. ps.Add(contours[i].ToList());
  2298. }
  2299. else
  2300. {
  2301. if (contours[i].Length < 5)
  2302. {
  2303. continue;
  2304. }
  2305. else
  2306. {
  2307. OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
  2308. radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
  2309. double outerCircle = radius * radius * Math.PI;//外接圆面积
  2310. double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
  2311. if (areaRatio > 0 && areaRatio <= 1)
  2312. {
  2313. lstEqualDiameter.Add(equalDiameter);
  2314. totalAreaSum += area;
  2315. totalSum++;
  2316. if (this.checkBox2.Checked)
  2317. {
  2318. if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
  2319. {
  2320. spheroidizationSum++;
  2321. screenArea += area;
  2322. }
  2323. else
  2324. {
  2325. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  2326. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  2327. }
  2328. }
  2329. else
  2330. {
  2331. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  2332. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  2333. }
  2334. pointList.Add(contours[i][0]);
  2335. leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
  2336. areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
  2337. if (areaRatio > 0.8 && areaRatio <= 1)
  2338. {
  2339. lstPoint08_1.Add(contours[i].ToList());
  2340. }
  2341. else if (areaRatio > 0.6 && areaRatio <= 0.8)
  2342. {
  2343. lstPoint06_08.Add(contours[i].ToList());
  2344. }
  2345. else if (areaRatio > 0.4 && areaRatio <= 0.6)
  2346. {
  2347. lstPoint04_06.Add(contours[i].ToList());
  2348. }
  2349. else if (areaRatio > 0.2 && areaRatio <= 0.4)
  2350. {
  2351. lstPoint02_04.Add(contours[i].ToList());
  2352. }
  2353. else if (areaRatio > 0.1 && areaRatio <= 0.2)
  2354. {
  2355. lstPoint01_02.Add(contours[i].ToList());
  2356. }
  2357. else if (areaRatio > 0 && areaRatio <= 0.1)
  2358. {
  2359. lstPoint0_01.Add(contours[i].ToList());
  2360. }
  2361. }
  2362. else
  2363. {
  2364. ps.Add(contours[i].ToList());
  2365. }
  2366. }
  2367. }
  2368. }
  2369. }
  2370. else
  2371. {
  2372. if (this.checkBox6.Checked)
  2373. {
  2374. if (equalDiameter < 20)
  2375. {
  2376. ps.Add(contours[i].ToList());
  2377. }
  2378. }
  2379. if (contours[i].Length < 5)
  2380. continue;
  2381. else
  2382. {
  2383. if (this.checkBox6.Checked)
  2384. {
  2385. //if (equalDiameter < 20)
  2386. //{
  2387. // ps.Add(contours[i].ToList());
  2388. //}
  2389. if (equalDiameter >= 20)
  2390. {
  2391. OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
  2392. radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
  2393. double outerCircle = radius * radius * Math.PI;//外接圆面积
  2394. double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
  2395. if (areaRatio > 0 && areaRatio <= 1)
  2396. {
  2397. lstEqualDiameter.Add(equalDiameter);
  2398. totalAreaSum += area;
  2399. totalSum++;
  2400. if (this.checkBox2.Checked)
  2401. {
  2402. if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
  2403. {
  2404. spheroidizationSum++;
  2405. screenArea += area;
  2406. }
  2407. else
  2408. {
  2409. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  2410. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  2411. }
  2412. }
  2413. else
  2414. {
  2415. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  2416. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  2417. }
  2418. pointList.Add(contours[i][0]);
  2419. leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
  2420. areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
  2421. if (areaRatio > 0.8 && areaRatio <= 1)
  2422. {
  2423. lstPoint08_1.Add(contours[i].ToList());
  2424. }
  2425. else if (areaRatio > 0.6 && areaRatio <= 0.8)
  2426. {
  2427. lstPoint06_08.Add(contours[i].ToList());
  2428. }
  2429. else if (areaRatio > 0.4 && areaRatio <= 0.6)
  2430. {
  2431. lstPoint04_06.Add(contours[i].ToList());
  2432. }
  2433. else if (areaRatio > 0.2 && areaRatio <= 0.4)
  2434. {
  2435. lstPoint02_04.Add(contours[i].ToList());
  2436. }
  2437. else if (areaRatio > 0.1 && areaRatio <= 0.2)
  2438. {
  2439. lstPoint01_02.Add(contours[i].ToList());
  2440. }
  2441. else if (areaRatio > 0 && areaRatio <= 0.1)
  2442. {
  2443. lstPoint0_01.Add(contours[i].ToList());
  2444. }
  2445. }
  2446. else
  2447. {
  2448. ps.Add(contours[i].ToList());
  2449. }
  2450. }
  2451. }
  2452. else
  2453. {
  2454. //OpenCvSharp.RotatedRect rect = OpenCvSharp.Cv2.FitEllipse(contours[i]);
  2455. radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
  2456. double outerCircle = radius * radius * Math.PI;//外接圆面积
  2457. double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
  2458. if (areaRatio > 0 && areaRatio <= 1)
  2459. {
  2460. lstEqualDiameter.Add(equalDiameter);
  2461. totalAreaSum += area;
  2462. totalSum++;
  2463. if (this.checkBox2.Checked)
  2464. {
  2465. if (areaRatio * 100 >= this.trackBar5.Value && areaRatio * 100 <= this.trackBar6.Value)
  2466. {
  2467. spheroidizationSum++;
  2468. screenArea += area;
  2469. }
  2470. else
  2471. {
  2472. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  2473. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  2474. }
  2475. }
  2476. else
  2477. {
  2478. lstCarbideArea.Add(area * unitLength * unitLength);//组织级别面积集合
  2479. lstCarbideAreaRatio.Add(areaRatio);//组织级别面积率集合
  2480. }
  2481. pointList.Add(contours[i][0]);
  2482. leList.Add(Math.Round(double.Parse(string.IsNullOrEmpty(areaRatio.ToString()) ? "0" :
  2483. areaRatio.ToString()), Convert.ToInt32(this.numericUpDown1.Value)));
  2484. if (areaRatio > 0.8 && areaRatio <= 1)
  2485. {
  2486. lstPoint08_1.Add(contours[i].ToList());
  2487. }
  2488. else if (areaRatio > 0.6 && areaRatio <= 0.8)
  2489. {
  2490. lstPoint06_08.Add(contours[i].ToList());
  2491. }
  2492. else if (areaRatio > 0.4 && areaRatio <= 0.6)
  2493. {
  2494. lstPoint04_06.Add(contours[i].ToList());
  2495. }
  2496. else if (areaRatio > 0.2 && areaRatio <= 0.4)
  2497. {
  2498. lstPoint02_04.Add(contours[i].ToList());
  2499. }
  2500. else if (areaRatio > 0.1 && areaRatio <= 0.2)
  2501. {
  2502. lstPoint01_02.Add(contours[i].ToList());
  2503. }
  2504. else if (areaRatio > 0 && areaRatio <= 0.1)
  2505. {
  2506. lstPoint0_01.Add(contours[i].ToList());
  2507. }
  2508. }
  2509. else
  2510. {
  2511. ps.Add(contours[i].ToList());
  2512. }
  2513. }
  2514. }
  2515. }
  2516. }
  2517. }
  2518. //spheroidizationRate = spheroidizationSum / totalSum;//球化率
  2519. //spheroidizationAreaRate = totalAreaSum / picArea;//石墨含量
  2520. string level = string.Empty; //球化级别
  2521. double carbideNum = (totalAreaSum - screenArea) / (picArea - screenArea); //组织级别数量
  2522. if (carbideNum < 0.01)
  2523. {
  2524. level = "1";
  2525. }
  2526. else if (carbideNum >= 0.01 && carbideNum < 0.05)
  2527. {
  2528. level = "2";
  2529. }
  2530. else if (carbideNum >= 0.05 && carbideNum < 0.15)
  2531. {
  2532. level = "3";
  2533. }
  2534. else if (carbideNum >= 0.15 && carbideNum < 0.25)
  2535. {
  2536. level = "4";
  2537. }
  2538. else if (carbideNum >= 0.25)
  2539. {
  2540. level = "5";
  2541. }
  2542. else
  2543. {
  2544. level = "-";
  2545. }
  2546. if (pointList.Count > 0)
  2547. {
  2548. this.dataGridView1.Rows.Add(PdnResources.GetString("Menu.view.text")+"1", lstPoint08_1.Count - prevLstPoint08_1, lstPoint06_08.Count - prevLstPoint06_08, lstPoint04_06.Count - prevLstPoint04_06, lstPoint02_04.Count - prevLstPoint02_04, lstPoint01_02.Count - prevLstPoint01_02, lstPoint0_01.Count - prevLstPoint0_01, carbideNum * 100, level);
  2549. }
  2550. }
  2551. binarizationMat.CopyTo(temp);
  2552. if (checkBox4.Checked)
  2553. {
  2554. DisplayColor();
  2555. }
  2556. if (checkBox5.Checked && !bcOriginChecked())
  2557. {
  2558. AddPictureBoxEvent();
  2559. }
  2560. Cv2.FillPoly(temp, ps, new Scalar(0, 0, 0, 0)); //筛选颜色
  2561. phaseModel.mat = temp;
  2562. //RefreshDataGridView1();
  2563. this.documentWorkspace.Refresh();
  2564. //数据结果保存
  2565. dtDataGridView1 = appCommon.ResultDataSaving(dataGridView1);
  2566. string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
  2567. string tag = this.imageList1.Images.Keys[this.listView1.FocusedItem.Index];
  2568. //dtResult = new DataTable(tag);
  2569. //分析数据保存
  2570. dtResult = appCommon.AnalysisDataSaving(dataGridView1, imgName, tag);
  2571. if (dtDataGridView1.Rows.Count > 0)
  2572. {
  2573. RefreshDataGridView1();
  2574. }
  2575. if (bcOriginChecked())
  2576. {
  2577. appCommonDisplay.DisplayData(this.dataGridView1, false);
  2578. }
  2579. }
  2580. }
  2581. /// <summary>
  2582. /// 显示不同颜色方法
  2583. /// </summary>
  2584. public void DisplayColor()
  2585. {
  2586. //填充颜色
  2587. if (this.checkBox4.Checked)
  2588. {
  2589. Mat[] arr = temp.Split();
  2590. temp = temp.CvtColor(ColorConversionCodes.BGRA2BGR);
  2591. appCommon.DifferentColor(temp, lstPoint08_1, colour, "panelColour1_08");
  2592. appCommon.DifferentColor(temp, lstPoint06_08, colour, "panelColour08_06");
  2593. appCommon.DifferentColor(temp, lstPoint04_06, colour, "panelColour06_04");
  2594. appCommon.DifferentColor(temp, lstPoint02_04, colour, "panelColour04_02");
  2595. appCommon.DifferentColor(temp, lstPoint01_02, colour, "panelColour02_01");
  2596. appCommon.DifferentColor(temp, lstPoint0_01, colour, "panelColour01_0");
  2597. Mat[] arr2 = temp.Split();
  2598. arr[0] = arr2[0];
  2599. arr[1] = arr2[1];
  2600. arr[2] = arr2[2];
  2601. Cv2.Merge(arr, temp);
  2602. phaseModel.mat = temp;
  2603. }
  2604. this.documentWorkspace.Refresh();
  2605. }
  2606. /// <summary>
  2607. /// 添加内容单元格
  2608. /// </summary>
  2609. /// <param name="text"></param>
  2610. /// <param name="tag"></param>
  2611. /// <returns></returns>
  2612. private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag)
  2613. {
  2614. DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
  2615. textboxcell.Value = text;
  2616. textboxcell.Tag = tag;
  2617. return textboxcell;
  2618. }
  2619. /// <summary>
  2620. /// 刷新其他信息
  2621. /// </summary>
  2622. private void ResetAreaAndContent()
  2623. {
  2624. if (binarizationMat != null && bcBinaryChecked())
  2625. {
  2626. OpenCvSharp.Point[][] contours;//原始轮廓信息
  2627. HierarchyIndex[] hierachy;
  2628. //Mat temp = new Mat();
  2629. //binarizationMat.CopyTo(temp);
  2630. Cv2.FindContours(BinaryClass.BGRA2GRAY(binarizationMat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone);
  2631. if (hierachy.Length > 0)
  2632. {
  2633. double maxArea = 0;//面积最大值
  2634. double minArea = 9999999999;//面积最小值
  2635. double maxAreaRatio = 0;//面积率最大值
  2636. double minAreaRatio = 100;//面积率最小值
  2637. double radius = 0;//外接圆半径
  2638. Mat tempCopy;
  2639. Rect rectCopy;
  2640. for (int i = 0; i < hierachy.Length; i++)
  2641. {
  2642. if (hierachy[i].Parent == -1)
  2643. {
  2644. tempCopy = BinaryClass.BGRA2GRAY(binarizationMat);
  2645. int length = Cv2.FloodFill(tempCopy, contours[i][0], new Scalar(0, 0, 0, 0), out rectCopy, null, null, FloodFillFlags.Link8);
  2646. double area = length;
  2647. if (maxArea < area)
  2648. maxArea = area;
  2649. if (minArea > area)
  2650. minArea = area;
  2651. if (contours[i].Length < 5)
  2652. continue;
  2653. else
  2654. {
  2655. radius = BasicCalculationHelper.CalcLongTrail(contours[i]);
  2656. double outerCircle = radius * radius * Math.PI;//外接圆面积
  2657. double areaRatio = (area - contours[i].Length / 2.0) / outerCircle;
  2658. if (areaRatio >= 0 && areaRatio <= 1)
  2659. {
  2660. if (maxAreaRatio < areaRatio * 100)
  2661. maxAreaRatio = areaRatio * 100;
  2662. if (minAreaRatio > areaRatio * 100)
  2663. minAreaRatio = areaRatio * 100;
  2664. }
  2665. }
  2666. }
  2667. }
  2668. //phaseModel.mat = temp;
  2669. if (!changeColor)
  2670. {
  2671. maxArea = maxArea * unitLength * unitLength;
  2672. minArea = minArea * unitLength * unitLength;
  2673. //maxAreaRatio = maxAreaRatio;
  2674. //minAreaRatio = minAreaRatio;
  2675. int maxNum = (int)Math.Ceiling(maxArea);//获取面积最大值
  2676. int minNum = (int)Math.Floor(minArea);//获取面积最小值
  2677. int maxNumRatio = (int)Math.Ceiling(maxAreaRatio);//获取面积率最大值
  2678. int minNumRatio = (int)Math.Floor(minAreaRatio);//获取面积率最小值
  2679. //先解绑事件以防数据赋值异常
  2680. this.numericUpDown4.ValueChanged -= numericUpDown4_ValueChanged;
  2681. this.numericUpDown5.ValueChanged -= numericUpDown5_ValueChanged;
  2682. this.numericUpDown6.ValueChanged -= numericUpDown6_ValueChanged;
  2683. this.numericUpDown7.ValueChanged -= numericUpDown7_ValueChanged;
  2684. this.trackBar2.Scroll -= trackBar2_Scroll;
  2685. this.trackBar4.Scroll -= trackBar4_Scroll;
  2686. this.trackBar5.Scroll -= trackBar5_Scroll;
  2687. this.trackBar6.Scroll -= trackBar6_Scroll;
  2688. this.numericUpDown4.Maximum = maxNum;
  2689. this.numericUpDown4.Minimum = minNum;
  2690. this.trackBar2.Maximum = maxNum;
  2691. this.trackBar2.Minimum = minNum;
  2692. this.numericUpDown5.Maximum = maxNum;
  2693. this.numericUpDown5.Minimum = minNum;
  2694. this.trackBar4.Maximum = maxNum;
  2695. this.trackBar4.Minimum = minNum;
  2696. this.numericUpDown4.Value = minNum;
  2697. this.trackBar2.Value = minNum;
  2698. this.numericUpDown5.Value = maxNum;
  2699. this.trackBar4.Value = maxNum;
  2700. if (maxNumRatio != 0 || minNumRatio != 100)
  2701. {
  2702. this.numericUpDown6.Maximum = maxNumRatio;
  2703. this.numericUpDown6.Minimum = minNumRatio;
  2704. this.trackBar5.Maximum = maxNumRatio;
  2705. this.trackBar5.Minimum = minNumRatio;
  2706. this.numericUpDown7.Maximum = maxNumRatio;
  2707. this.numericUpDown7.Minimum = minNumRatio;
  2708. this.trackBar6.Maximum = maxNumRatio;
  2709. this.trackBar6.Minimum = minNumRatio;
  2710. if (maxNumRatio > 60 && minNumRatio < 60)
  2711. {
  2712. this.trackBar5.Value = 60;
  2713. this.numericUpDown6.Value = 60;
  2714. }
  2715. this.numericUpDown7.Value = maxNumRatio;
  2716. this.trackBar6.Value = maxNumRatio;
  2717. }
  2718. if (areaRatioRangeMin != -1 && areaRatioRangeMin >= this.numericUpDown6.Minimum && areaRatioRangeMin <= this.numericUpDown7.Maximum)
  2719. {
  2720. trackBar5.Value = (int)areaRatioRangeMin;
  2721. this.numericUpDown6.Value = areaRatioRangeMin;
  2722. }
  2723. if (areaRatioRangeMax != -1 && areaRatioRangeMax >= this.numericUpDown6.Value && areaRatioRangeMax <= this.numericUpDown7.Maximum)
  2724. {
  2725. trackBar6.Value = (int)areaRatioRangeMax;
  2726. this.numericUpDown7.Value = areaRatioRangeMax;
  2727. }
  2728. if (areaMin != -1 && areaMin >= this.numericUpDown4.Minimum && areaMin <= this.numericUpDown5.Maximum)
  2729. {
  2730. trackBar2.Value = (int)areaMin;
  2731. this.numericUpDown4.Value = areaMin;
  2732. }
  2733. if (areaMax != -1 && areaMax >= this.numericUpDown4.Value && areaMax <= this.numericUpDown5.Maximum)
  2734. {
  2735. trackBar4.Value = (int)areaMax;
  2736. this.numericUpDown5.Value = areaMax;
  2737. }
  2738. this.numericUpDown4.ValueChanged += new EventHandler(numericUpDown4_ValueChanged);
  2739. this.numericUpDown5.ValueChanged += new EventHandler(numericUpDown5_ValueChanged);
  2740. this.numericUpDown6.ValueChanged += new EventHandler(numericUpDown6_ValueChanged);
  2741. this.numericUpDown7.ValueChanged += new EventHandler(numericUpDown7_ValueChanged);
  2742. this.trackBar2.Scroll += new EventHandler(trackBar2_Scroll);
  2743. this.trackBar4.Scroll += new EventHandler(trackBar4_Scroll);
  2744. this.trackBar5.Scroll += new EventHandler(trackBar5_Scroll);
  2745. this.trackBar6.Scroll += new EventHandler(trackBar6_Scroll);
  2746. //RefreshDataGridView1();
  2747. }
  2748. }
  2749. else
  2750. {
  2751. this.trackBar2.Maximum = 0;
  2752. this.trackBar2.Minimum = 0;
  2753. this.trackBar4.Maximum = 0;
  2754. this.trackBar4.Minimum = 0;
  2755. this.trackBar5.Maximum = 0;
  2756. this.trackBar5.Minimum = 0;
  2757. this.trackBar6.Maximum = 0;
  2758. this.trackBar6.Minimum = 0;
  2759. this.numericUpDown4.Maximum = 0;
  2760. this.numericUpDown4.Minimum = 0;
  2761. this.numericUpDown5.Maximum = 0;
  2762. this.numericUpDown5.Minimum = 0;
  2763. this.numericUpDown6.Maximum = 0;
  2764. this.numericUpDown6.Minimum = 0;
  2765. this.numericUpDown7.Maximum = 0;
  2766. this.numericUpDown7.Minimum = 0;
  2767. }
  2768. }
  2769. }
  2770. /// <summary>
  2771. /// 小数数字框值改变
  2772. /// </summary>
  2773. /// <param name="sender"></param>
  2774. /// <param name="e"></param>
  2775. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  2776. {
  2777. if (this.numericUpDown1.Value > this.numericUpDown1.Maximum)
  2778. this.numericUpDown1.Value = this.numericUpDown1.Maximum;
  2779. if (this.numericUpDown1.Value < this.numericUpDown1.Minimum)
  2780. this.numericUpDown1.Value = this.numericUpDown1.Minimum;
  2781. RefreshDataGridView1();
  2782. RefreshDataGridView2();
  2783. ReloadDebrisSelection();
  2784. }
  2785. /// <summary>
  2786. /// 是否筛选
  2787. /// </summary>
  2788. /// <param name="sender"></param>
  2789. /// <param name="e"></param>
  2790. private void checkBox3_CheckedChanged(object sender, EventArgs e)
  2791. {
  2792. if (this.documentWorkspace == null || this.documentWorkspace.CompositionSurface == null)
  2793. return;
  2794. ResetAreaAndContent();
  2795. ReloadDebrisSelection();
  2796. }
  2797. /// <summary>
  2798. /// 颗粒筛选范围最小值
  2799. /// </summary>
  2800. /// <param name="sender"></param>
  2801. /// <param name="e"></param>
  2802. private void numericUpDown4_ValueChanged(object sender, EventArgs e)
  2803. {
  2804. if (this.numericUpDown4.Value > this.numericUpDown5.Value)
  2805. this.numericUpDown4.Value = this.numericUpDown5.Value;
  2806. this.trackBar2.Value = Convert.ToInt32(this.numericUpDown4.Value);
  2807. areaMin = this.numericUpDown4.Value;
  2808. areaMax = this.numericUpDown5.Value;
  2809. //二值判断
  2810. if (this.checkBox3.Checked && bcBinaryChecked() && !this.checkBox4.Checked)
  2811. {
  2812. ReloadDebrisSelection();
  2813. }
  2814. if (this.checkBox3.Checked && bcBinaryChecked() && this.checkBox4.Checked)
  2815. {
  2816. ReloadDebrisSelection();
  2817. }
  2818. }
  2819. /// <summary>
  2820. /// 颗粒筛选范围最大值
  2821. /// </summary>
  2822. /// <param name="sender"></param>
  2823. /// <param name="e"></param>
  2824. private void numericUpDown5_ValueChanged(object sender, EventArgs e)
  2825. {
  2826. if (this.numericUpDown5.Value < this.numericUpDown4.Value)
  2827. this.numericUpDown5.Value = this.numericUpDown4.Value;
  2828. this.trackBar4.Value = Convert.ToInt32(this.numericUpDown5.Value);
  2829. areaMin = this.numericUpDown4.Value;
  2830. areaMax = this.numericUpDown5.Value;
  2831. //二值判断
  2832. if (this.checkBox3.Checked && bcBinaryChecked() && !this.checkBox4.Checked)
  2833. {
  2834. ReloadDebrisSelection();
  2835. }
  2836. if (this.checkBox3.Checked && bcBinaryChecked() && this.checkBox4.Checked)
  2837. {
  2838. ReloadDebrisSelection();
  2839. }
  2840. }
  2841. /// <summary>
  2842. /// 颗粒筛选最小值滚动条
  2843. /// </summary>
  2844. /// <param name="sender"></param>
  2845. /// <param name="e"></param>
  2846. private void trackBar2_Scroll(object sender, EventArgs e)
  2847. {
  2848. this.numericUpDown4.Value = this.trackBar2.Value;
  2849. }
  2850. /// <summary>
  2851. /// 颗粒筛选最大值滚动条
  2852. /// </summary>
  2853. /// <param name="sender"></param>
  2854. /// <param name="e"></param>
  2855. private void trackBar4_Scroll(object sender, EventArgs e)
  2856. {
  2857. this.numericUpDown5.Value = this.trackBar4.Value;
  2858. }
  2859. /// <summary>
  2860. /// 石墨面积率区间最小
  2861. /// </summary>
  2862. /// <param name="sender"></param>
  2863. /// <param name="e"></param>
  2864. private void numericUpDown6_ValueChanged(object sender, EventArgs e)
  2865. {
  2866. if (this.numericUpDown6.Value > this.numericUpDown7.Value)
  2867. this.numericUpDown6.Value = this.numericUpDown7.Value;
  2868. this.trackBar5.Value = Convert.ToInt32(this.numericUpDown6.Value);
  2869. areaRatioRangeMin = this.numericUpDown6.Value;
  2870. areaRatioRangeMax = this.numericUpDown7.Value;
  2871. ReloadDebrisSelection();
  2872. }
  2873. /// <summary>
  2874. /// 石墨面积率区间最大
  2875. /// </summary>
  2876. /// <param name="sender"></param>
  2877. /// <param name="e"></param>
  2878. private void numericUpDown7_ValueChanged(object sender, EventArgs e)
  2879. {
  2880. if (this.numericUpDown7.Value < this.numericUpDown6.Value)
  2881. this.numericUpDown7.Value = this.numericUpDown6.Value;
  2882. this.trackBar6.Value = Convert.ToInt32(this.numericUpDown7.Value);
  2883. areaRatioRangeMin = this.numericUpDown6.Value;
  2884. areaRatioRangeMax = this.numericUpDown7.Value;
  2885. ReloadDebrisSelection();
  2886. }
  2887. /// <summary>
  2888. /// 石墨面积率最小值滚动条
  2889. /// </summary>
  2890. /// <param name="sender"></param>
  2891. /// <param name="e"></param>
  2892. private void trackBar5_Scroll(object sender, EventArgs e)
  2893. {
  2894. this.numericUpDown6.Value = this.trackBar5.Value;
  2895. }
  2896. /// <summary>
  2897. /// 石墨面积率最大值滚动条
  2898. /// </summary>
  2899. /// <param name="sender"></param>
  2900. /// <param name="e"></param>
  2901. private void trackBar6_Scroll(object sender, EventArgs e)
  2902. {
  2903. this.numericUpDown7.Value = this.trackBar6.Value;
  2904. }
  2905. /// <summary>
  2906. /// 显示不同颜色
  2907. /// </summary>
  2908. /// <param name="sender"></param>
  2909. /// <param name="e"></param>
  2910. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  2911. {
  2912. ReloadDebrisSelection();
  2913. }
  2914. /// <summary>
  2915. /// 添加画布绑定事件
  2916. /// </summary>
  2917. public void AddPictureBoxEvent()
  2918. {
  2919. this.documentWorkspace.panel.Paint -= new PaintEventHandler(this.BoxPaintHandler);
  2920. this.documentWorkspace.panel.Paint += new PaintEventHandler(this.BoxPaintHandler);
  2921. }
  2922. /// <summary>
  2923. /// 绘制事件
  2924. /// </summary>
  2925. /// <param name="sender"></param>
  2926. /// <param name="e"></param>
  2927. private void BoxPaintHandler(object sender, PaintEventArgs e)
  2928. {
  2929. if (this.documentWorkspace.CompositionSurface != null)
  2930. {
  2931. Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
  2932. int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
  2933. int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
  2934. int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
  2935. int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
  2936. e.Graphics.TranslateTransform(x, y);
  2937. e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
  2938. Draw(e.Graphics);
  2939. e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
  2940. e.Graphics.TranslateTransform(-x, -y);
  2941. }
  2942. }
  2943. /// <summary>
  2944. /// 绘制
  2945. /// </summary>
  2946. private void Draw(Graphics graphics)
  2947. {
  2948. graphics.SmoothingMode = SmoothingMode.AntiAlias;
  2949. Pen rectPen = new Pen(Color.Black);
  2950. rectPen.DashStyle = DashStyle.Custom;
  2951. float[] dashArray = { 2.0f, 3.0f };
  2952. rectPen.DashPattern = dashArray;
  2953. if (pointList.Count > 0 && leList.Count > 0)
  2954. {
  2955. for (int i = 0; i < pointList.Count; i++)
  2956. {
  2957. graphics.DrawString(leList[i].ToString(), new Font("宋体", float.Parse(colourFont.Keys.First()), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(colourFont.Values.First()), pointList[i].X, pointList[i].Y);
  2958. }
  2959. }
  2960. }
  2961. /// <summary>
  2962. /// 显示面积率
  2963. /// </summary>
  2964. /// <param name="sender"></param>
  2965. /// <param name="e"></param>
  2966. private void checkBox5_CheckedChanged(object sender, EventArgs e)
  2967. {
  2968. if (bcBinaryChecked() && !bcOriginChecked())
  2969. {
  2970. if (checkBox5.Checked)
  2971. {
  2972. ReloadDebrisSelection();
  2973. this.documentWorkspace.Refresh();
  2974. }
  2975. else
  2976. {
  2977. this.documentWorkspace.panel.Paint -= new PaintEventHandler(this.BoxPaintHandler);
  2978. this.documentWorkspace.Refresh();
  2979. }
  2980. }
  2981. }
  2982. /// <summary>
  2983. /// 等积圆直径小于20um的颗粒不参与计算
  2984. /// </summary>
  2985. /// <param name="sender"></param>
  2986. /// <param name="e"></param>
  2987. private void checkBox6_CheckedChanged(object sender, EventArgs e)
  2988. {
  2989. ReloadDebrisSelection();
  2990. }
  2991. /// <summary>
  2992. /// 保存结果
  2993. /// </summary>
  2994. /// <param name="sender"></param>
  2995. /// <param name="e"></param>
  2996. private void button2_Click(object sender, EventArgs e)
  2997. {
  2998. if (picArea == 0)
  2999. {
  3000. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  3001. return;
  3002. }
  3003. else
  3004. {
  3005. //二值判断
  3006. if (!bcBinaryChecked())
  3007. {
  3008. MessageBox.Show(PdnResources.GetString("Menu.PleaseBinarize.text")+"!");
  3009. return;
  3010. }
  3011. }
  3012. if (this.listView1.SelectedItems.Count > 0)
  3013. {
  3014. string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
  3015. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
  3016. bool replace = false;
  3017. int rowIndex = 0;
  3018. if (this.dataGridView1.Rows.Count > 0 && dataGridView1.Rows[0].Visible)
  3019. {
  3020. if (this.listView2.Items.Count > 0)
  3021. {
  3022. foreach (ListViewItem item in this.listView2.Items)
  3023. {
  3024. if (item.Name.Equals(tag))
  3025. {
  3026. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  3027. if (dr == DialogResult.OK)
  3028. {
  3029. replace = true;
  3030. }
  3031. else
  3032. {
  3033. return;
  3034. }
  3035. break;
  3036. }
  3037. }
  3038. }
  3039. //添加结果,有重名需要替换
  3040. if (replace)
  3041. {
  3042. for (int i = 0; i < this.resultTableList.Count; i++)
  3043. {
  3044. if (this.resultTableList[i].TableName.Equals(tag))
  3045. {
  3046. rowIndex = i;
  3047. this.resultTableList.Remove(this.resultTableList[i]);
  3048. if (this.pointList.Count > 0)
  3049. {
  3050. resultTableList.Insert(rowIndex, dtResult);
  3051. }
  3052. }
  3053. }
  3054. }
  3055. else
  3056. {
  3057. ListViewItem listViewItem = new ListViewItem();
  3058. listViewItem.Name = tag;
  3059. listViewItem.SubItems[0].Text = imgName;
  3060. this.listView2.Items.Add(listViewItem);
  3061. this.listView2.SelectedItems.Clear();
  3062. this.listView2.Items[this.listView2.Items.Count - 1].Selected = true;
  3063. if (this.pointList.Count > 0)
  3064. {
  3065. resultTableList.Insert(rowIndex, dtResult);
  3066. }
  3067. }
  3068. RefreshDataGridView2();
  3069. //保存处理后的图片
  3070. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  3071. List<Bitmap> tempBit = new List<Bitmap>();
  3072. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  3073. originalBit.Tag = pantographRatio;
  3074. tempBit.Add(originalBit);
  3075. Bitmap processedBit = BitmapConverter.ToBitmap(phaseModel.mat);
  3076. Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  3077. Graphics graphics = Graphics.FromImage(newBit);
  3078. graphics.DrawImage(processedBit, new PointF(0, 0));
  3079. if (this.checkBox4.Checked)
  3080. {
  3081. DisplayColor();
  3082. }
  3083. if (this.checkBox5.Checked)
  3084. {
  3085. Draw(graphics);
  3086. }
  3087. newBit.Tag = pantographRatio;
  3088. tempBit.Add(newBit);
  3089. if (bitDic.ContainsKey(tag))
  3090. bitDic[tag] = tempBit;
  3091. else
  3092. bitDic.Add(tag, tempBit);
  3093. //拼接中间数据
  3094. List<List<string>> dataList = new List<List<string>>();
  3095. List<string> columnName = new List<string>();
  3096. columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
  3097. if (this.checkBox6.Checked)
  3098. {
  3099. columnName.Add(PdnResources.GetString("Menu.umisoproductcirclediameter.text"));
  3100. }
  3101. else
  3102. {
  3103. columnName.Add(PdnResources.GetString("Menu.Diameterofequalareacircle.text"));
  3104. }
  3105. columnName.Add(PdnResources.GetString("Menu.Thearearatio.text"));
  3106. dataList.Add(columnName);
  3107. if (this.lstEqualDiameter.Count > 0)
  3108. {
  3109. for (int i = 0; i < this.lstEqualDiameter.Count; i++)
  3110. {
  3111. List<string> strList = new List<string>();
  3112. strList.Add((i + 1).ToString());
  3113. strList.Add(this.lstEqualDiameter[i].ToString());
  3114. strList.Add(this.leList[i].ToString());
  3115. dataList.Add(strList);
  3116. }
  3117. }
  3118. bool isExist = false;//是否已存在进行替换
  3119. int modelIndex = -1;//要替换的下标
  3120. for (int j = 0; j < tempDataModel.Count; j++)
  3121. {
  3122. if (tempDataModel[j].tagName.Equals(tag))
  3123. {
  3124. isExist = true;
  3125. modelIndex = j;
  3126. break;
  3127. }
  3128. }
  3129. if (isExist && modelIndex > -1)
  3130. tempDataModel[modelIndex].dataList = dataList;
  3131. else
  3132. {
  3133. ExportProjectModel newModel = new ExportProjectModel();
  3134. newModel.tagName = tag;
  3135. newModel.picName = imgName;
  3136. newModel.dataList = dataList;
  3137. tempDataModel.Add(newModel);
  3138. }
  3139. }
  3140. else
  3141. {
  3142. MessageBox.Show(PdnResources.GetString("Menu.Nodatatosave.text"));
  3143. }
  3144. }
  3145. }
  3146. /// <summary>
  3147. /// 刷新数据展示表
  3148. /// </summary>
  3149. private void RefreshDataGridView1()
  3150. {
  3151. this.dataGridView1.Rows.Clear();
  3152. if (dtDataGridView1 != null && dtDataGridView1.Rows.Count > 0)
  3153. {
  3154. dataGridView1.Rows.Add(dtDataGridView1.Rows.Count);//增加同等数量的行数
  3155. int i = 0;
  3156. foreach (DataRow row in dtDataGridView1.Rows)//逐个读取单元格的内容;
  3157. {
  3158. DataGridViewRow r1 = dataGridView1.Rows[i];
  3159. r1.Cells[0].Value = row.RowState.ToString();
  3160. for (int j = 0; j < dtDataGridView1.Columns.Count; j++)
  3161. {
  3162. if (j == 0 || j == 8)
  3163. {
  3164. r1.Cells[j].Value = row[j].ToString();
  3165. }
  3166. else
  3167. {
  3168. r1.Cells[j].Value = Math.Round(double.Parse(string.IsNullOrEmpty(row[j].ToString()) ? "0" :
  3169. row[j].ToString()), Convert.ToInt32(this.numericUpDown1.Value));
  3170. }
  3171. }
  3172. i++;
  3173. }
  3174. }
  3175. }
  3176. /// <summary>
  3177. /// 刷新分析结果表
  3178. /// </summary>
  3179. private void RefreshDataGridView2()
  3180. {
  3181. //需要计算平均值的集合
  3182. List<double> lst1_08 = new List<double>();
  3183. List<double> lst08_06 = new List<double>();
  3184. List<double> lst06_04 = new List<double>();
  3185. List<double> lst04_02 = new List<double>();
  3186. List<double> lst02_01 = new List<double>();
  3187. List<double> lst01_0 = new List<double>();
  3188. List<double> lstRate = new List<double>();
  3189. //综合平均值
  3190. double avglst1_08 = 0;
  3191. double avglst08_06 = 0;
  3192. double avglst06_04 = 0;
  3193. double avglst04_02 = 0;
  3194. double avglst02_01 = 0;
  3195. double avglst01_0 = 0;
  3196. double avglstRate = 0;
  3197. if (resultTableList.Count > 0)
  3198. {
  3199. dataGridView2.Rows.Clear();
  3200. dataGridView3.Rows.Clear();
  3201. if (this.showAll)
  3202. {
  3203. //dataGridView2.Rows.Clear();
  3204. int i = 0;
  3205. for (int k = 0; k < resultTableList.Count; k++)
  3206. {
  3207. dataGridView2.Rows.Add(resultTableList[k].Rows.Count);//增加同等数量的行数
  3208. foreach (DataRow row in resultTableList[k].Rows)//逐个读取单元格的内容;
  3209. {
  3210. DataGridViewRow r1 = dataGridView2.Rows[i];
  3211. r1.Cells[0].Value = row.RowState.ToString();
  3212. for (int j = 0; j < resultTableList[k].Columns.Count; j++)
  3213. {
  3214. if (j == 0 || j == 1 || j == 9)
  3215. {
  3216. r1.Cells[j].Value = row[j].ToString();
  3217. }
  3218. else
  3219. {
  3220. r1.Cells[j].Value = Math.Round(double.Parse(string.IsNullOrEmpty(row[j].ToString()) ? "0" :
  3221. row[j].ToString()), Convert.ToInt32(this.numericUpDown1.Value));
  3222. }
  3223. //r1.Cells[j].Value = row[j];
  3224. if (!row[1].Equals(PdnResources.GetString("Menu.Image.Average.Text")))
  3225. {
  3226. if (j == 2)
  3227. {
  3228. lst1_08.Add(double.Parse(row[j].ToString()));
  3229. }
  3230. if (j == 3)
  3231. {
  3232. lst08_06.Add(double.Parse(row[j].ToString()));
  3233. }
  3234. if (j == 4)
  3235. {
  3236. lst06_04.Add(double.Parse(row[j].ToString()));
  3237. }
  3238. if (j == 5)
  3239. {
  3240. lst04_02.Add(double.Parse(row[j].ToString()));
  3241. }
  3242. if (j == 6)
  3243. {
  3244. lst02_01.Add(double.Parse(row[j].ToString()));
  3245. }
  3246. if (j == 7)
  3247. {
  3248. lst01_0.Add(double.Parse(row[j].ToString()));
  3249. }
  3250. if (j == 8)
  3251. {
  3252. lstRate.Add(double.Parse(row[j].ToString()));
  3253. }
  3254. }
  3255. }
  3256. i++;
  3257. }
  3258. }
  3259. }
  3260. else
  3261. {
  3262. //dataGridView2.Rows.Clear();
  3263. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  3264. {
  3265. int h = 0;
  3266. for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
  3267. {
  3268. string tableName = this.listView2.SelectedItems[i].Name;
  3269. foreach (DataTable dt in resultTableList)
  3270. {
  3271. if (dt.TableName.Equals(tableName))
  3272. {
  3273. dataGridView2.Rows.Add(dt.Rows.Count);//增加同等数量的行数
  3274. foreach (DataRow row in dt.Rows)//逐个读取单元格的内容;
  3275. {
  3276. DataGridViewRow r1 = dataGridView2.Rows[h];
  3277. r1.Cells[0].Value = row.RowState.ToString();
  3278. for (int j = 0; j < dt.Columns.Count; j++)
  3279. {
  3280. if (j == 0 || j == 1 || j == 9)
  3281. {
  3282. r1.Cells[j].Value = row[j].ToString();
  3283. }
  3284. else
  3285. {
  3286. r1.Cells[j].Value = Math.Round(double.Parse(string.IsNullOrEmpty(row[j].ToString()) ? "0" :
  3287. row[j].ToString()), Convert.ToInt32(this.numericUpDown1.Value));
  3288. }
  3289. //r1.Cells[j].Value = row[j];
  3290. if (!row[1].Equals(PdnResources.GetString("Menu.Image.Average.Text")))
  3291. {
  3292. if (j == 2)
  3293. {
  3294. lst1_08.Add(double.Parse(row[j].ToString()));
  3295. }
  3296. if (j == 3)
  3297. {
  3298. lst08_06.Add(double.Parse(row[j].ToString()));
  3299. }
  3300. if (j == 4)
  3301. {
  3302. lst06_04.Add(double.Parse(row[j].ToString()));
  3303. }
  3304. if (j == 5)
  3305. {
  3306. lst04_02.Add(double.Parse(row[j].ToString()));
  3307. }
  3308. if (j == 6)
  3309. {
  3310. lst02_01.Add(double.Parse(row[j].ToString()));
  3311. }
  3312. if (j == 7)
  3313. {
  3314. lst01_0.Add(double.Parse(row[j].ToString()));
  3315. }
  3316. if (j == 8)
  3317. {
  3318. lstRate.Add(double.Parse(row[j].ToString()));
  3319. }
  3320. }
  3321. }
  3322. h++;
  3323. }
  3324. }
  3325. }
  3326. }
  3327. }
  3328. }
  3329. if (this.listView2.SelectedItems.Count > 0)
  3330. {
  3331. if (lst1_08.Count > 0)
  3332. {
  3333. avglst1_08 = (double)lst1_08.Average();
  3334. }
  3335. if (lst08_06.Count > 0)
  3336. {
  3337. avglst08_06 = (double)lst08_06.Average();
  3338. }
  3339. if (lst06_04.Count > 0)
  3340. {
  3341. avglst06_04 = (double)lst06_04.Average();
  3342. }
  3343. if (lst04_02.Count > 0)
  3344. {
  3345. avglst04_02 = (double)lst04_02.Average();
  3346. }
  3347. if (lst02_01.Count > 0)
  3348. {
  3349. avglst02_01 = (double)lst02_01.Average();
  3350. }
  3351. if (lst01_0.Count > 0)
  3352. {
  3353. avglst01_0 = (double)lst01_0.Average();
  3354. }
  3355. if (lstRate.Count > 0)
  3356. {
  3357. avglstRate = (double)lstRate.Average();
  3358. }
  3359. string avgLevel = string.Empty;
  3360. if (avglstRate / 100 < 0.01)
  3361. {
  3362. avgLevel = "1";
  3363. }
  3364. else if (avglstRate / 100 >= 0.01 && avglstRate / 100 < 0.05)
  3365. {
  3366. avgLevel = "2";
  3367. }
  3368. else if (avglstRate / 100 >= 0.05 && avglstRate / 100 < 0.15)
  3369. {
  3370. avgLevel = "3";
  3371. }
  3372. else if (avglstRate / 100 >= 0.15 && avglstRate / 100 < 0.25)
  3373. {
  3374. avgLevel = "4";
  3375. }
  3376. else if (avglstRate / 100 >= 0.25)
  3377. {
  3378. avgLevel = "5";
  3379. }
  3380. else
  3381. {
  3382. avgLevel = "-";
  3383. }
  3384. this.dataGridView3.Rows.Add(PdnResources.GetString("Menu.comprehensive.text"), PdnResources.GetString("Menu.Comprehensivaverage.text"), Math.Round(double.Parse(string.IsNullOrEmpty(avglst1_08.ToString()) ? "0" : avglst1_08.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglst08_06.ToString()) ? "0" : avglst08_06.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglst06_04.ToString()) ? "0" : avglst06_04.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglst04_02.ToString()) ? "0" : avglst04_02.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglst02_01.ToString()) ? "0" : avglst02_01.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglst01_0.ToString()) ? "0" : avglst01_0.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglstRate.ToString()) ? "0" : avglstRate.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), avgLevel);
  3385. }
  3386. }
  3387. else
  3388. {
  3389. dataGridView2.Rows.Clear();
  3390. dataGridView3.Rows.Clear();
  3391. }
  3392. }
  3393. /// <summary>
  3394. /// 生成报告
  3395. /// </summary>
  3396. /// <param name="sender"></param>
  3397. /// <param name="e"></param>
  3398. private void button8_Click(object sender, EventArgs e)
  3399. {
  3400. if (this.checkBox1.Checked)
  3401. this.btnSetUp.PerformClick();
  3402. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  3403. {
  3404. //获取word书签与excel单元格的关系,以字典方式存储
  3405. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  3406. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  3407. if (mic_module_infos != null && mic_module_infos.Count > 0)
  3408. {
  3409. foreach (mic_module_infos info in mic_module_infos)
  3410. {
  3411. tagInfos.Add(info.tag_name, info.cell_position);
  3412. }
  3413. }
  3414. //分析结果
  3415. List<List<string>> analysisContent = new List<List<string>>();
  3416. List<string> contentHead = new List<string>();
  3417. contentHead.Add(PdnResources.GetString("Menu.picture.Text"));
  3418. contentHead.Add(PdnResources.GetString("Menu.view.text"));
  3419. contentHead.Add("1-0.8");
  3420. contentHead.Add("0.8-0.6");
  3421. contentHead.Add("0.6-0.4");
  3422. contentHead.Add("0.4-0.2");
  3423. contentHead.Add("0.2-0.1");
  3424. contentHead.Add("0.1-0");
  3425. contentHead.Add(PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)");
  3426. contentHead.Add(PdnResources.GetString("Menu.Levelname.text"));
  3427. analysisContent.Add(contentHead);
  3428. foreach (DataGridViewRow item in this.dataGridView2.Rows)
  3429. {
  3430. List<string> content = new List<string>();
  3431. content.Add(item.Cells[0].Value.ToString());
  3432. content.Add(item.Cells[1].Value.ToString());
  3433. content.Add(item.Cells[2].Value.ToString());
  3434. content.Add(item.Cells[3].Value.ToString());
  3435. content.Add(item.Cells[4].Value.ToString());
  3436. content.Add(item.Cells[5].Value.ToString());
  3437. content.Add(item.Cells[6].Value.ToString());
  3438. content.Add(item.Cells[7].Value.ToString());
  3439. content.Add(item.Cells[8].Value.ToString());
  3440. content.Add(item.Cells[9].Value.ToString());
  3441. analysisContent.Add(content);
  3442. }
  3443. analysisContent.Add(new List<string>() { "\r" });
  3444. foreach (DataGridViewRow item in this.dataGridView3.Rows)
  3445. {
  3446. List<string> content = new List<string>();
  3447. content.Add(item.Cells[0].Value.ToString());
  3448. content.Add(item.Cells[1].Value.ToString());
  3449. content.Add(item.Cells[2].Value.ToString());
  3450. content.Add(item.Cells[3].Value.ToString());
  3451. content.Add(item.Cells[4].Value.ToString());
  3452. content.Add(item.Cells[5].Value.ToString());
  3453. content.Add(item.Cells[6].Value.ToString());
  3454. content.Add(item.Cells[7].Value.ToString());
  3455. content.Add(item.Cells[8].Value.ToString());
  3456. content.Add(item.Cells[9].Value.ToString());
  3457. analysisContent.Add(content);
  3458. }
  3459. //图片
  3460. bitList = new List<Bitmap>();
  3461. if (this.showAll)
  3462. {
  3463. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  3464. {
  3465. bitList.Add(kv.Value[0]);
  3466. bitList.Add(kv.Value[1]);
  3467. }
  3468. }
  3469. else
  3470. {
  3471. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  3472. {
  3473. foreach (ListViewItem item in this.listView2.SelectedItems)
  3474. {
  3475. if (bitDic.ContainsKey(item.Name))
  3476. {
  3477. bitList.Add(bitDic[item.Name][0]);
  3478. bitList.Add(bitDic[item.Name][1]);
  3479. }
  3480. }
  3481. }
  3482. }
  3483. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  3484. }
  3485. else
  3486. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  3487. }
  3488. /// <summary>
  3489. /// 导出项目
  3490. /// </summary>
  3491. /// <param name="sender"></param>
  3492. /// <param name="e"></param>
  3493. private void button1_Click(object sender, EventArgs e)
  3494. {
  3495. if (this.checkBox1.Checked)
  3496. this.btnSetUp.PerformClick();
  3497. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  3498. {
  3499. PaintDotNet.Instrument.ProjectEngineering.NodeItem nodeItem = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.DuctileIron.Text", this.analyzeSettingModel.savePath);
  3500. if (nodeItem == null) return;
  3501. //获取word书签与excel单元格的关系,以字典方式存储
  3502. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  3503. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  3504. if (mic_module_infos != null && mic_module_infos.Count > 0)
  3505. {
  3506. foreach (mic_module_infos info in mic_module_infos)
  3507. {
  3508. tagInfos.Add(info.tag_name, info.cell_position);
  3509. }
  3510. }
  3511. //分析结果
  3512. List<List<string>> analysisContent = new List<List<string>>();
  3513. List<string> contentHead = new List<string>();
  3514. contentHead.Add(PdnResources.GetString("Menu.picture.Text"));
  3515. contentHead.Add(PdnResources.GetString("Menu.view.text"));
  3516. contentHead.Add("1-0.8");
  3517. contentHead.Add("0.8-0.6");
  3518. contentHead.Add("0.6-0.4");
  3519. contentHead.Add("0.4-0.2");
  3520. contentHead.Add("0.2-0.1");
  3521. contentHead.Add("0.1-0");
  3522. contentHead.Add(PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)");
  3523. contentHead.Add(PdnResources.GetString("Menu.Levelname.text"));
  3524. analysisContent.Add(contentHead);
  3525. foreach (DataGridViewRow item in this.dataGridView2.Rows)
  3526. {
  3527. List<string> content = new List<string>();
  3528. content.Add(item.Cells[0].Value.ToString());
  3529. content.Add(item.Cells[1].Value.ToString());
  3530. content.Add(item.Cells[2].Value.ToString());
  3531. content.Add(item.Cells[3].Value.ToString());
  3532. content.Add(item.Cells[4].Value.ToString());
  3533. content.Add(item.Cells[5].Value.ToString());
  3534. content.Add(item.Cells[6].Value.ToString());
  3535. content.Add(item.Cells[7].Value.ToString());
  3536. content.Add(item.Cells[8].Value.ToString());
  3537. content.Add(item.Cells[9].Value.ToString());
  3538. analysisContent.Add(content);
  3539. }
  3540. analysisContent.Add(new List<string>() { "\r" });
  3541. foreach (DataGridViewRow item in this.dataGridView3.Rows)
  3542. {
  3543. List<string> content = new List<string>();
  3544. content.Add(item.Cells[0].Value.ToString());
  3545. content.Add(item.Cells[1].Value.ToString());
  3546. content.Add(item.Cells[2].Value.ToString());
  3547. content.Add(item.Cells[3].Value.ToString());
  3548. content.Add(item.Cells[4].Value.ToString());
  3549. content.Add(item.Cells[5].Value.ToString());
  3550. content.Add(item.Cells[6].Value.ToString());
  3551. content.Add(item.Cells[7].Value.ToString());
  3552. content.Add(item.Cells[8].Value.ToString());
  3553. content.Add(item.Cells[9].Value.ToString());
  3554. analysisContent.Add(content);
  3555. }
  3556. //图片
  3557. bitList = new List<Bitmap>();
  3558. if (this.showAll)
  3559. {
  3560. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  3561. {
  3562. bitList.Add(kv.Value[0]);
  3563. bitList.Add(kv.Value[1]);
  3564. }
  3565. }
  3566. else
  3567. {
  3568. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  3569. {
  3570. foreach (ListViewItem item in this.listView2.SelectedItems)
  3571. {
  3572. if (bitDic.ContainsKey(item.Name))
  3573. {
  3574. bitList.Add(bitDic[item.Name][0]);
  3575. bitList.Add(bitDic[item.Name][1]);
  3576. }
  3577. }
  3578. }
  3579. }
  3580. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, nodeItem.path, nodeItem.code);
  3581. //保存项目信息到数据库
  3582. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, nodeItem);
  3583. }
  3584. else
  3585. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  3586. }
  3587. /// <summary>
  3588. /// 导出结果
  3589. /// </summary>
  3590. /// <param name="sender"></param>
  3591. /// <param name="e"></param>
  3592. private void button9_Click(object sender, EventArgs e)
  3593. {
  3594. if (this.dataGridView2.Rows.Count > 0)
  3595. {
  3596. SaveFileDialog exe = new SaveFileDialog();
  3597. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  3598. exe.FilterIndex = 0;
  3599. exe.RestoreDirectory = true;
  3600. //exe.CreatePrompt = true;
  3601. exe.Title = "Export Excel File";
  3602. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  3603. exe.FileName = PdnResources.GetString("Menu.Analysisresultsofnitridingdepthdetermin.text") + DateTime.Now.ToString("yyyyMMddHHmmss");
  3604. DialogResult dr = exe.ShowDialog();
  3605. if (dr != DialogResult.OK)
  3606. return;
  3607. DataTable dtb = new DataTable();
  3608. dtb.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
  3609. dtb.Columns.Add(PdnResources.GetString("Menu.view.text"));
  3610. dtb.Columns.Add("1-0.8");
  3611. dtb.Columns.Add("0.8-0.6");
  3612. dtb.Columns.Add("0.6-0.4");
  3613. dtb.Columns.Add("0.4-0.2");
  3614. dtb.Columns.Add("0.2-0.1");
  3615. dtb.Columns.Add("0.1-0");
  3616. dtb.Columns.Add(PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)");
  3617. dtb.Columns.Add(PdnResources.GetString("Menu.Levelname.text"));
  3618. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  3619. {
  3620. DataRow dataRow = dtb.NewRow();
  3621. dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView2.Rows[i].Cells[0].Value;
  3622. dataRow[PdnResources.GetString("Menu.view.text")] = this.dataGridView2.Rows[i].Cells[1].Value;
  3623. dataRow["1-0.8"] = this.dataGridView2.Rows[i].Cells[2].Value;
  3624. dataRow["0.8-0.6"] = this.dataGridView2.Rows[i].Cells[3].Value;
  3625. dataRow["0.6-0.4"] = this.dataGridView2.Rows[i].Cells[4].Value;
  3626. dataRow["0.4-0.2"] = this.dataGridView2.Rows[i].Cells[5].Value;
  3627. dataRow["0.2-0.1"] = this.dataGridView2.Rows[i].Cells[6].Value;
  3628. dataRow["0.1-0"] = this.dataGridView2.Rows[i].Cells[7].Value;
  3629. dataRow[PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)"] = this.dataGridView2.Rows[i].Cells[8].Value;
  3630. dataRow[PdnResources.GetString("Menu.Levelname.text")] = this.dataGridView2.Rows[i].Cells[9].Value;
  3631. dtb.Rows.Add(dataRow);
  3632. }
  3633. DataTable dtb1 = new DataTable();
  3634. dtb1.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
  3635. dtb1.Columns.Add(PdnResources.GetString("Menu.view.text"));
  3636. dtb1.Columns.Add("1-0.8");
  3637. dtb1.Columns.Add("0.8-0.6");
  3638. dtb1.Columns.Add("0.6-0.4");
  3639. dtb1.Columns.Add("0.4-0.2");
  3640. dtb1.Columns.Add("0.2-0.1");
  3641. dtb1.Columns.Add("0.1-0");
  3642. dtb1.Columns.Add(PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)");
  3643. dtb1.Columns.Add(PdnResources.GetString("Menu.Levelname.text"));
  3644. for (int i = 0; i < this.dataGridView3.Rows.Count; i++)
  3645. {
  3646. DataRow dataRow = dtb1.NewRow();
  3647. dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView3.Rows[i].Cells[0].Value;
  3648. dataRow[PdnResources.GetString("Menu.view.text")] = this.dataGridView3.Rows[i].Cells[1].Value;
  3649. dataRow["1-0.8"] = this.dataGridView3.Rows[i].Cells[2].Value;
  3650. dataRow["0.8-0.6"] = this.dataGridView3.Rows[i].Cells[3].Value;
  3651. dataRow["0.6-0.4"] = this.dataGridView3.Rows[i].Cells[4].Value;
  3652. dataRow["0.4-0.2"] = this.dataGridView3.Rows[i].Cells[5].Value;
  3653. dataRow["0.2-0.1"] = this.dataGridView3.Rows[i].Cells[6].Value;
  3654. dataRow["0.1-0"] = this.dataGridView3.Rows[i].Cells[7].Value;
  3655. dataRow[PdnResources.GetString("Menu.Theamountoffreeferrite.text")+"(%)"] = this.dataGridView3.Rows[i].Cells[8].Value;
  3656. dataRow[PdnResources.GetString("Menu.Levelname.text")] = this.dataGridView3.Rows[i].Cells[9].Value;
  3657. dtb1.Rows.Add(dataRow);
  3658. }
  3659. List<DataTable> list = new List<DataTable>();
  3660. list.Add(dtb);
  3661. list.Add(dtb1);
  3662. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, false, false, true);
  3663. }
  3664. else
  3665. MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text")+"!");
  3666. }
  3667. private void listView2_SelectedIndexChanged(object sender, EventArgs e)
  3668. {
  3669. if (this.showAll)
  3670. return;
  3671. RefreshDataGridView2();
  3672. }
  3673. /// <summary>
  3674. /// 全部显示
  3675. /// </summary>
  3676. /// <param name="sender"></param>
  3677. /// <param name="e"></param>
  3678. private void button6_Click(object sender, EventArgs e)
  3679. {
  3680. if (this.button6.Text == PdnResources.GetString("Menu.Showall.text"))
  3681. {
  3682. this.button6.Text = PdnResources.GetString("Menu.Cancelshowall.text");
  3683. this.showAll = true;
  3684. RefreshDataGridView2();
  3685. }
  3686. else if (this.button6.Text == PdnResources.GetString("Menu.Cancelshowall.text"))
  3687. {
  3688. this.button6.Text = PdnResources.GetString("Menu.Showall.text");
  3689. this.showAll = false;
  3690. RefreshDataGridView2();
  3691. }
  3692. }
  3693. /// <summary>
  3694. /// 删除
  3695. /// </summary>
  3696. /// <param name="sender"></param>
  3697. /// <param name="e"></param>
  3698. private void button7_Click(object sender, EventArgs e)
  3699. {
  3700. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  3701. {
  3702. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Determineallanalysisrlete.text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  3703. if (dr == DialogResult.OK)
  3704. {
  3705. for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
  3706. {
  3707. string tableName = this.listView2.SelectedItems[i].Name;
  3708. foreach (DataTable dt in resultTableList)
  3709. {
  3710. if (dt.TableName.Equals(tableName))
  3711. {
  3712. resultTableList.Remove(dt);
  3713. break;
  3714. }
  3715. }
  3716. if (bitDic.ContainsKey(tableName))
  3717. bitDic.Remove(tableName);
  3718. }
  3719. foreach (ListViewItem item in this.listView2.Items)
  3720. {
  3721. if (item.Selected)
  3722. this.listView2.Items.Remove(item);
  3723. }
  3724. RefreshDataGridView2();
  3725. }
  3726. }
  3727. }
  3728. /// <summary>
  3729. /// 设置窗体缩放最小尺寸
  3730. /// </summary>
  3731. /// <param name="sender"></param>
  3732. /// <param name="e"></param>
  3733. private void SpheroidizationLevelDialog_ResizeEnd(object sender, EventArgs e)
  3734. {
  3735. if (this.Width <= 1179)
  3736. {
  3737. this.Width = 1179;
  3738. }
  3739. if (this.Height <= 945)
  3740. {
  3741. this.Height = 945;
  3742. }
  3743. }
  3744. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  3745. {
  3746. if (this.documentWorkspace == null || this.documentWorkspace.CompositionSurface == null)
  3747. return;
  3748. //ResetAreaAndContent();
  3749. ReloadDebrisSelection();
  3750. }
  3751. #region 参数保存及提取
  3752. /// <summary>
  3753. /// 保存参数的key,value和type
  3754. /// </summary>
  3755. /// <param name="param_key"></param>
  3756. /// <param name="param_value"></param>
  3757. /// <param name="param_type"></param>
  3758. private void saveParamValue(string param_key, string param_value, int param_type)
  3759. {
  3760. bool foundItem = false;
  3761. foreach (var item in this.analysisModel.ListParam)
  3762. {
  3763. if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
  3764. {
  3765. item.param_value = param_value;
  3766. item.setValue();
  3767. foundItem = true;
  3768. break;
  3769. }
  3770. }
  3771. if (!foundItem)
  3772. {
  3773. GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
  3774. analysisItem.menuId = this.menuId;
  3775. analysisItem.param_key = param_key;
  3776. analysisItem.param_type = param_type;
  3777. analysisItem.param_value = param_value;
  3778. analysisItem.setValue();
  3779. this.analysisModel.ListParam.Add(analysisItem);
  3780. }
  3781. }
  3782. /// <summary>
  3783. /// 保存界面中的参数到model
  3784. /// </summary>
  3785. private void saveDialogParamValues()
  3786. {
  3787. saveParamValue(ParamKey_Report, checkBox1.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//报告设置
  3788. saveParamValue(ParamKey_Screen, checkBox3.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//筛选
  3789. saveParamValue(ParamKey_ScreenMin, numericUpDown4 != null ? numericUpDown4.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//面积最小值
  3790. saveParamValue(ParamKey_ScreenMax, numericUpDown5 != null ? numericUpDown5.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//面积最大值
  3791. saveParamValue(ParamKey_Diameter, checkBox6.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//直径小于20um
  3792. saveParamValue(ParamKey_Colour, checkBox4.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//显示不同颜色
  3793. saveParamValue(ParamKey_AreaRatio, checkBox5.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//显示面积率
  3794. saveParamValue(ParamKey_AreaRatioRange, checkBox2.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//显示面积率
  3795. saveParamValue(ParamKey_AreaRatioRangeMin, numericUpDown6 != null ? numericUpDown6.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//面积率区间最小值
  3796. saveParamValue(ParamKey_AreaRatioRangeMax, numericUpDown7 != null ? numericUpDown7.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//面积率区间最大值
  3797. saveParamValue(ParamKey_DecimalPlace, numericUpDown1 != null ? numericUpDown1.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//保留小数位数
  3798. saveParamValue(ParamKey_panelColour1_08, colour != null ? colour[ParamKey_panelColour1_08].ToArgb().ToString() : Color.Orange.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//不同区间颜色
  3799. saveParamValue(ParamKey_panelColour08_06, colour != null ? colour[ParamKey_panelColour08_06].ToArgb().ToString() : Color.Blue.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//不同区间颜色
  3800. saveParamValue(ParamKey_panelColour06_04, colour != null ? colour[ParamKey_panelColour06_04].ToArgb().ToString() : Color.Green.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//不同区间颜色
  3801. saveParamValue(ParamKey_panelColour04_02, colour != null ? colour[ParamKey_panelColour04_02].ToArgb().ToString() : Color.Pink.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//不同区间颜色
  3802. saveParamValue(ParamKey_panelColour02_01, colour != null ? colour[ParamKey_panelColour02_01].ToArgb().ToString() : Color.Violet.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//不同区间颜色
  3803. saveParamValue(ParamKey_panelColour01_0, colour != null ? colour[ParamKey_panelColour01_0].ToArgb().ToString() : Color.Yellow.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//不同区间颜色
  3804. saveParamValue(ParamKey_FontSize, colourFont != null ? colourFont.Keys.First() : "12", (int)PaintDotNet.Base.Dtryt.Interger);//字体大小
  3805. saveParamValue(ParamKey_FontColour, colour != null ? colourFont.Values.First().ToArgb().ToString() : Color.Black.ToArgb().ToString(), (int)PaintDotNet.Base.Dtryt.Color);//字体颜色
  3806. }
  3807. /// <summary>
  3808. /// 获取保存的参数
  3809. /// </summary>
  3810. private void GetListParamModel()
  3811. {
  3812. if (this.analysisModel != null)
  3813. {
  3814. for (int i = 0; i < this.analysisModel.ListParam.Count; i++)
  3815. {
  3816. switch (this.analysisModel.ListParam[i].param_key)
  3817. {
  3818. case ParamKey_Report:
  3819. checkBox1.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3820. break;
  3821. case ParamKey_Screen:
  3822. checkBox3.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3823. break;
  3824. case ParamKey_ScreenMin:
  3825. areaMin = decimal.Parse(this.analysisModel.ListParam[i].param_value);
  3826. break;
  3827. case ParamKey_ScreenMax:
  3828. areaMax = decimal.Parse(this.analysisModel.ListParam[i].param_value);
  3829. break;
  3830. case ParamKey_Diameter:
  3831. checkBox6.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3832. break;
  3833. case ParamKey_Colour:
  3834. checkBox4.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3835. break;
  3836. case ParamKey_AreaRatio:
  3837. checkBox5.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3838. break;
  3839. case ParamKey_AreaRatioRange:
  3840. checkBox2.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3841. break;
  3842. case ParamKey_AreaRatioRangeMin:
  3843. areaRatioRangeMin = decimal.Parse(this.analysisModel.ListParam[i].param_value);
  3844. break;
  3845. case ParamKey_AreaRatioRangeMax:
  3846. areaRatioRangeMax = decimal.Parse(this.analysisModel.ListParam[i].param_value);
  3847. break;
  3848. case ParamKey_DecimalPlace:
  3849. numericUpDown1.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
  3850. break;
  3851. case ParamKey_panelColour1_08:
  3852. colour.Remove(ParamKey_panelColour1_08);
  3853. colour.Add(ParamKey_panelColour1_08, Color.FromArgb((int)this.analysisModel.ListParam[i].value));
  3854. break;
  3855. case ParamKey_panelColour08_06:
  3856. colour.Remove(ParamKey_panelColour08_06);
  3857. colour.Add(ParamKey_panelColour08_06, Color.FromArgb((int)this.analysisModel.ListParam[i].value));
  3858. break;
  3859. case ParamKey_panelColour06_04:
  3860. colour.Remove(ParamKey_panelColour06_04);
  3861. colour.Add(ParamKey_panelColour06_04, Color.FromArgb((int)this.analysisModel.ListParam[i].value));
  3862. break;
  3863. case ParamKey_panelColour04_02:
  3864. colour.Remove(ParamKey_panelColour04_02);
  3865. colour.Add(ParamKey_panelColour04_02, Color.FromArgb((int)this.analysisModel.ListParam[i].value));
  3866. break;
  3867. case ParamKey_panelColour02_01:
  3868. colour.Remove(ParamKey_panelColour02_01);
  3869. colour.Add(ParamKey_panelColour02_01, Color.FromArgb((int)this.analysisModel.ListParam[i].value));
  3870. break;
  3871. case ParamKey_panelColour01_0:
  3872. colour.Remove(ParamKey_panelColour01_0);
  3873. colour.Add(ParamKey_panelColour01_0, Color.FromArgb((int)this.analysisModel.ListParam[i].value));
  3874. break;
  3875. case ParamKey_FontSize:
  3876. fontSize = this.analysisModel.ListParam[i].value.ToString();
  3877. break;
  3878. case ParamKey_FontColour:
  3879. fontColour = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
  3880. break;
  3881. }
  3882. }
  3883. colourFont.Clear();
  3884. colourFont.Add(fontSize, fontColour);
  3885. }
  3886. }
  3887. #endregion
  3888. #region [脚本相关]
  3889. private void getValue(string key, object value)
  3890. {
  3891. switch (key)
  3892. {
  3893. case "parameter1":
  3894. checkBox3.Checked = Convert.ToBoolean(value);
  3895. break;
  3896. case "parameter2":
  3897. int min = Convert.ToInt32(value);
  3898. decimal minDec = Convert.ToDecimal(value);
  3899. if (bcBinaryChecked())
  3900. {
  3901. if (trackBar2.Minimum > min || trackBar2.Maximum < min)
  3902. {
  3903. trackBar2.Value = trackBar2.Minimum;
  3904. }
  3905. else
  3906. {
  3907. trackBar2.Value = min;
  3908. }
  3909. if (numericUpDown4.Minimum > min || numericUpDown4.Maximum < min)
  3910. {
  3911. numericUpDown4.Value = numericUpDown4.Minimum;
  3912. }
  3913. else
  3914. {
  3915. numericUpDown4.Value = minDec;
  3916. }
  3917. }
  3918. break;
  3919. case "parameter3":
  3920. int max = Convert.ToInt32(value);
  3921. decimal maxDec = Convert.ToDecimal(value);
  3922. if (bcBinaryChecked())
  3923. {
  3924. if (trackBar4.Minimum > max || trackBar4.Maximum < max)
  3925. {
  3926. trackBar4.Value = trackBar4.Maximum;
  3927. }
  3928. else
  3929. {
  3930. trackBar4.Value = max;
  3931. }
  3932. if (numericUpDown5.Minimum > max || numericUpDown5.Maximum < max)
  3933. {
  3934. numericUpDown5.Value = numericUpDown5.Maximum;
  3935. }
  3936. else
  3937. {
  3938. numericUpDown5.Value = maxDec;
  3939. }
  3940. }
  3941. break;
  3942. case "parameter4":
  3943. checkBox6.Checked = Convert.ToBoolean(value);
  3944. break;
  3945. case "parameter5":
  3946. checkBox4.Checked = Convert.ToBoolean(value);
  3947. break;
  3948. case "parameter6":
  3949. checkBox5.Checked = Convert.ToBoolean(value);
  3950. break;
  3951. case "parameter7":
  3952. fontSize = value.ToString();
  3953. colourFont.Clear();
  3954. colourFont.Add(fontSize, Color.Black);
  3955. break;
  3956. case "parameter8":
  3957. fontColour = Color.FromArgb((int)value);
  3958. if (colourFont.ContainsKey(fontSize))
  3959. {
  3960. colourFont[fontSize] = fontColour;
  3961. }
  3962. else
  3963. {
  3964. colourFont.Add("10", fontColour);
  3965. }
  3966. break;
  3967. case "parameter9":
  3968. if (colour.ContainsKey("panelColour1_08"))
  3969. {
  3970. colour["panelColour1_08"] = Color.FromArgb((int)value);
  3971. }
  3972. else
  3973. {
  3974. colour.Add("panelColour1_08", Color.FromArgb((int)value));
  3975. }
  3976. break;
  3977. case "parameter10":
  3978. if (colour.ContainsKey("panelColour08_06"))
  3979. {
  3980. colour["panelColour08_06"] = Color.FromArgb((int)value);
  3981. }
  3982. else
  3983. {
  3984. colour.Add("panelColour08_06", Color.FromArgb((int)value));
  3985. }
  3986. break;
  3987. case "parameter11":
  3988. if (colour.ContainsKey("panelColour06_04"))
  3989. {
  3990. colour["panelColour06_04"] = Color.FromArgb((int)value);
  3991. }
  3992. else
  3993. {
  3994. colour.Add("panelColour06_04", Color.FromArgb((int)value));
  3995. }
  3996. break;
  3997. case "parameter12":
  3998. if (colour.ContainsKey("panelColour04_02"))
  3999. {
  4000. colour["panelColour04_02"] = Color.FromArgb((int)value);
  4001. }
  4002. else
  4003. {
  4004. colour.Add("panelColour04_02", Color.FromArgb((int)value));
  4005. }
  4006. break;
  4007. case "parameter13":
  4008. if (colour.ContainsKey("panelColour02_01"))
  4009. {
  4010. colour["panelColour02_01"] = Color.FromArgb((int)value);
  4011. }
  4012. else
  4013. {
  4014. colour.Add("panelColour02_01", Color.FromArgb((int)value));
  4015. }
  4016. break;
  4017. case "parameter14":
  4018. if (colour.ContainsKey("panelColour01_0"))
  4019. {
  4020. colour["panelColour01_0"] = Color.FromArgb((int)value);
  4021. }
  4022. else
  4023. {
  4024. colour.Add("panelColour01_0", Color.FromArgb((int)value));
  4025. }
  4026. break;
  4027. case "parameter15":
  4028. int min2 = Convert.ToInt32(value);
  4029. decimal minDec2 = Convert.ToDecimal(value);
  4030. if (trackBar5.Minimum > min2 || trackBar5.Maximum < min2)
  4031. {
  4032. trackBar5.Value = trackBar5.Minimum;
  4033. }
  4034. else
  4035. {
  4036. trackBar5.Value = min2;
  4037. }
  4038. if (numericUpDown6.Minimum > minDec2 || numericUpDown6.Maximum < minDec2)
  4039. {
  4040. numericUpDown6.Value = numericUpDown6.Minimum;
  4041. }
  4042. else
  4043. {
  4044. numericUpDown6.Value = minDec2;
  4045. }
  4046. break;
  4047. case "parameter16":
  4048. int min3 = Convert.ToInt32(value);
  4049. decimal minDec3 = Convert.ToDecimal(value);
  4050. if (trackBar6.Minimum > min3 || trackBar6.Maximum < min3)
  4051. {
  4052. trackBar6.Value = trackBar6.Minimum;
  4053. }
  4054. else
  4055. {
  4056. trackBar6.Value = min3;
  4057. }
  4058. if (numericUpDown7.Minimum > minDec3 || numericUpDown7.Maximum < minDec3)
  4059. {
  4060. numericUpDown7.Value = numericUpDown7.Minimum;
  4061. }
  4062. else
  4063. {
  4064. numericUpDown7.Value = minDec3;
  4065. }
  4066. break;
  4067. case "OpenWhileExportReport":
  4068. checkBox1.Checked = Convert.ToBoolean(value);
  4069. break;
  4070. case "CalculatorDecimalDigits":
  4071. numericUpDown1.Value = Convert.ToDecimal(value);
  4072. break;
  4073. }
  4074. }
  4075. #endregion
  4076. #region [脚本录制]
  4077. private void getScriptRecording()
  4078. {
  4079. string className = InvariantData.path_Action + ".Action" + menuId;
  4080. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  4081. List<Args> args = param.Lists;
  4082. foreach (var item in args)
  4083. {
  4084. item.value = setScriptRecording(item.key);
  4085. }
  4086. //找出二值相关参数 进行赋值
  4087. List<Args> isNullList = args.Where(m => m.value == null).ToList();
  4088. foreach (var item in isNullList)
  4089. {
  4090. item.value = binaryClass.setScriptRecording(item.key);
  4091. }
  4092. appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
  4093. }
  4094. private object setScriptRecording(string key)
  4095. {
  4096. object value = null;
  4097. switch (key)
  4098. {
  4099. case "parameter1":
  4100. value = checkBox3.Checked;
  4101. break;
  4102. case "parameter2":
  4103. value = trackBar2.Value;
  4104. break;
  4105. case "parameter3":
  4106. value = trackBar4.Value;
  4107. break;
  4108. case "parameter4":
  4109. value = checkBox6.Checked;
  4110. break;
  4111. case "parameter5":
  4112. value = checkBox4.Checked;
  4113. break;
  4114. case "parameter6":
  4115. value = checkBox5.Checked;
  4116. break;
  4117. case "parameter7":
  4118. value = fontSize;
  4119. break;
  4120. case "parameter8":
  4121. value = fontColour.ToArgb();
  4122. break;
  4123. case "parameter9":
  4124. if (colour.ContainsKey("panelColour1_08"))
  4125. {
  4126. value = colour["panelColour1_08"].ToArgb();
  4127. }
  4128. else
  4129. {
  4130. value = Color.Orange.ToArgb();
  4131. }
  4132. break;
  4133. case "parameter10":
  4134. if (colour.ContainsKey("panelColour08_06"))
  4135. {
  4136. value = colour["panelColour08_06"].ToArgb();
  4137. }
  4138. else
  4139. {
  4140. value = Color.Blue.ToArgb();
  4141. }
  4142. break;
  4143. case "parameter11":
  4144. if (colour.ContainsKey("panelColour06_04"))
  4145. {
  4146. value = colour["panelColour06_04"].ToArgb();
  4147. }
  4148. else
  4149. {
  4150. value = Color.Green.ToArgb();
  4151. }
  4152. break;
  4153. case "parameter12":
  4154. if (colour.ContainsKey("panelColour04_02"))
  4155. {
  4156. value = colour["panelColour04_02"].ToArgb();
  4157. }
  4158. else
  4159. {
  4160. value = Color.Pink.ToArgb();
  4161. }
  4162. break;
  4163. case "parameter13":
  4164. if (colour.ContainsKey("panelColour02_01"))
  4165. {
  4166. value = colour["panelColour02_01"].ToArgb();
  4167. }
  4168. else
  4169. {
  4170. value = Color.Purple.ToArgb();
  4171. }
  4172. break;
  4173. case "parameter14":
  4174. if (colour.ContainsKey("panelColour01_0"))
  4175. {
  4176. value = colour["panelColour01_0"].ToArgb();
  4177. }
  4178. else
  4179. {
  4180. value = Color.Yellow.ToArgb();
  4181. }
  4182. break;
  4183. case "parameter15":
  4184. value = trackBar5.Value;
  4185. break;
  4186. case "parameter16":
  4187. value = trackBar6.Value;
  4188. break;
  4189. case "OpenWhileExportReport":
  4190. value = checkBox1.Checked;
  4191. break;
  4192. case "CalculatorDecimalDigits":
  4193. value = numericUpDown1.Value;
  4194. break;
  4195. case "ExportResults":
  4196. value = false;
  4197. break;
  4198. case "ExportReports":
  4199. value = false;
  4200. break;
  4201. case "ExportProjects":
  4202. value = false;
  4203. break;
  4204. }
  4205. return value;
  4206. }
  4207. #endregion
  4208. }
  4209. }