GrainSizePointCountingMethodDialog.cs 256 KB

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