GrayironDialog.cs 242 KB

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