SpheroidizationTypeDialog.cs 224 KB

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