PearliteNumberDialog.cs 220 KB

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