VermiculateCastIronGBT26656Classification.cs 210 KB

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