RecombinationRateDialog.cs 573 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529
  1. using PaintDotNet.Base.CommTool;
  2. using PaintDotNet.Base.SettingModel;
  3. using PaintDotNet.DedicatedAnalysis;
  4. using System;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Drawing.Drawing2D;
  11. using System.IO;
  12. using System.Windows.Forms;
  13. using PaintDotNet.CustomControl;
  14. using PaintDotNet.DbOpreate.DbBll;
  15. using PaintDotNet.DbOpreate.DbModel;
  16. using PaintDotNet.Annotation;
  17. using PaintDotNet.Base.Functionodel;
  18. using static PaintDotNet.Base.DedicatedAnalysis.Inclusions.MethodOfAssessment;
  19. using PaintDotNet.Annotation.Enum;
  20. using OpenCvSharp;
  21. using Point = System.Drawing.Point;
  22. using PaintDotNet.Instrument;
  23. using OpenCvSharp.Extensions;
  24. using System.Linq;
  25. using Metis.ParameterSet;
  26. using PaintDotNet.Data.Param;
  27. using PaintDotNet.Base;
  28. namespace PaintDotNet
  29. {
  30. /// <summary>
  31. /// 复合率
  32. /// </summary>
  33. internal class RecombinationRateDialog : PdnBaseForm
  34. {
  35. #region 控件
  36. private GroupBox groupBox1;
  37. private Button button2;
  38. private CheckBox checkBox2;
  39. private CheckBox checkBox1;
  40. private GroupBox groupBox2;
  41. private GroupBox groupBox3;
  42. private Button button4;
  43. private Button button3;
  44. private ComboBox comboBox1;
  45. private GroupBox groupBox4;
  46. private Button button5;
  47. private TextBox textBox2;
  48. private TextBox textBox1;
  49. private Label label2;
  50. private Label label1;
  51. private DataGridView dataGridView1;
  52. private GroupBox groupBox5;
  53. private DataGridView dataGridView2;
  54. private Button button8;
  55. private Button button7;
  56. private Button button6;
  57. private GroupBox groupBox6;
  58. private Button button10;
  59. private Button button9;
  60. private GroupBox groupBox7;
  61. private GroupBox groupBox8;
  62. private Label label5;
  63. private Button button14;
  64. private Button button13;
  65. private DataGridView dataGridView4;
  66. private Button button12;
  67. private Button button11;
  68. private ListView listView1;
  69. private Button button1;
  70. #endregion
  71. #region 辅助线样式
  72. /// <summary>
  73. /// 线条数
  74. /// </summary>
  75. private int linesNumber;
  76. /// <summary>
  77. /// 线颜色
  78. /// </summary>
  79. private int lineColor;
  80. /// <summary>
  81. /// 线宽
  82. /// </summary>
  83. private int lineWidth;
  84. /// <summary>
  85. /// 间距
  86. /// </summary>
  87. private float lineSpacing;
  88. /// <summary>
  89. /// 文字字体
  90. /// </summary>
  91. private string lineFont;
  92. /// <summary>
  93. /// 文字字号
  94. /// </summary>
  95. private int lineFontSize;
  96. #endregion
  97. #region 测量点样式
  98. /// <summary>
  99. /// 点颜色
  100. /// </summary>
  101. private int pointColor;
  102. /// <summary>
  103. /// 点样式 0:空心 1:实心
  104. /// </summary>
  105. private int pointStyle;
  106. /// <summary>
  107. /// 点宽度
  108. /// </summary>
  109. private int pointWidth;
  110. /// <summary>
  111. /// 直径
  112. /// </summary>
  113. private float pointDiameter;
  114. /// <summary>
  115. /// 文字字体
  116. /// </summary>
  117. private string pointFont;
  118. /// <summary>
  119. /// 文字字号
  120. /// </summary>
  121. private int pointFontSize;
  122. /// <summary>
  123. /// 显示点标记符号 true:显示 false:不显示
  124. /// </summary>
  125. private bool pointMarkerSymbol;
  126. /// <summary>
  127. /// 小数
  128. /// </summary>
  129. private int decimalCls;
  130. /// <summary>
  131. /// 是否全部显示
  132. /// </summary>
  133. private bool allShow = false;
  134. #endregion
  135. #region 控制测量点个数
  136. /// <summary>
  137. /// 控制测量点个数
  138. /// </summary>
  139. private List<int> pointCountA1 = new List<int>();
  140. private List<int> pointCountA2 = new List<int>();
  141. private List<int> pointCountA3 = new List<int>();
  142. private List<int> pointCountB1 = new List<int>();
  143. private List<int> pointCountB2 = new List<int>();
  144. private List<int> pointCountB3 = new List<int>();
  145. private List<int> pointCountB4 = new List<int>();
  146. private List<int> pointCountC1 = new List<int>();
  147. private List<int> pointCountC2 = new List<int>();
  148. private List<int> pointCountC3 = new List<int>();
  149. private List<int> pointCountC4 = new List<int>();
  150. private List<int> pointCountC5 = new List<int>();
  151. #endregion
  152. private PointF m_StartPoint = Point.Empty;
  153. private bool m_canMove;
  154. /// <summary>
  155. /// 辅助线上可绘制的点数
  156. /// </summary>
  157. private int pointDrawCount;
  158. /// <summary>
  159. /// 辅助线线条数是否可改变
  160. /// </summary>
  161. private bool lineChange = true;
  162. /// <summary>
  163. /// 样品测量点记录
  164. /// </summary>
  165. private List<DataTable> pointDataTables = new List<DataTable>();
  166. /// <summary>
  167. /// 图片测量记录
  168. /// </summary>
  169. private List<DataTable> pictureDataTables = new List<DataTable>();
  170. /// <summary>
  171. /// 测量点
  172. /// </summary>
  173. public List<List<RectangleF>> pointRectangleFs = new List<List<RectangleF>>();
  174. /// <summary>
  175. /// 0:添加 1:选择 2:删除
  176. /// </summary>
  177. private int operationK = -1;
  178. /// <summary>
  179. /// 被选择的点
  180. /// </summary>
  181. private int selected = -1;
  182. /// <summary>
  183. /// 获取鼠标位置
  184. /// </summary>
  185. private int mouseX = 0;
  186. private int mouseY = 0;
  187. /// <summary>
  188. /// 数据变化
  189. /// </summary>
  190. private bool saveSuccess = false;
  191. /// <summary>
  192. /// 是否开始绘制测量点
  193. /// </summary>
  194. private bool pointDrawkb = false;
  195. /// <summary>
  196. /// 是否选择了图片
  197. /// </summary>
  198. private bool selectPicture = false;
  199. /// <summary>
  200. /// 工件类型
  201. /// </summary>
  202. private string type;
  203. private string oldValue;
  204. public string selectItemValue;
  205. /// <summary>
  206. /// 主控件
  207. /// </summary>
  208. private AppWorkspace appWorkspace;
  209. private ImageList imageList1;
  210. private IContainer components;
  211. /// <summary>
  212. /// 选中图片的bitmap
  213. /// </summary>
  214. private Bitmap bitmap;
  215. /// <summary>
  216. /// 图像面板
  217. /// </summary>
  218. private DocumentWorkspaceWindow documentWorkspace;
  219. private Dictionary<int, DocumentItem> documentItems;
  220. /// <summary>
  221. /// 公共按钮
  222. /// </summary>
  223. private CommonControlButtons commonControlButtons;
  224. private Button button15;
  225. /// <summary>
  226. /// 保存用于生成报告的图片
  227. /// </summary>
  228. private List<Bitmap> bitList;
  229. /// <summary>
  230. /// 储存点击保存结果后的所有原图与分析图
  231. /// </summary>
  232. private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
  233. private Dictionary<string, List<Bitmap>> bitDic1 = new Dictionary<string, List<Bitmap>>();
  234. private int changeCount;
  235. /// <summary>
  236. /// 工件类型
  237. /// </summary>
  238. private const string constTypeA = "a";
  239. private const string constTypeB = "b";
  240. private const string constTypeC = "c";
  241. private const string constTypeD = "d";
  242. private const string constTypeE = "e";
  243. /// <summary>
  244. /// 单位
  245. /// </summary>
  246. private double unitLength;
  247. /// <summary>
  248. /// 中间数据
  249. /// </summary>
  250. private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
  251. /// <summary>
  252. /// 第一条线的各点截距
  253. /// </summary>
  254. private List<List<decimal>> lengthL1 = new List<List<decimal>>();
  255. /// <summary>
  256. /// 第二条线的各点截距
  257. /// </summary>
  258. private List<List<decimal>> lengthL2 = new List<List<decimal>>();
  259. /// <summary>
  260. /// 第三条线的各点截距
  261. /// </summary>
  262. private List<List<decimal>> lengthL3 = new List<List<decimal>>();
  263. /// <summary>
  264. /// 第四条线的各点截距
  265. /// </summary>
  266. private List<List<decimal>> lengthL4 = new List<List<decimal>>();
  267. /// <summary>
  268. /// 第五条线的各点截距
  269. /// </summary>
  270. private List<List<decimal>> lengthL5 = new List<List<decimal>>();
  271. private Button button16;
  272. private NumericUpDown numericUpDown1;
  273. private ListView listView2;
  274. private DataGridView dataGridView3;
  275. private Button button17;
  276. private DataGridViewTextBoxColumn Column1;
  277. private DataGridViewTextBoxColumn Column2;
  278. private DataGridViewTextBoxColumn Column3;
  279. private DataGridViewTextBoxColumn Column4;
  280. private DataGridViewTextBoxColumn Column5;
  281. private DataGridViewTextBoxColumn Column6;
  282. private DataGridViewTextBoxColumn Column7;
  283. private DataGridViewTextBoxColumn Column8;
  284. private DataGridViewTextBoxColumn Column9;
  285. private DataGridViewTextBoxColumn Column10;
  286. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
  287. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
  288. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
  289. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
  290. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
  291. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
  292. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
  293. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;
  294. private DataGridViewTextBoxColumn pointName;
  295. private DataGridViewTextBoxColumn pointDeviation;
  296. private DataGridViewTextBoxColumn pointL1;
  297. private DataGridViewTextBoxColumn pointL2;
  298. private DataGridViewTextBoxColumn pointL3;
  299. private DataGridViewTextBoxColumn pointL4;
  300. private DataGridViewTextBoxColumn pointL5;
  301. private DataGridViewTextBoxColumn pointAverage;
  302. private DataGridViewTextBoxColumn nname;
  303. private DataGridViewTextBoxColumn explain;
  304. private DataGridViewTextBoxColumn operation;
  305. private DataGridViewTextBoxColumn Column11;
  306. private WorkpieceMaintenanceModel workpieceMaintenanceModel = new WorkpieceMaintenanceModel();
  307. private int defaultIndex = -1;
  308. private int menuId;
  309. private string menuName;
  310. /// <summary>
  311. /// 是否脚本运行
  312. /// </summary>
  313. private Boolean initScriptValues = false;
  314. // <summary>
  315. /// 保存窗口参数
  316. /// </summary>
  317. private GrainSizeAnalysisModel analysisModel;
  318. private const string ParamKey_ShowData = "showData";//显示数据
  319. private const string ParamKey_Report = "report";//报告设置
  320. private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数
  321. public RecombinationRateDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem)
  322. {
  323. this.menuId = menuItem.MenuId;
  324. this.menuName = menuItem.Text;
  325. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  326. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  327. this.analysisModel = analysisModelXml.cloneListParamModel(this.menuId);
  328. foreach (var item in this.analysisModel.ListParam)
  329. item.setValue();
  330. InitializeComponent();
  331. InitializeLanguageText();
  332. this.button3.Visible = true;
  333. this.button15.Visible = false;
  334. this.button11.Visible = true;
  335. this.button16.Visible = false;
  336. this.appWorkspace = appWorkspace;
  337. //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength);
  338. //
  339. //初始化图像控件
  340. //
  341. this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
  342. this.documentWorkspace.Dock = DockStyle.Fill;
  343. this.documentWorkspace.HookMouseEvents();
  344. this.documentWorkspace.AuxiliaryLineEnabled = false;
  345. this.documentWorkspace.Visible = false;
  346. this.groupBox7.Controls.Add(documentWorkspace);
  347. //
  348. //初始化操作按钮
  349. //
  350. this.commonControlButtons = new CommonControlButtons();
  351. this.commonControlButtons.Dock = DockStyle.Top;
  352. this.commonControlButtons.Height = 30;
  353. this.commonControlButtons.HideZoomToWindowAndActualSize();
  354. this.commonControlButtons.Visible = false;
  355. this.groupBox7.Controls.Add(commonControlButtons);
  356. /// 测量点操作限制
  357. this.button6.Enabled = this.pointDrawkb;
  358. this.button7.Enabled = this.pointDrawkb;
  359. this.button8.Enabled = this.pointDrawkb;
  360. //初始化头
  361. this.listView2.View = View.Details;
  362. ColumnHeader header0 = new ColumnHeader();
  363. header0.Text = "";
  364. header0.Width = 180;
  365. this.listView2.Columns.Add(header0);
  366. documentWorkspace.panel.MouseDown += OnMouseDown;
  367. documentWorkspace.panel.Paint += Panel_Paint;
  368. documentWorkspace.panel.MouseMove += onMouseMove;
  369. documentWorkspace.panel.MouseUp += onMouseUp;
  370. //如果是脚本执行,将参数带入
  371. if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
  372. {
  373. this.initScriptValues = true;//ScriptAutomatic
  374. //Boolean initScriptValues = true;
  375. ////在这里反射出对应功能的参数类
  376. string className = InvariantData.path_Action + ".Action" + menuId;
  377. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  378. foreach (Args arg in param.Lists)
  379. {
  380. Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
  381. if (param1.value != null)
  382. arg.Value = param1.value;
  383. getValue(arg.key, arg.Value);
  384. }
  385. appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
  386. }
  387. else
  388. {//读取上次关闭窗口时保存的参数
  389. GetListParamModel();
  390. }
  391. InitPicList();
  392. RefreshCombobox();
  393. RefreshPanel();
  394. InitCommonButtonEvent();
  395. //SetStyle(ControlStyles.UserPaint, true);
  396. //SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
  397. //SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
  398. SetAnalyzeModelFromXml("Template.Manager.item3.RecombinationRate");
  399. foreach (DataGridViewColumn item in this.dataGridView1.Columns)
  400. {
  401. item.SortMode = DataGridViewColumnSortMode.NotSortable;
  402. }
  403. for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
  404. {
  405. this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  406. }
  407. for (int i = 0; i < this.dataGridView2.Columns.Count; i++)
  408. {
  409. this.dataGridView2.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  410. }
  411. for (int i = 0; i < this.dataGridView3.Columns.Count; i++)
  412. {
  413. this.dataGridView3.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  414. }
  415. for (int i = 0; i < this.dataGridView4.Columns.Count; i++)
  416. {
  417. this.dataGridView4.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  418. }
  419. }
  420. private void InitCommonButtonEvent()
  421. {
  422. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  423. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  424. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  425. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  426. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  427. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  428. }
  429. private void zoomInButton_Click(object sender, EventArgs e)
  430. {
  431. this.documentWorkspace.ZoomIn();
  432. }
  433. private void zoomOutButton_Click(object sender, EventArgs e)
  434. {
  435. this.documentWorkspace.ZoomOut();
  436. }
  437. private void zoomToWindowButton_Click(object sender, EventArgs e)
  438. {
  439. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  440. }
  441. private void actualSizeButton_Click(object sender, EventArgs e)
  442. {
  443. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  444. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  445. }
  446. private void pointerButton_Click(object sender, EventArgs e)
  447. {
  448. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
  449. }
  450. private void mobileModeButton_Click(object sender, EventArgs e)
  451. {
  452. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  453. }
  454. private void ShowImgEvent(object sender, EventArgs e)
  455. {
  456. listView1.Focus();
  457. if (this.defaultIndex != -1)
  458. {
  459. this.listView1.Items[defaultIndex].Focused = true;
  460. this.listView1.Items[defaultIndex].Selected = true;
  461. }
  462. }
  463. /// <summary>
  464. /// 初始化图片列表数据
  465. /// </summary>
  466. public void InitPicList()
  467. {
  468. this.documentItems = new Dictionary<int, DocumentItem>();
  469. // 构造工作结构
  470. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  471. {
  472. Bitmap bitmap = this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.CreateAliasedBitmap();
  473. GraphicsList graphicsList = new GraphicsList();
  474. for (int j = 0; j < this.appWorkspace.DocumentWorkspaces[i].GraphicsList.Count; j++)
  475. {
  476. graphicsList.Add(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[j]);
  477. }
  478. List<PhaseModel> phaseModels = new List<PhaseModel>();
  479. //二值化相关
  480. PhaseModel analysisModel = this.appWorkspace.DocumentWorkspaces[i].AnalysisPhaseModel;
  481. if (analysisModel == null)
  482. {
  483. }
  484. else
  485. phaseModels.Add(analysisModel);
  486. this.documentItems.Add(i, new DocumentItem(bitmap, graphicsList, phaseModels));
  487. }
  488. //初始化图片列表
  489. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  490. {
  491. this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  492. this.listView1.Items.Add("", i);
  493. this.listView1.Items[i].ImageIndex = i;
  494. this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  495. this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  496. if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
  497. {
  498. defaultIndex = i;
  499. }
  500. }
  501. this.Shown += ShowImgEvent;
  502. }
  503. internal class DocumentItem
  504. {
  505. public Bitmap bitmap;
  506. public GraphicsList graphicsList;
  507. public List<PhaseModel> phaseModels;
  508. public AnalysisResult analysisResult;
  509. public DocumentItem(Bitmap bitmap, GraphicsList graphicsList, List<PhaseModel> phaseModels)
  510. {
  511. this.bitmap = bitmap;
  512. this.graphicsList = graphicsList;
  513. this.phaseModels = phaseModels;
  514. }
  515. }
  516. #region 初始化
  517. private void InitializeLanguageText()
  518. {
  519. this.button1.Text = PdnResources.GetString("Menu.Setting.Text");
  520. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  521. this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
  522. this.checkBox2.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  523. this.checkBox1.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.Displaydataontheimage.text");
  524. this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  525. this.groupBox3.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.artifactselect.text");
  526. this.button15.Text = PdnResources.GetString("Menu.Stopmeasure.text");
  527. this.button4.Text = PdnResources.GetString("Menu.Setting.Text");
  528. this.button3.Text = PdnResources.GetString("Menu.Startmeasuring.text");
  529. this.groupBox4.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Samplemaintenance.text");
  530. this.nname.HeaderText = PdnResources.GetString("Menu.name.text");
  531. this.operation.HeaderText = PdnResources.GetString("Menu.operation.text");
  532. this.Column11.HeaderText = PdnResources.GetString("Menu.operation.text");
  533. this.button5.Text = PdnResources.GetString("CommonAction.Save");
  534. this.label2.Text = PdnResources.GetString("Menu.instruction.text") + ":";
  535. this.label1.Text = PdnResources.GetString("Menu.samplename.text") + ":";
  536. this.groupBox5.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Measuringpointrecord.text");
  537. this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.name.text");
  538. this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.Targetvalue/deviation.text");
  539. this.dataGridViewTextBoxColumn8.HeaderText = PdnResources.GetString("Menu.Image.Average.Text") + "%";
  540. this.pointName.HeaderText = PdnResources.GetString("Menu.name.text");
  541. this.pointDeviation.HeaderText = PdnResources.GetString("Menu.Targetvalue/deviation.text");
  542. this.pointAverage.HeaderText = PdnResources.GetString("Menu.Image.Average.Text") + "%";
  543. this.button8.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Selectcompoundnode.text");
  544. this.button7.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Deletecompoundnode.text");
  545. this.button6.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Addcompoundnode.text");
  546. this.groupBox6.Text = PdnResources.GetString("Menu.othersettings.text");
  547. this.button10.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Measurinsetting.text");
  548. this.button9.Text = PdnResources.GetString("Menu.Auxiliarylinesettings.text");
  549. this.groupBox7.Text = PdnResources.GetString("Menu.Preview.text");
  550. this.groupBox8.Text = PdnResources.GetString("Menu.Analysisresult.text");
  551. this.button17.Text = PdnResources.GetString("Menu.Exportproject.text");
  552. this.button16.Text = PdnResources.GetString("Menu.Cancelshowall.text");
  553. this.label5.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
  554. this.button14.Text = PdnResources.GetString("Menu.Exportresults.text");
  555. this.button13.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  556. this.Column1.HeaderText = PdnResources.GetString("Menu.picture.Text");
  557. this.Column2.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.sample.text");
  558. this.Column3.HeaderText = PdnResources.GetString("Menu.name.text");
  559. this.Column4.HeaderText = PdnResources.GetString("Menu.Targetvalue/deviation.text");
  560. this.Column10.HeaderText = PdnResources.GetString("Menu.Image.Average.Text") + "%";
  561. this.button12.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  562. this.button11.Text = PdnResources.GetString("Menu.Showall.text");
  563. this.Text = PdnResources.GetString("Menu.DedicatedAnalysis.NonferrousMetal.RecombinationRate.Text");
  564. this.explain.HeaderText = PdnResources.GetString("Menu.instruction.text");
  565. }
  566. private void InitializeComponent()
  567. {
  568. this.components = new System.ComponentModel.Container();
  569. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  570. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
  571. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
  572. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
  573. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
  574. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
  575. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
  576. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
  577. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
  578. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
  579. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
  580. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
  581. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
  582. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
  583. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
  584. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
  585. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
  586. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
  587. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
  588. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
  589. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
  590. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
  591. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();
  592. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle();
  593. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle();
  594. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle();
  595. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();
  596. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle();
  597. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle();
  598. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle();
  599. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle();
  600. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle();
  601. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle();
  602. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle();
  603. this.button1 = new System.Windows.Forms.Button();
  604. this.groupBox1 = new System.Windows.Forms.GroupBox();
  605. this.button2 = new System.Windows.Forms.Button();
  606. this.checkBox2 = new System.Windows.Forms.CheckBox();
  607. this.checkBox1 = new System.Windows.Forms.CheckBox();
  608. this.groupBox2 = new System.Windows.Forms.GroupBox();
  609. this.listView1 = new System.Windows.Forms.ListView();
  610. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  611. this.groupBox3 = new System.Windows.Forms.GroupBox();
  612. this.button15 = new System.Windows.Forms.Button();
  613. this.button4 = new System.Windows.Forms.Button();
  614. this.button3 = new System.Windows.Forms.Button();
  615. this.comboBox1 = new System.Windows.Forms.ComboBox();
  616. this.groupBox4 = new System.Windows.Forms.GroupBox();
  617. this.dataGridView1 = new System.Windows.Forms.DataGridView();
  618. this.nname = new System.Windows.Forms.DataGridViewTextBoxColumn();
  619. this.explain = new System.Windows.Forms.DataGridViewTextBoxColumn();
  620. this.operation = new System.Windows.Forms.DataGridViewTextBoxColumn();
  621. this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  622. this.button5 = new System.Windows.Forms.Button();
  623. this.textBox2 = new System.Windows.Forms.TextBox();
  624. this.textBox1 = new System.Windows.Forms.TextBox();
  625. this.label2 = new System.Windows.Forms.Label();
  626. this.label1 = new System.Windows.Forms.Label();
  627. this.groupBox5 = new System.Windows.Forms.GroupBox();
  628. this.dataGridView3 = new System.Windows.Forms.DataGridView();
  629. this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  630. this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  631. this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  632. this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  633. this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  634. this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  635. this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  636. this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  637. this.dataGridView2 = new System.Windows.Forms.DataGridView();
  638. this.pointName = new System.Windows.Forms.DataGridViewTextBoxColumn();
  639. this.pointDeviation = new System.Windows.Forms.DataGridViewTextBoxColumn();
  640. this.pointL1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  641. this.pointL2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  642. this.pointL3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  643. this.pointL4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  644. this.pointL5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  645. this.pointAverage = new System.Windows.Forms.DataGridViewTextBoxColumn();
  646. this.button8 = new System.Windows.Forms.Button();
  647. this.button7 = new System.Windows.Forms.Button();
  648. this.button6 = new System.Windows.Forms.Button();
  649. this.groupBox6 = new System.Windows.Forms.GroupBox();
  650. this.button10 = new System.Windows.Forms.Button();
  651. this.button9 = new System.Windows.Forms.Button();
  652. this.groupBox7 = new System.Windows.Forms.GroupBox();
  653. this.groupBox8 = new System.Windows.Forms.GroupBox();
  654. this.button17 = new System.Windows.Forms.Button();
  655. this.listView2 = new System.Windows.Forms.ListView();
  656. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  657. this.button16 = new System.Windows.Forms.Button();
  658. this.label5 = new System.Windows.Forms.Label();
  659. this.button14 = new System.Windows.Forms.Button();
  660. this.button13 = new System.Windows.Forms.Button();
  661. this.dataGridView4 = new System.Windows.Forms.DataGridView();
  662. this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  663. this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  664. this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  665. this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  666. this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  667. this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  668. this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  669. this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  670. this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  671. this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  672. this.button12 = new System.Windows.Forms.Button();
  673. this.button11 = new System.Windows.Forms.Button();
  674. this.groupBox1.SuspendLayout();
  675. this.groupBox2.SuspendLayout();
  676. this.groupBox3.SuspendLayout();
  677. this.groupBox4.SuspendLayout();
  678. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
  679. this.groupBox5.SuspendLayout();
  680. ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit();
  681. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
  682. this.groupBox6.SuspendLayout();
  683. this.groupBox8.SuspendLayout();
  684. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  685. ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).BeginInit();
  686. this.SuspendLayout();
  687. //
  688. // button1
  689. //
  690. this.button1.BackColor = System.Drawing.SystemColors.Control;
  691. this.button1.Location = new System.Drawing.Point(15, 14);
  692. this.button1.Name = "button1";
  693. this.button1.Size = new System.Drawing.Size(84, 30);
  694. this.button1.TabIndex = 0;
  695. this.button1.UseVisualStyleBackColor = false;
  696. this.button1.Click += new System.EventHandler(this.button1_Click);
  697. //
  698. // groupBox1
  699. //
  700. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  701. | System.Windows.Forms.AnchorStyles.Right)));
  702. this.groupBox1.Controls.Add(this.button2);
  703. this.groupBox1.Controls.Add(this.checkBox2);
  704. this.groupBox1.Controls.Add(this.checkBox1);
  705. this.groupBox1.Controls.Add(this.button1);
  706. this.groupBox1.Location = new System.Drawing.Point(14, 3);
  707. this.groupBox1.Name = "groupBox1";
  708. this.groupBox1.Size = new System.Drawing.Size(1081, 50);
  709. this.groupBox1.TabIndex = 1;
  710. this.groupBox1.TabStop = false;
  711. //
  712. // button2
  713. //
  714. this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  715. this.button2.BackColor = System.Drawing.SystemColors.Control;
  716. this.button2.Location = new System.Drawing.Point(985, 14);
  717. this.button2.Name = "button2";
  718. this.button2.Size = new System.Drawing.Size(84, 30);
  719. this.button2.TabIndex = 3;
  720. this.button2.UseVisualStyleBackColor = false;
  721. this.button2.Click += new System.EventHandler(this.button2_Click);
  722. //
  723. // checkBox2
  724. //
  725. this.checkBox2.AutoSize = true;
  726. this.checkBox2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
  727. this.checkBox2.Location = new System.Drawing.Point(288, 25);
  728. this.checkBox2.Name = "checkBox2";
  729. this.checkBox2.Size = new System.Drawing.Size(15, 14);
  730. this.checkBox2.TabIndex = 2;
  731. this.checkBox2.UseVisualStyleBackColor = true;
  732. //
  733. // checkBox1
  734. //
  735. this.checkBox1.AutoSize = true;
  736. this.checkBox1.Location = new System.Drawing.Point(114, 25);
  737. this.checkBox1.MaximumSize = new System.Drawing.Size(200, 200);
  738. this.checkBox1.Name = "checkBox1";
  739. this.checkBox1.Size = new System.Drawing.Size(15, 14);
  740. this.checkBox1.TabIndex = 1;
  741. this.checkBox1.UseVisualStyleBackColor = true;
  742. this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
  743. //
  744. // groupBox2
  745. //
  746. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  747. | System.Windows.Forms.AnchorStyles.Left)));
  748. this.groupBox2.Controls.Add(this.listView1);
  749. this.groupBox2.Location = new System.Drawing.Point(14, 59);
  750. this.groupBox2.Name = "groupBox2";
  751. this.groupBox2.Size = new System.Drawing.Size(135, 497);
  752. this.groupBox2.TabIndex = 2;
  753. this.groupBox2.TabStop = false;
  754. //
  755. // listView1
  756. //
  757. this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  758. | System.Windows.Forms.AnchorStyles.Left)
  759. | System.Windows.Forms.AnchorStyles.Right)));
  760. this.listView1.HideSelection = false;
  761. this.listView1.LargeImageList = this.imageList1;
  762. this.listView1.Location = new System.Drawing.Point(5, 17);
  763. this.listView1.MultiSelect = false;
  764. this.listView1.Name = "listView1";
  765. this.listView1.Size = new System.Drawing.Size(124, 474);
  766. this.listView1.TabIndex = 0;
  767. this.listView1.UseCompatibleStateImageBehavior = false;
  768. this.listView1.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView1_ItemSelectionChanged);
  769. this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
  770. this.listView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDown);
  771. this.listView1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseUp);
  772. //
  773. // imageList1
  774. //
  775. this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  776. this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
  777. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  778. //
  779. // groupBox3
  780. //
  781. this.groupBox3.Controls.Add(this.button15);
  782. this.groupBox3.Controls.Add(this.button4);
  783. this.groupBox3.Controls.Add(this.button3);
  784. this.groupBox3.Controls.Add(this.comboBox1);
  785. this.groupBox3.Location = new System.Drawing.Point(153, 59);
  786. this.groupBox3.Name = "groupBox3";
  787. this.groupBox3.Size = new System.Drawing.Size(356, 51);
  788. this.groupBox3.TabIndex = 4;
  789. this.groupBox3.TabStop = false;
  790. //
  791. // button15
  792. //
  793. this.button15.BackColor = System.Drawing.SystemColors.Control;
  794. this.button15.Location = new System.Drawing.Point(195, 15);
  795. this.button15.Name = "button15";
  796. this.button15.Size = new System.Drawing.Size(106, 26);
  797. this.button15.TabIndex = 6;
  798. this.button15.UseVisualStyleBackColor = false;
  799. this.button15.Click += new System.EventHandler(this.button15_Click);
  800. //
  801. // button4
  802. //
  803. this.button4.BackColor = System.Drawing.SystemColors.Control;
  804. this.button4.Location = new System.Drawing.Point(302, 15);
  805. this.button4.Name = "button4";
  806. this.button4.Size = new System.Drawing.Size(53, 26);
  807. this.button4.TabIndex = 5;
  808. this.button4.UseVisualStyleBackColor = false;
  809. this.button4.Click += new System.EventHandler(this.button4_Click);
  810. //
  811. // button3
  812. //
  813. this.button3.BackColor = System.Drawing.SystemColors.Control;
  814. this.button3.Location = new System.Drawing.Point(195, 15);
  815. this.button3.Name = "button3";
  816. this.button3.Size = new System.Drawing.Size(106, 26);
  817. this.button3.TabIndex = 4;
  818. this.button3.UseVisualStyleBackColor = false;
  819. this.button3.Click += new System.EventHandler(this.button3_Click);
  820. //
  821. // comboBox1
  822. //
  823. this.comboBox1.FormattingEnabled = true;
  824. this.comboBox1.Location = new System.Drawing.Point(16, 17);
  825. this.comboBox1.Name = "comboBox1";
  826. this.comboBox1.Size = new System.Drawing.Size(173, 20);
  827. this.comboBox1.TabIndex = 0;
  828. //
  829. // groupBox4
  830. //
  831. this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  832. | System.Windows.Forms.AnchorStyles.Left)));
  833. this.groupBox4.Controls.Add(this.dataGridView1);
  834. this.groupBox4.Controls.Add(this.button5);
  835. this.groupBox4.Controls.Add(this.textBox2);
  836. this.groupBox4.Controls.Add(this.textBox1);
  837. this.groupBox4.Controls.Add(this.label2);
  838. this.groupBox4.Controls.Add(this.label1);
  839. this.groupBox4.Location = new System.Drawing.Point(153, 116);
  840. this.groupBox4.Name = "groupBox4";
  841. this.groupBox4.Size = new System.Drawing.Size(356, 168);
  842. this.groupBox4.TabIndex = 5;
  843. this.groupBox4.TabStop = false;
  844. //
  845. // dataGridView1
  846. //
  847. this.dataGridView1.AllowUserToAddRows = false;
  848. this.dataGridView1.AllowUserToResizeColumns = false;
  849. this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  850. | System.Windows.Forms.AnchorStyles.Left)));
  851. this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  852. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  853. dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
  854. dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F);
  855. dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
  856. dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  857. dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  858. dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  859. this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
  860. this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  861. this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  862. this.nname,
  863. this.explain,
  864. this.operation,
  865. this.Column11});
  866. this.dataGridView1.Location = new System.Drawing.Point(6, 46);
  867. this.dataGridView1.MultiSelect = false;
  868. this.dataGridView1.Name = "dataGridView1";
  869. this.dataGridView1.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
  870. this.dataGridView1.RowHeadersVisible = false;
  871. this.dataGridView1.RowTemplate.Height = 23;
  872. this.dataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
  873. this.dataGridView1.Size = new System.Drawing.Size(340, 116);
  874. this.dataGridView1.TabIndex = 7;
  875. this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick);
  876. this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvData_CellContentClick);
  877. this.dataGridView1.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_CellMouseClick);
  878. this.dataGridView1.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridView1_CellValidating);
  879. this.dataGridView1.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellValueChanged);
  880. this.dataGridView1.RowLeave += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_RowLeave);
  881. this.dataGridView1.SelectionChanged += new System.EventHandler(this.dataGridView1_SelectionChanged);
  882. //
  883. // nname
  884. //
  885. dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  886. this.nname.DefaultCellStyle = dataGridViewCellStyle2;
  887. this.nname.FillWeight = 103.5533F;
  888. this.nname.HeaderText = "nname";
  889. this.nname.Name = "nname";
  890. this.nname.Width = 80;
  891. //
  892. // explain
  893. //
  894. dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  895. this.explain.DefaultCellStyle = dataGridViewCellStyle3;
  896. this.explain.FillWeight = 109.3963F;
  897. this.explain.HeaderText = "explain";
  898. this.explain.Name = "explain";
  899. this.explain.Width = 157;
  900. //
  901. // operation
  902. //
  903. dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  904. this.operation.DefaultCellStyle = dataGridViewCellStyle4;
  905. this.operation.FillWeight = 87.05037F;
  906. this.operation.HeaderText = "operation";
  907. this.operation.Name = "operation";
  908. this.operation.Width = 50;
  909. //
  910. // Column11
  911. //
  912. dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  913. this.Column11.DefaultCellStyle = dataGridViewCellStyle5;
  914. this.Column11.HeaderText = "Column11";
  915. this.Column11.Name = "Column11";
  916. this.Column11.Width = 50;
  917. //
  918. // button5
  919. //
  920. this.button5.BackColor = System.Drawing.SystemColors.Control;
  921. this.button5.Location = new System.Drawing.Point(304, 19);
  922. this.button5.Name = "button5";
  923. this.button5.Size = new System.Drawing.Size(42, 22);
  924. this.button5.TabIndex = 6;
  925. this.button5.UseVisualStyleBackColor = false;
  926. this.button5.Click += new System.EventHandler(this.button5_Click);
  927. //
  928. // textBox2
  929. //
  930. this.textBox2.Location = new System.Drawing.Point(166, 19);
  931. this.textBox2.Name = "textBox2";
  932. this.textBox2.Size = new System.Drawing.Size(135, 21);
  933. this.textBox2.TabIndex = 3;
  934. //
  935. // textBox1
  936. //
  937. this.textBox1.Location = new System.Drawing.Point(65, 19);
  938. this.textBox1.Name = "textBox1";
  939. this.textBox1.Size = new System.Drawing.Size(60, 21);
  940. this.textBox1.TabIndex = 2;
  941. //
  942. // label2
  943. //
  944. this.label2.AutoSize = true;
  945. this.label2.Location = new System.Drawing.Point(127, 24);
  946. this.label2.Name = "label2";
  947. this.label2.Size = new System.Drawing.Size(0, 12);
  948. this.label2.TabIndex = 1;
  949. //
  950. // label1
  951. //
  952. this.label1.AutoSize = true;
  953. this.label1.Location = new System.Drawing.Point(4, 24);
  954. this.label1.Name = "label1";
  955. this.label1.Size = new System.Drawing.Size(0, 12);
  956. this.label1.TabIndex = 0;
  957. //
  958. // groupBox5
  959. //
  960. this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  961. this.groupBox5.Controls.Add(this.dataGridView3);
  962. this.groupBox5.Controls.Add(this.dataGridView2);
  963. this.groupBox5.Controls.Add(this.button8);
  964. this.groupBox5.Controls.Add(this.button7);
  965. this.groupBox5.Controls.Add(this.button6);
  966. this.groupBox5.Location = new System.Drawing.Point(153, 290);
  967. this.groupBox5.Name = "groupBox5";
  968. this.groupBox5.Size = new System.Drawing.Size(356, 201);
  969. this.groupBox5.TabIndex = 6;
  970. this.groupBox5.TabStop = false;
  971. //
  972. // dataGridView3
  973. //
  974. this.dataGridView3.AllowUserToAddRows = false;
  975. this.dataGridView3.AllowUserToResizeColumns = false;
  976. this.dataGridView3.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  977. dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  978. dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control;
  979. dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 9F);
  980. dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText;
  981. dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  982. dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  983. dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  984. this.dataGridView3.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6;
  985. this.dataGridView3.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  986. this.dataGridView3.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  987. this.dataGridViewTextBoxColumn1,
  988. this.dataGridViewTextBoxColumn2,
  989. this.dataGridViewTextBoxColumn3,
  990. this.dataGridViewTextBoxColumn4,
  991. this.dataGridViewTextBoxColumn5,
  992. this.dataGridViewTextBoxColumn6,
  993. this.dataGridViewTextBoxColumn7,
  994. this.dataGridViewTextBoxColumn8});
  995. this.dataGridView3.Location = new System.Drawing.Point(6, 52);
  996. this.dataGridView3.Name = "dataGridView3";
  997. this.dataGridView3.ReadOnly = true;
  998. this.dataGridView3.RowHeadersVisible = false;
  999. this.dataGridView3.RowTemplate.Height = 23;
  1000. this.dataGridView3.Size = new System.Drawing.Size(340, 143);
  1001. this.dataGridView3.TabIndex = 10;
  1002. this.dataGridView3.Visible = false;
  1003. this.dataGridView3.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView3_CellValueChanged);
  1004. //
  1005. // dataGridViewTextBoxColumn1
  1006. //
  1007. dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1008. this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle7;
  1009. this.dataGridViewTextBoxColumn1.FillWeight = 199.6873F;
  1010. this.dataGridViewTextBoxColumn1.HeaderText = "dataGridViewTextBoxColumn1";
  1011. this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
  1012. this.dataGridViewTextBoxColumn1.ReadOnly = true;
  1013. this.dataGridViewTextBoxColumn1.Width = 84;
  1014. //
  1015. // dataGridViewTextBoxColumn2
  1016. //
  1017. dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1018. this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle8;
  1019. this.dataGridViewTextBoxColumn2.FillWeight = 154.1869F;
  1020. this.dataGridViewTextBoxColumn2.HeaderText = "dataGridViewTextBoxColumn2";
  1021. this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
  1022. this.dataGridViewTextBoxColumn2.ReadOnly = true;
  1023. this.dataGridViewTextBoxColumn2.Width = 150;
  1024. //
  1025. // dataGridViewTextBoxColumn3
  1026. //
  1027. dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1028. this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle9;
  1029. this.dataGridViewTextBoxColumn3.FillWeight = 68.40062F;
  1030. this.dataGridViewTextBoxColumn3.HeaderText = "L1%";
  1031. this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
  1032. this.dataGridViewTextBoxColumn3.ReadOnly = true;
  1033. this.dataGridViewTextBoxColumn3.Width = 29;
  1034. //
  1035. // dataGridViewTextBoxColumn4
  1036. //
  1037. dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1038. this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle10;
  1039. this.dataGridViewTextBoxColumn4.FillWeight = 70.44655F;
  1040. this.dataGridViewTextBoxColumn4.HeaderText = "L2%";
  1041. this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
  1042. this.dataGridViewTextBoxColumn4.ReadOnly = true;
  1043. this.dataGridViewTextBoxColumn4.Width = 30;
  1044. //
  1045. // dataGridViewTextBoxColumn5
  1046. //
  1047. dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1048. this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle11;
  1049. this.dataGridViewTextBoxColumn5.FillWeight = 72.72363F;
  1050. this.dataGridViewTextBoxColumn5.HeaderText = "L3%";
  1051. this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
  1052. this.dataGridViewTextBoxColumn5.ReadOnly = true;
  1053. this.dataGridViewTextBoxColumn5.Width = 30;
  1054. //
  1055. // dataGridViewTextBoxColumn6
  1056. //
  1057. dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1058. this.dataGridViewTextBoxColumn6.DefaultCellStyle = dataGridViewCellStyle12;
  1059. this.dataGridViewTextBoxColumn6.FillWeight = 75.25803F;
  1060. this.dataGridViewTextBoxColumn6.HeaderText = "L4%";
  1061. this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
  1062. this.dataGridViewTextBoxColumn6.ReadOnly = true;
  1063. this.dataGridViewTextBoxColumn6.Width = 32;
  1064. //
  1065. // dataGridViewTextBoxColumn7
  1066. //
  1067. dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1068. this.dataGridViewTextBoxColumn7.DefaultCellStyle = dataGridViewCellStyle13;
  1069. this.dataGridViewTextBoxColumn7.FillWeight = 78.07879F;
  1070. this.dataGridViewTextBoxColumn7.HeaderText = "L5%";
  1071. this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
  1072. this.dataGridViewTextBoxColumn7.ReadOnly = true;
  1073. this.dataGridViewTextBoxColumn7.Width = 33;
  1074. //
  1075. // dataGridViewTextBoxColumn8
  1076. //
  1077. dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1078. this.dataGridViewTextBoxColumn8.DefaultCellStyle = dataGridViewCellStyle14;
  1079. this.dataGridViewTextBoxColumn8.FillWeight = 81.21828F;
  1080. this.dataGridViewTextBoxColumn8.HeaderText = "dataGridViewTextBoxColumn8";
  1081. this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
  1082. this.dataGridViewTextBoxColumn8.ReadOnly = true;
  1083. this.dataGridViewTextBoxColumn8.Width = 150;
  1084. //
  1085. // dataGridView2
  1086. //
  1087. this.dataGridView2.AllowUserToAddRows = false;
  1088. this.dataGridView2.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  1089. dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1090. dataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Control;
  1091. dataGridViewCellStyle15.Font = new System.Drawing.Font("宋体", 9F);
  1092. dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText;
  1093. dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  1094. dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  1095. dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  1096. this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle15;
  1097. this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  1098. this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  1099. this.pointName,
  1100. this.pointDeviation,
  1101. this.pointL1,
  1102. this.pointL2,
  1103. this.pointL3,
  1104. this.pointL4,
  1105. this.pointL5,
  1106. this.pointAverage});
  1107. this.dataGridView2.Location = new System.Drawing.Point(6, 52);
  1108. this.dataGridView2.Name = "dataGridView2";
  1109. this.dataGridView2.ReadOnly = true;
  1110. this.dataGridView2.RowHeadersVisible = false;
  1111. this.dataGridView2.RowTemplate.Height = 23;
  1112. this.dataGridView2.Size = new System.Drawing.Size(340, 143);
  1113. this.dataGridView2.TabIndex = 9;
  1114. //
  1115. // pointName
  1116. //
  1117. dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1118. this.pointName.DefaultCellStyle = dataGridViewCellStyle16;
  1119. this.pointName.HeaderText = "pointName";
  1120. this.pointName.Name = "pointName";
  1121. this.pointName.ReadOnly = true;
  1122. this.pointName.Width = 42;
  1123. //
  1124. // pointDeviation
  1125. //
  1126. dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1127. this.pointDeviation.DefaultCellStyle = dataGridViewCellStyle17;
  1128. this.pointDeviation.HeaderText = "pointDeviation";
  1129. this.pointDeviation.Name = "pointDeviation";
  1130. this.pointDeviation.ReadOnly = true;
  1131. this.pointDeviation.Width = 150;
  1132. //
  1133. // pointL1
  1134. //
  1135. dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1136. this.pointL1.DefaultCellStyle = dataGridViewCellStyle18;
  1137. this.pointL1.HeaderText = "L1%";
  1138. this.pointL1.Name = "pointL1";
  1139. this.pointL1.ReadOnly = true;
  1140. this.pointL1.Width = 42;
  1141. //
  1142. // pointL2
  1143. //
  1144. dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1145. this.pointL2.DefaultCellStyle = dataGridViewCellStyle19;
  1146. this.pointL2.HeaderText = "L2%";
  1147. this.pointL2.Name = "pointL2";
  1148. this.pointL2.ReadOnly = true;
  1149. this.pointL2.Width = 43;
  1150. //
  1151. // pointL3
  1152. //
  1153. dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1154. this.pointL3.DefaultCellStyle = dataGridViewCellStyle20;
  1155. this.pointL3.HeaderText = "L3%";
  1156. this.pointL3.Name = "pointL3";
  1157. this.pointL3.ReadOnly = true;
  1158. this.pointL3.Width = 42;
  1159. //
  1160. // pointL4
  1161. //
  1162. dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1163. this.pointL4.DefaultCellStyle = dataGridViewCellStyle21;
  1164. this.pointL4.HeaderText = "L4%";
  1165. this.pointL4.Name = "pointL4";
  1166. this.pointL4.ReadOnly = true;
  1167. this.pointL4.Width = 42;
  1168. //
  1169. // pointL5
  1170. //
  1171. dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1172. this.pointL5.DefaultCellStyle = dataGridViewCellStyle22;
  1173. this.pointL5.HeaderText = "L5%";
  1174. this.pointL5.Name = "pointL5";
  1175. this.pointL5.ReadOnly = true;
  1176. this.pointL5.Width = 42;
  1177. //
  1178. // pointAverage
  1179. //
  1180. dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1181. this.pointAverage.DefaultCellStyle = dataGridViewCellStyle23;
  1182. this.pointAverage.HeaderText = "pointAverage";
  1183. this.pointAverage.Name = "pointAverage";
  1184. this.pointAverage.ReadOnly = true;
  1185. this.pointAverage.Width = 70;
  1186. //
  1187. // button8
  1188. //
  1189. this.button8.BackColor = System.Drawing.SystemColors.Control;
  1190. this.button8.Location = new System.Drawing.Point(246, 20);
  1191. this.button8.Name = "button8";
  1192. this.button8.Size = new System.Drawing.Size(99, 26);
  1193. this.button8.TabIndex = 8;
  1194. this.button8.UseVisualStyleBackColor = false;
  1195. this.button8.Click += new System.EventHandler(this.button8_Click);
  1196. this.button8.LostFocus += new System.EventHandler(this.button8_LostFocus);
  1197. //
  1198. // button7
  1199. //
  1200. this.button7.BackColor = System.Drawing.SystemColors.Control;
  1201. this.button7.Location = new System.Drawing.Point(127, 20);
  1202. this.button7.Name = "button7";
  1203. this.button7.Size = new System.Drawing.Size(113, 26);
  1204. this.button7.TabIndex = 7;
  1205. this.button7.UseVisualStyleBackColor = false;
  1206. this.button7.Click += new System.EventHandler(this.button7_Click);
  1207. this.button7.LostFocus += new System.EventHandler(this.button7_LostFocus);
  1208. //
  1209. // button6
  1210. //
  1211. this.button6.BackColor = System.Drawing.SystemColors.Control;
  1212. this.button6.Location = new System.Drawing.Point(9, 20);
  1213. this.button6.Name = "button6";
  1214. this.button6.Size = new System.Drawing.Size(112, 26);
  1215. this.button6.TabIndex = 6;
  1216. this.button6.UseVisualStyleBackColor = false;
  1217. this.button6.Click += new System.EventHandler(this.button6_Click);
  1218. this.button6.LostFocus += new System.EventHandler(this.button6_LostFocus);
  1219. //
  1220. // groupBox6
  1221. //
  1222. this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  1223. this.groupBox6.Controls.Add(this.button10);
  1224. this.groupBox6.Controls.Add(this.button9);
  1225. this.groupBox6.Location = new System.Drawing.Point(153, 497);
  1226. this.groupBox6.Name = "groupBox6";
  1227. this.groupBox6.Size = new System.Drawing.Size(356, 59);
  1228. this.groupBox6.TabIndex = 7;
  1229. this.groupBox6.TabStop = false;
  1230. //
  1231. // button10
  1232. //
  1233. this.button10.BackColor = System.Drawing.SystemColors.Control;
  1234. this.button10.Location = new System.Drawing.Point(182, 24);
  1235. this.button10.Name = "button10";
  1236. this.button10.Size = new System.Drawing.Size(138, 26);
  1237. this.button10.TabIndex = 11;
  1238. this.button10.UseVisualStyleBackColor = false;
  1239. this.button10.Click += new System.EventHandler(this.button10_Click);
  1240. //
  1241. // button9
  1242. //
  1243. this.button9.BackColor = System.Drawing.SystemColors.Control;
  1244. this.button9.Location = new System.Drawing.Point(16, 23);
  1245. this.button9.Name = "button9";
  1246. this.button9.Size = new System.Drawing.Size(148, 26);
  1247. this.button9.TabIndex = 10;
  1248. this.button9.UseVisualStyleBackColor = false;
  1249. this.button9.Click += new System.EventHandler(this.button9_Click);
  1250. //
  1251. // groupBox7
  1252. //
  1253. this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  1254. | System.Windows.Forms.AnchorStyles.Left)
  1255. | System.Windows.Forms.AnchorStyles.Right)));
  1256. this.groupBox7.Location = new System.Drawing.Point(515, 60);
  1257. this.groupBox7.Name = "groupBox7";
  1258. this.groupBox7.Size = new System.Drawing.Size(580, 496);
  1259. this.groupBox7.TabIndex = 8;
  1260. this.groupBox7.TabStop = false;
  1261. //
  1262. // groupBox8
  1263. //
  1264. this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  1265. | System.Windows.Forms.AnchorStyles.Right)));
  1266. this.groupBox8.Controls.Add(this.button17);
  1267. this.groupBox8.Controls.Add(this.listView2);
  1268. this.groupBox8.Controls.Add(this.numericUpDown1);
  1269. this.groupBox8.Controls.Add(this.button16);
  1270. this.groupBox8.Controls.Add(this.label5);
  1271. this.groupBox8.Controls.Add(this.button14);
  1272. this.groupBox8.Controls.Add(this.button13);
  1273. this.groupBox8.Controls.Add(this.dataGridView4);
  1274. this.groupBox8.Controls.Add(this.button12);
  1275. this.groupBox8.Controls.Add(this.button11);
  1276. this.groupBox8.Location = new System.Drawing.Point(14, 562);
  1277. this.groupBox8.Name = "groupBox8";
  1278. this.groupBox8.Size = new System.Drawing.Size(1081, 204);
  1279. this.groupBox8.TabIndex = 9;
  1280. this.groupBox8.TabStop = false;
  1281. //
  1282. // button17
  1283. //
  1284. this.button17.Anchor = System.Windows.Forms.AnchorStyles.Right;
  1285. this.button17.BackColor = System.Drawing.SystemColors.Control;
  1286. this.button17.Location = new System.Drawing.Point(941, 102);
  1287. this.button17.Name = "button17";
  1288. this.button17.Size = new System.Drawing.Size(128, 26);
  1289. this.button17.TabIndex = 23;
  1290. this.button17.UseVisualStyleBackColor = false;
  1291. this.button17.Click += new System.EventHandler(this.button17_Click);
  1292. //
  1293. // listView2
  1294. //
  1295. this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  1296. this.listView2.FullRowSelect = true;
  1297. this.listView2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
  1298. this.listView2.HideSelection = false;
  1299. this.listView2.Location = new System.Drawing.Point(16, 56);
  1300. this.listView2.Name = "listView2";
  1301. this.listView2.Size = new System.Drawing.Size(181, 140);
  1302. this.listView2.TabIndex = 22;
  1303. this.listView2.UseCompatibleStateImageBehavior = false;
  1304. this.listView2.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView2_ItemSelectionChanged);
  1305. this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged);
  1306. //
  1307. // numericUpDown1
  1308. //
  1309. this.numericUpDown1.Anchor = System.Windows.Forms.AnchorStyles.Right;
  1310. this.numericUpDown1.Location = new System.Drawing.Point(997, 163);
  1311. this.numericUpDown1.Maximum = new decimal(new int[] {
  1312. 10,
  1313. 0,
  1314. 0,
  1315. 0});
  1316. this.numericUpDown1.Name = "numericUpDown1";
  1317. this.numericUpDown1.Size = new System.Drawing.Size(56, 21);
  1318. this.numericUpDown1.TabIndex = 21;
  1319. this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
  1320. //
  1321. // button16
  1322. //
  1323. this.button16.BackColor = System.Drawing.SystemColors.Control;
  1324. this.button16.Location = new System.Drawing.Point(16, 20);
  1325. this.button16.Name = "button16";
  1326. this.button16.Size = new System.Drawing.Size(93, 26);
  1327. this.button16.TabIndex = 20;
  1328. this.button16.UseVisualStyleBackColor = false;
  1329. this.button16.Click += new System.EventHandler(this.button16_Click);
  1330. //
  1331. // label5
  1332. //
  1333. this.label5.Anchor = System.Windows.Forms.AnchorStyles.Right;
  1334. this.label5.AutoSize = true;
  1335. this.label5.Location = new System.Drawing.Point(958, 169);
  1336. this.label5.Name = "label5";
  1337. this.label5.Size = new System.Drawing.Size(0, 12);
  1338. this.label5.TabIndex = 18;
  1339. //
  1340. // button14
  1341. //
  1342. this.button14.Anchor = System.Windows.Forms.AnchorStyles.Right;
  1343. this.button14.BackColor = System.Drawing.SystemColors.Control;
  1344. this.button14.Location = new System.Drawing.Point(941, 68);
  1345. this.button14.Name = "button14";
  1346. this.button14.Size = new System.Drawing.Size(128, 26);
  1347. this.button14.TabIndex = 16;
  1348. this.button14.UseVisualStyleBackColor = false;
  1349. this.button14.Click += new System.EventHandler(this.button14_Click);
  1350. //
  1351. // button13
  1352. //
  1353. this.button13.Anchor = System.Windows.Forms.AnchorStyles.Right;
  1354. this.button13.BackColor = System.Drawing.SystemColors.Control;
  1355. this.button13.Location = new System.Drawing.Point(941, 34);
  1356. this.button13.Name = "button13";
  1357. this.button13.Size = new System.Drawing.Size(128, 26);
  1358. this.button13.TabIndex = 12;
  1359. this.button13.UseVisualStyleBackColor = false;
  1360. this.button13.Click += new System.EventHandler(this.button13_Click);
  1361. //
  1362. // dataGridView4
  1363. //
  1364. this.dataGridView4.AllowUserToAddRows = false;
  1365. this.dataGridView4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  1366. | System.Windows.Forms.AnchorStyles.Right)));
  1367. this.dataGridView4.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  1368. this.dataGridView4.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  1369. dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1370. dataGridViewCellStyle24.BackColor = System.Drawing.SystemColors.Control;
  1371. dataGridViewCellStyle24.Font = new System.Drawing.Font("宋体", 9F);
  1372. dataGridViewCellStyle24.ForeColor = System.Drawing.SystemColors.WindowText;
  1373. dataGridViewCellStyle24.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  1374. dataGridViewCellStyle24.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  1375. dataGridViewCellStyle24.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  1376. this.dataGridView4.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle24;
  1377. this.dataGridView4.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  1378. this.dataGridView4.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  1379. this.Column1,
  1380. this.Column2,
  1381. this.Column3,
  1382. this.Column4,
  1383. this.Column5,
  1384. this.Column6,
  1385. this.Column7,
  1386. this.Column8,
  1387. this.Column9,
  1388. this.Column10});
  1389. this.dataGridView4.Location = new System.Drawing.Point(228, 20);
  1390. this.dataGridView4.Name = "dataGridView4";
  1391. this.dataGridView4.RowHeadersVisible = false;
  1392. this.dataGridView4.RowTemplate.Height = 23;
  1393. this.dataGridView4.Size = new System.Drawing.Size(693, 176);
  1394. this.dataGridView4.TabIndex = 15;
  1395. //
  1396. // Column1
  1397. //
  1398. dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1399. this.Column1.DefaultCellStyle = dataGridViewCellStyle25;
  1400. this.Column1.FillWeight = 91.37055F;
  1401. this.Column1.HeaderText = "Column1";
  1402. this.Column1.Name = "Column1";
  1403. //
  1404. // Column2
  1405. //
  1406. dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1407. this.Column2.DefaultCellStyle = dataGridViewCellStyle26;
  1408. this.Column2.FillWeight = 91.37055F;
  1409. this.Column2.HeaderText = "Column2";
  1410. this.Column2.Name = "Column2";
  1411. //
  1412. // Column3
  1413. //
  1414. dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1415. this.Column3.DefaultCellStyle = dataGridViewCellStyle27;
  1416. this.Column3.FillWeight = 91.37055F;
  1417. this.Column3.HeaderText = "Column3";
  1418. this.Column3.Name = "Column3";
  1419. //
  1420. // Column4
  1421. //
  1422. dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1423. this.Column4.DefaultCellStyle = dataGridViewCellStyle28;
  1424. this.Column4.FillWeight = 177.665F;
  1425. this.Column4.HeaderText = "Column4";
  1426. this.Column4.Name = "Column4";
  1427. //
  1428. // Column5
  1429. //
  1430. dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1431. this.Column5.DefaultCellStyle = dataGridViewCellStyle29;
  1432. this.Column5.FillWeight = 91.37055F;
  1433. this.Column5.HeaderText = "L1%";
  1434. this.Column5.Name = "Column5";
  1435. //
  1436. // Column6
  1437. //
  1438. dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1439. this.Column6.DefaultCellStyle = dataGridViewCellStyle30;
  1440. this.Column6.FillWeight = 91.37055F;
  1441. this.Column6.HeaderText = "L2%";
  1442. this.Column6.Name = "Column6";
  1443. //
  1444. // Column7
  1445. //
  1446. dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1447. this.Column7.DefaultCellStyle = dataGridViewCellStyle31;
  1448. this.Column7.FillWeight = 91.37055F;
  1449. this.Column7.HeaderText = "L3%";
  1450. this.Column7.Name = "Column7";
  1451. //
  1452. // Column8
  1453. //
  1454. dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1455. this.Column8.DefaultCellStyle = dataGridViewCellStyle32;
  1456. this.Column8.FillWeight = 91.37055F;
  1457. this.Column8.HeaderText = "L4%";
  1458. this.Column8.Name = "Column8";
  1459. //
  1460. // Column9
  1461. //
  1462. dataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1463. this.Column9.DefaultCellStyle = dataGridViewCellStyle33;
  1464. this.Column9.FillWeight = 91.37055F;
  1465. this.Column9.HeaderText = "L5%";
  1466. this.Column9.Name = "Column9";
  1467. //
  1468. // Column10
  1469. //
  1470. dataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1471. this.Column10.DefaultCellStyle = dataGridViewCellStyle34;
  1472. this.Column10.FillWeight = 91.37055F;
  1473. this.Column10.HeaderText = "Column10";
  1474. this.Column10.Name = "Column10";
  1475. //
  1476. // button12
  1477. //
  1478. this.button12.BackColor = System.Drawing.SystemColors.Control;
  1479. this.button12.Location = new System.Drawing.Point(145, 20);
  1480. this.button12.Name = "button12";
  1481. this.button12.Size = new System.Drawing.Size(52, 26);
  1482. this.button12.TabIndex = 13;
  1483. this.button12.UseVisualStyleBackColor = false;
  1484. this.button12.Click += new System.EventHandler(this.button12_Click);
  1485. //
  1486. // button11
  1487. //
  1488. this.button11.BackColor = System.Drawing.SystemColors.Control;
  1489. this.button11.Location = new System.Drawing.Point(15, 20);
  1490. this.button11.Name = "button11";
  1491. this.button11.Size = new System.Drawing.Size(63, 26);
  1492. this.button11.TabIndex = 12;
  1493. this.button11.UseVisualStyleBackColor = false;
  1494. this.button11.Click += new System.EventHandler(this.button11_Click);
  1495. //
  1496. // RecombinationRateDialog
  1497. //
  1498. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  1499. this.BackColor = System.Drawing.SystemColors.Control;
  1500. this.ClientSize = new System.Drawing.Size(1107, 770);
  1501. this.Controls.Add(this.groupBox8);
  1502. this.Controls.Add(this.groupBox7);
  1503. this.Controls.Add(this.groupBox6);
  1504. this.Controls.Add(this.groupBox5);
  1505. this.Controls.Add(this.groupBox4);
  1506. this.Controls.Add(this.groupBox3);
  1507. this.Controls.Add(this.groupBox2);
  1508. this.Controls.Add(this.groupBox1);
  1509. this.Font = new System.Drawing.Font("宋体", 9F);
  1510. this.Name = "RecombinationRateDialog";
  1511. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RecombinationRateDialog_FormClosing);
  1512. this.Controls.SetChildIndex(this.groupBox1, 0);
  1513. this.Controls.SetChildIndex(this.groupBox2, 0);
  1514. this.Controls.SetChildIndex(this.groupBox3, 0);
  1515. this.Controls.SetChildIndex(this.groupBox4, 0);
  1516. this.Controls.SetChildIndex(this.groupBox5, 0);
  1517. this.Controls.SetChildIndex(this.groupBox6, 0);
  1518. this.Controls.SetChildIndex(this.groupBox7, 0);
  1519. this.Controls.SetChildIndex(this.groupBox8, 0);
  1520. this.groupBox1.ResumeLayout(false);
  1521. this.groupBox1.PerformLayout();
  1522. this.groupBox2.ResumeLayout(false);
  1523. this.groupBox3.ResumeLayout(false);
  1524. this.groupBox4.ResumeLayout(false);
  1525. this.groupBox4.PerformLayout();
  1526. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  1527. this.groupBox5.ResumeLayout(false);
  1528. ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit();
  1529. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
  1530. this.groupBox6.ResumeLayout(false);
  1531. this.groupBox8.ResumeLayout(false);
  1532. this.groupBox8.PerformLayout();
  1533. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  1534. ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).EndInit();
  1535. this.ResumeLayout(false);
  1536. }
  1537. #endregion
  1538. /// <summary>
  1539. /// 刷新工件下拉
  1540. /// </summary>
  1541. public void RefreshCombobox()
  1542. {
  1543. WorkpieceMaintenanceModel workpieceMaintenanceModel = XmlSerializeHelper.DESerializer<WorkpieceMaintenanceModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkpieceMaintenanceModel.xml", FileMode.Open));
  1544. ArrayList arrayList = new ArrayList();
  1545. foreach (var item in workpieceMaintenanceModel.Workpieces)
  1546. {
  1547. arrayList.Add(item.Name);
  1548. }
  1549. this.comboBox1.DataSource = null;
  1550. this.comboBox1.DataSource = arrayList;
  1551. if(arrayList.Count > 0)
  1552. {
  1553. if (string.IsNullOrEmpty(this.selectItemValue))
  1554. this.comboBox1.SelectedIndex = 0;
  1555. else
  1556. this.comboBox1.SelectedItem = this.selectItemValue;
  1557. }
  1558. }
  1559. private void listView1_MouseDown(object sender, MouseEventArgs e)
  1560. {
  1561. this.changeCount = 0;
  1562. }
  1563. private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
  1564. {
  1565. bool change = false;
  1566. if (this.changeCount == 0)
  1567. {
  1568. if (this.dataGridView2.Rows.Count > 0)
  1569. {
  1570. if(this.saveSuccess)
  1571. {
  1572. DialogResult dt = MessageBox.Show(PdnResources.GetString("Menu.Whethertosavetherrentpicture.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  1573. if (dt == DialogResult.Yes)
  1574. {
  1575. string imgName = this.appWorkspace.DocumentWorkspaces[e.ItemIndex].GetFriendlyName();
  1576. string tag = this.imageList1.Images.Keys[e.ItemIndex];
  1577. DataTable dataTable1 = new DataTable();
  1578. bool replace = false;
  1579. int add = 0;
  1580. foreach (ListViewItem item in this.listView2.Items)
  1581. {
  1582. if (item.Name.Equals(tag))
  1583. {
  1584. add++;
  1585. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Themeasurementdertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1586. if (dr == DialogResult.OK)
  1587. {
  1588. replace = true;
  1589. this.listView2.Items.Remove(item);
  1590. }
  1591. break;
  1592. }
  1593. }
  1594. if (replace || this.listView2.Items.Count == 0 || add == 0)
  1595. {
  1596. this.dataGridView4.Rows.Clear();
  1597. if (this.linesNumber == 3)
  1598. {
  1599. this.dataGridView4.Columns[7].Visible = false;
  1600. this.dataGridView4.Columns[8].Visible = false;
  1601. }
  1602. else if (this.linesNumber == 4)
  1603. {
  1604. this.dataGridView4.Columns[7].Visible = true;
  1605. this.dataGridView4.Columns[8].Visible = false;
  1606. }
  1607. else if (this.linesNumber == 5)
  1608. {
  1609. this.dataGridView4.Columns[7].Visible = true;
  1610. this.dataGridView4.Columns[8].Visible = true;
  1611. }
  1612. ListViewItem listViewItem = new ListViewItem();
  1613. listViewItem.Name = tag;
  1614. listViewItem.SubItems[0].Text = imgName;
  1615. listViewItem.Tag = "" + this.linesNumber;
  1616. if (this.listView2.Items.Count == 0)
  1617. this.listView2.Items.Add(listViewItem);
  1618. else
  1619. this.listView2.Items.Insert(0, listViewItem);
  1620. dataTable1.TableName = tag;
  1621. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  1622. {
  1623. dataTable1.Columns.Add(c.HeaderText);
  1624. }
  1625. foreach (DataTable dataTable in this.pointDataTables)
  1626. {
  1627. for (int r = 0; r < dataTable.Rows.Count; r++)
  1628. {
  1629. DataGridViewRow dgvr = new DataGridViewRow();
  1630. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  1631. {
  1632. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  1633. }
  1634. for (int c = 0; c < dataTable.Columns.Count; c++)
  1635. {
  1636. dgvr.Cells[0].Value = imgName;
  1637. dgvr.Cells[1].Value = dataTable.TableName;
  1638. if (c > 1 && !dataTable.Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")))
  1639. {
  1640. if (this.linesNumber == 3)
  1641. {
  1642. if (c + 2 != 7 && c + 2 != 8)
  1643. dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  1644. else
  1645. dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString();
  1646. }
  1647. else if (this.linesNumber == 4)
  1648. {
  1649. if (c + 2 != 8)
  1650. dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  1651. else
  1652. dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString();
  1653. }
  1654. else if (this.linesNumber == 5)
  1655. {
  1656. dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  1657. }
  1658. }
  1659. else
  1660. dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString();
  1661. }
  1662. this.dataGridView4.Rows.Add(dgvr);
  1663. DataRow dataRow = dataTable1.NewRow();
  1664. for (int c = 0; c < dataTable.Columns.Count + 2; c++)
  1665. {
  1666. if (c == 0)
  1667. dataRow[this.dataGridView4.Columns[c].HeaderText] = imgName;
  1668. else if (c == 1)
  1669. dataRow[this.dataGridView4.Columns[c].HeaderText] = dataTable.TableName;
  1670. else
  1671. dataRow[this.dataGridView4.Columns[c].HeaderText] = dataTable.Rows[r][c - 2].ToString();
  1672. }
  1673. dataTable1.Rows.Add(dataRow);
  1674. }
  1675. }
  1676. foreach (DataTable dataTable2 in pictureDataTables)
  1677. {
  1678. if (dataTable2.TableName.Equals(dataTable1.TableName))
  1679. {
  1680. pictureDataTables.Remove(dataTable2);
  1681. break;
  1682. }
  1683. }
  1684. this.pictureDataTables.Add(dataTable1);
  1685. if (this.allShow)
  1686. AllShow();
  1687. this.bitDic.Clear();
  1688. foreach (var item in this.bitDic1)
  1689. {
  1690. this.bitDic.Add(item.Key, item.Value);
  1691. }
  1692. this.listView2.Items[0].Selected = true;
  1693. }
  1694. }
  1695. }
  1696. }
  1697. }
  1698. else
  1699. {
  1700. if (change)
  1701. SelectedIndexChanged();
  1702. }
  1703. this.changeCount++;
  1704. }
  1705. private void listView1_SelectedIndexChanged(object sender, EventArgs e)
  1706. {
  1707. SelectedIndexChanged();
  1708. }
  1709. private void SelectedIndexChanged()
  1710. {
  1711. if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
  1712. {
  1713. this.unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
  1714. this.bitmap = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1715. Document document = Document.FromImage(bitmap);
  1716. this.documentWorkspace.Document = document;
  1717. this.documentWorkspace.Visible = true;
  1718. this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList;
  1719. //this.documentWorkspace.phaseModels = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].phaseModels;
  1720. this.documentWorkspace.Document = Document.FromImage(this.documentItems[this.listView1.FocusedItem.Index].bitmap);
  1721. this.documentWorkspace.Visible = true;
  1722. this.documentWorkspace.activeTool = DrawToolType.InclusionNoEffect;
  1723. this.documentWorkspace.PhaseModels.Clear();
  1724. this.documentWorkspace.PhaseModels.AddRange(this.documentItems[this.listView1.FocusedItem.Index].phaseModels);
  1725. // 选择了图片
  1726. this.selectPicture = true;
  1727. this.commonControlButtons.Visible = true;
  1728. this.dataGridView1.Rows.Clear();
  1729. this.dataGridView2.Rows.Clear();
  1730. this.dataGridView3.Rows.Clear();
  1731. this.pointDataTables.Clear();
  1732. this.pointRectangleFs.Clear();
  1733. this.textBox1.Clear();
  1734. this.textBox2.Clear();
  1735. //this.checkBox1.Checked = false;
  1736. //this.checkBox2.Checked = false;
  1737. this.button11.Visible = true;
  1738. this.button16.Visible = false;
  1739. pointCountA1.Clear();
  1740. pointCountA2.Clear();
  1741. pointCountA3.Clear();
  1742. pointCountB1.Clear();
  1743. pointCountB2.Clear();
  1744. pointCountB3.Clear();
  1745. pointCountB4.Clear();
  1746. pointCountC1.Clear();
  1747. pointCountC2.Clear();
  1748. pointCountC3.Clear();
  1749. pointCountC4.Clear();
  1750. pointCountC5.Clear();
  1751. this.lengthL1.Clear();
  1752. this.lengthL2.Clear();
  1753. this.lengthL3.Clear();
  1754. this.lengthL4.Clear();
  1755. this.lengthL5.Clear();
  1756. this.pointDrawkb = false;
  1757. RefreshPanel();
  1758. InitMeasurePoints();
  1759. this.documentWorkspace.Refresh();
  1760. //this.documentWorkspace.Refresh();
  1761. //this.applyButtonImpl(sender, e);
  1762. }
  1763. }
  1764. /// <summary>
  1765. /// 初始化测量数据
  1766. /// </summary>
  1767. private bool InitMeasureData()
  1768. {
  1769. bool retu = true;
  1770. this.pointDrawkb = false;
  1771. if (this.listView2.Items.Count > 0)
  1772. {
  1773. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Whethertoclearallanalysisresults.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1774. if (dr == DialogResult.OK)
  1775. {
  1776. this.dataGridView1.Rows.Clear();
  1777. this.dataGridView2.Rows.Clear();
  1778. this.dataGridView3.Rows.Clear();
  1779. this.pointDataTables.Clear();
  1780. this.pointRectangleFs.Clear();
  1781. this.textBox1.Clear();
  1782. this.textBox2.Clear();
  1783. this.comboBox1.Enabled = true;
  1784. //this.checkBox1.Checked = false;
  1785. //this.checkBox2.Checked = false;
  1786. this.button3.Visible = true;
  1787. this.button15.Visible = false;
  1788. this.button11.Visible = true;
  1789. this.button16.Visible = false;
  1790. pointCountA1.Clear();
  1791. pointCountA2.Clear();
  1792. pointCountA3.Clear();
  1793. pointCountB1.Clear();
  1794. pointCountB2.Clear();
  1795. pointCountB3.Clear();
  1796. pointCountB4.Clear();
  1797. pointCountC1.Clear();
  1798. pointCountC2.Clear();
  1799. pointCountC3.Clear();
  1800. pointCountC4.Clear();
  1801. pointCountC5.Clear();
  1802. this.dataGridView4.Rows.Clear();
  1803. this.pictureDataTables.Clear();
  1804. this.listView2.Items.Clear();
  1805. this.lengthL1.Clear();
  1806. this.lengthL2.Clear();
  1807. this.lengthL3.Clear();
  1808. this.lengthL4.Clear();
  1809. this.lengthL5.Clear();
  1810. }
  1811. else
  1812. {
  1813. retu = false;
  1814. }
  1815. }
  1816. else
  1817. {
  1818. this.dataGridView1.Rows.Clear();
  1819. this.dataGridView2.Rows.Clear();
  1820. this.dataGridView3.Rows.Clear();
  1821. this.pointDataTables.Clear();
  1822. this.pointRectangleFs.Clear();
  1823. this.textBox1.Clear();
  1824. this.textBox2.Clear();
  1825. this.comboBox1.Enabled = true;
  1826. //this.checkBox1.Checked = false;
  1827. //this.checkBox2.Checked = false;
  1828. this.button3.Visible = true;
  1829. this.button15.Visible = false;
  1830. this.button11.Visible = true;
  1831. this.button16.Visible = false;
  1832. pointCountA1.Clear();
  1833. pointCountA2.Clear();
  1834. pointCountA3.Clear();
  1835. pointCountB1.Clear();
  1836. pointCountB2.Clear();
  1837. pointCountB3.Clear();
  1838. pointCountB4.Clear();
  1839. pointCountC1.Clear();
  1840. pointCountC2.Clear();
  1841. pointCountC3.Clear();
  1842. pointCountC4.Clear();
  1843. pointCountC5.Clear();
  1844. this.lengthL1.Clear();
  1845. this.lengthL2.Clear();
  1846. this.lengthL3.Clear();
  1847. this.lengthL4.Clear();
  1848. this.lengthL5.Clear();
  1849. }
  1850. this.documentWorkspace.Refresh();
  1851. return retu;
  1852. }
  1853. /// <summary>
  1854. /// 初始化测量点
  1855. /// </summary>
  1856. public void InitMeasurePoints()
  1857. {
  1858. this.pointDrawkb = true;
  1859. for (int i = 0; i < pointRectangleFs.Count; i++)
  1860. {
  1861. pointRectangleFs[i].Clear();
  1862. }
  1863. for (int i = 0; i < pointCountA1.Count; i++)
  1864. {
  1865. pointCountA1[i] = 0;
  1866. }
  1867. for (int i = 0; i < pointCountA2.Count; i++)
  1868. {
  1869. pointCountA2[i] = 0;
  1870. }
  1871. for (int i = 0; i < pointCountA3.Count; i++)
  1872. {
  1873. pointCountA3[i] = 0;
  1874. }
  1875. for (int i = 0; i < pointCountB1.Count; i++)
  1876. {
  1877. pointCountB1[i] = 0;
  1878. }
  1879. for (int i = 0; i < pointCountB2.Count; i++)
  1880. {
  1881. pointCountB2[i] = 0;
  1882. }
  1883. for (int i = 0; i < pointCountB3.Count; i++)
  1884. {
  1885. pointCountB3[i] = 0;
  1886. }
  1887. for (int i = 0; i < pointCountB4.Count; i++)
  1888. {
  1889. pointCountB4[i] = 0;
  1890. }
  1891. for (int i = 0; i < pointCountC1.Count; i++)
  1892. {
  1893. pointCountC1[i] = 0;
  1894. }
  1895. for (int i = 0; i < pointCountC2.Count; i++)
  1896. {
  1897. pointCountC2[i] = 0;
  1898. }
  1899. for (int i = 0; i < pointCountC3.Count; i++)
  1900. {
  1901. pointCountC3[i] = 0;
  1902. }
  1903. for (int i = 0; i < pointCountC4.Count; i++)
  1904. {
  1905. pointCountC4[i] = 0;
  1906. }
  1907. for (int i = 0; i < pointCountC5.Count; i++)
  1908. {
  1909. pointCountC5[i] = 0;
  1910. }
  1911. this.documentWorkspace.Refresh();
  1912. }
  1913. /// <summary>
  1914. /// 设置按钮
  1915. /// </summary>
  1916. /// <param name="sender"></param>
  1917. /// <param name="e"></param>
  1918. private void button1_Click(object sender, EventArgs e)
  1919. {
  1920. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.RecombinationRate");
  1921. if (recombinationRateSetDialog.hasModule)
  1922. {
  1923. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  1924. recombinationRateSetDialog.ShowDialog();
  1925. }
  1926. else
  1927. {
  1928. recombinationRateSetDialog = null;
  1929. }
  1930. }
  1931. /// <summary>
  1932. /// 工件维护设置按钮
  1933. /// </summary>
  1934. /// <param name="sender"></param>
  1935. /// <param name="e"></param>
  1936. private void button4_Click(object sender, EventArgs e)
  1937. {
  1938. WorkpieceMaintenance workpieceMaintenance = new WorkpieceMaintenance();
  1939. workpieceMaintenance.StartPosition = FormStartPosition.CenterScreen;
  1940. workpieceMaintenance.ShowDialog(this);
  1941. }
  1942. /// <summary>
  1943. /// 开始测量按钮
  1944. /// </summary>
  1945. /// <param name="sender"></param>
  1946. /// <param name="e"></param>
  1947. private void button3_Click(object sender, EventArgs e)
  1948. {
  1949. if (this.selectPicture)
  1950. {
  1951. bool retu = InitMeasureData();
  1952. if (this.comboBox1.SelectedIndex >= 0)
  1953. {
  1954. if(retu)
  1955. {
  1956. GetDataFromXML();
  1957. this.button4.Enabled = false;
  1958. this.lineChange = false;
  1959. this.comboBox1.Enabled = false;
  1960. this.button3.Visible = false;
  1961. this.button15.Visible = true;
  1962. this.button15.Focus();
  1963. }
  1964. }
  1965. else
  1966. {
  1967. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectaworkpiece.text")+"!");
  1968. }
  1969. }
  1970. else
  1971. {
  1972. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectimage.Text")+"!");
  1973. }
  1974. }
  1975. /// <summary>
  1976. /// 停止测量
  1977. /// </summary>
  1978. /// <param name="sender"></param>
  1979. /// <param name="e"></param>
  1980. private void button15_Click(object sender, EventArgs e)
  1981. {
  1982. this.button4.Enabled = true;
  1983. this.pointDrawkb = false;
  1984. this.lineChange = true;
  1985. this.comboBox1.Enabled = true;
  1986. this.button3.Visible = true;
  1987. this.button15.Visible = false;
  1988. this.button3.Focus();
  1989. this.documentWorkspace.Refresh();
  1990. }
  1991. /// <summary>
  1992. /// 单元格点击
  1993. /// </summary>
  1994. /// <param name="sender"></param>
  1995. /// <param name="e"></param>
  1996. private void dgvData_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  1997. {
  1998. if (e.RowIndex > -1)
  1999. {
  2000. if (this.dataGridView1.Columns[e.ColumnIndex].Index == 2)
  2001. {
  2002. mouseX = e.X;
  2003. mouseY = e.Y;
  2004. }
  2005. }
  2006. }
  2007. /// <summary>
  2008. /// 单元格点击内容
  2009. /// </summary>
  2010. /// <param name="sender"></param>
  2011. /// <param name="e"></param>
  2012. private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e)
  2013. {
  2014. if (e.RowIndex > -1)
  2015. {
  2016. switch (this.dataGridView1.Columns[e.ColumnIndex].Index)
  2017. {
  2018. case 2:
  2019. Rectangle rc = this.dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false);//单元格区域的矩形
  2020. if (0 < mouseX && mouseX < rc.Width / 2)
  2021. {
  2022. }
  2023. else if (rc.Width / 2 < mouseX && mouseX < rc.Width)
  2024. {
  2025. }
  2026. break;
  2027. }
  2028. }
  2029. }
  2030. /// <summary>
  2031. /// 编辑结束后
  2032. /// </summary>
  2033. /// <param name="sender"></param>
  2034. /// <param name="e"></param>
  2035. private void dataGridView1_RowLeave(object sender, DataGridViewCellEventArgs e)
  2036. {
  2037. this.dataGridView1.Rows[e.RowIndex].ReadOnly = true;
  2038. this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = SystemColors.ControlLightLight;
  2039. }
  2040. /// <summary>
  2041. /// 样品保存
  2042. /// </summary>
  2043. /// <param name="sender"></param>
  2044. /// <param name="e"></param>
  2045. private void button5_Click(object sender, EventArgs e)
  2046. {
  2047. if (this.button3.Visible)
  2048. MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!");
  2049. else
  2050. {
  2051. if (string.IsNullOrEmpty(this.textBox1.Text))
  2052. {
  2053. MessageBox.Show(PdnResources.GetString("Menu.Pleaseenterthesamplename.text")+"!");
  2054. this.textBox1.Focus();
  2055. }
  2056. else
  2057. {
  2058. bool canAdd = true;
  2059. for (int i = 0; i < dataGridView1.Rows.Count; i++)
  2060. {
  2061. if (this.textBox1.Text.Equals(dataGridView1.Rows[i].Cells[0].Value))
  2062. {
  2063. MessageBox.Show(PdnResources.GetString("Menu.Namealreadyexists.text")+"!");
  2064. this.textBox1.Focus();
  2065. canAdd = false;
  2066. }
  2067. }
  2068. if (canAdd)
  2069. {
  2070. this.pointDrawkb = true;
  2071. DataTable dataTable = new DataTable();
  2072. DataGridViewRow row = new DataGridViewRow();
  2073. DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
  2074. string name = this.textBox1.Text;
  2075. textboxcell.Value = this.textBox1.Text;
  2076. dataTable.TableName = this.textBox1.Text;
  2077. this.pointDataTables.Add(dataTable);
  2078. row.Cells.Add(textboxcell);
  2079. textboxcell = new DataGridViewTextBoxCell();
  2080. textboxcell.Value = this.textBox2.Text;
  2081. row.Cells.Add(textboxcell);
  2082. DataGridViewButtonCell dataGridViewButtonCell = new DataGridViewButtonCell();
  2083. dataGridViewButtonCell.Value = PdnResources.GetString("Menu.Edit.Text");
  2084. row.Cells.Add(dataGridViewButtonCell);
  2085. dataGridViewButtonCell = new DataGridViewButtonCell();
  2086. dataGridViewButtonCell.Value = PdnResources.GetString("Menu.Edit.Delete.Text");
  2087. row.Cells.Add(dataGridViewButtonCell);
  2088. row.ReadOnly = true;
  2089. this.dataGridView1.Rows.Add(row);
  2090. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;
  2091. InitializeMeasurementPpointList(this.textBox1.Text);
  2092. this.textBox1.Clear();
  2093. this.textBox2.Clear();
  2094. //this.pointCountA1 = 0;
  2095. //this.pointCountA2 = 0;
  2096. //this.pointCountA3 = 0;
  2097. //this.pointCountB1 = 0;
  2098. //this.pointCountB2 = 0;
  2099. //this.pointCountB3 = 0;
  2100. //this.pointCountB4 = 0;
  2101. //this.pointCountC1 = 0;
  2102. //this.pointCountC2 = 0;
  2103. //this.pointCountC3 = 0;
  2104. //this.pointCountC4 = 0;
  2105. //this.pointCountC5 = 0;
  2106. //this.rectangleFs.Clear();
  2107. if (this.dataGridView1.DisplayedRowCount(false) != this.dataGridView1.RowCount)
  2108. this.dataGridView1.Columns[1].Width = 142;
  2109. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + name;
  2110. pointRectangleFs.Add(new List<RectangleF>());
  2111. pointCountA1.Add(0);
  2112. pointCountA2.Add(0);
  2113. pointCountA3.Add(0);
  2114. pointCountB1.Add(0);
  2115. pointCountB2.Add(0);
  2116. pointCountB3.Add(0);
  2117. pointCountB4.Add(0);
  2118. pointCountC1.Add(0);
  2119. pointCountC2.Add(0);
  2120. pointCountC3.Add(0);
  2121. pointCountC4.Add(0);
  2122. pointCountC5.Add(0);
  2123. if(this.linesNumber == 3)
  2124. {
  2125. this.lengthL1.Add(new List<decimal>());
  2126. this.lengthL2.Add(new List<decimal>());
  2127. this.lengthL3.Add(new List<decimal>());
  2128. }
  2129. else if (this.linesNumber == 4)
  2130. {
  2131. this.lengthL1.Add(new List<decimal>());
  2132. this.lengthL2.Add(new List<decimal>());
  2133. this.lengthL3.Add(new List<decimal>());
  2134. this.lengthL4.Add(new List<decimal>());
  2135. }
  2136. else if (this.linesNumber == 5)
  2137. {
  2138. this.lengthL1.Add(new List<decimal>());
  2139. this.lengthL2.Add(new List<decimal>());
  2140. this.lengthL3.Add(new List<decimal>());
  2141. this.lengthL4.Add(new List<decimal>());
  2142. this.lengthL5.Add(new List<decimal>());
  2143. }
  2144. //保存处理后的图片
  2145. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  2146. List<Bitmap> tempBit = new List<Bitmap>();
  2147. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  2148. originalBit.Tag = pantographRatio;
  2149. tempBit.Add(originalBit);
  2150. Graphics graphics;
  2151. Bitmap newBit;
  2152. Bitmap processedBit;
  2153. if (this.documentItems[this.listView1.FocusedItem.Index].phaseModels.Count != 0
  2154. && this.documentItems[this.listView1.FocusedItem.Index].phaseModels[0].mat != null)
  2155. {
  2156. processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
  2157. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2158. graphics = Graphics.FromImage(newBit);
  2159. graphics.DrawImage(processedBit, new PointF(0, 0));
  2160. Draw(graphics);
  2161. newBit.Tag = pantographRatio;
  2162. tempBit.Add(newBit);
  2163. }
  2164. else
  2165. {
  2166. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2167. graphics = Graphics.FromImage(newBit);
  2168. Draw(graphics);
  2169. newBit.Tag = pantographRatio;
  2170. tempBit.Add(newBit);
  2171. }
  2172. if (bitDic1.ContainsKey(tag))
  2173. bitDic1[tag] = tempBit;
  2174. else
  2175. bitDic1.Add(tag, tempBit);
  2176. this.saveSuccess = true;
  2177. this.documentWorkspace.Refresh();
  2178. }
  2179. }
  2180. }
  2181. }
  2182. /// <summary>
  2183. /// 单元格点击
  2184. /// </summary>
  2185. /// <param name="sender"></param>
  2186. /// <param name="e"></param>
  2187. private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
  2188. {
  2189. dataGridView1.Rows[e.RowIndex].Selected = true;
  2190. if (e.RowIndex < 0)
  2191. return;
  2192. if (e.ColumnIndex < 0)
  2193. return;
  2194. if (PdnResources.GetString("Menu.Edit.Delete.Text").Equals(this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value))
  2195. {
  2196. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethesample?.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  2197. if (dr == DialogResult.OK)
  2198. {
  2199. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
  2200. if (bitDic1.ContainsKey(tag))
  2201. bitDic1.Remove(tag);
  2202. if(this.linesNumber == 3)
  2203. {
  2204. this.lengthL1.RemoveAt(e.RowIndex);
  2205. this.lengthL2.RemoveAt(e.RowIndex);
  2206. this.lengthL3.RemoveAt(e.RowIndex);
  2207. }
  2208. else if (this.linesNumber == 4)
  2209. {
  2210. this.lengthL1.RemoveAt(e.RowIndex);
  2211. this.lengthL2.RemoveAt(e.RowIndex);
  2212. this.lengthL3.RemoveAt(e.RowIndex);
  2213. this.lengthL4.RemoveAt(e.RowIndex);
  2214. }
  2215. else if (this.linesNumber == 5)
  2216. {
  2217. this.lengthL1.RemoveAt(e.RowIndex);
  2218. this.lengthL2.RemoveAt(e.RowIndex);
  2219. this.lengthL3.RemoveAt(e.RowIndex);
  2220. this.lengthL4.RemoveAt(e.RowIndex);
  2221. this.lengthL5.RemoveAt(e.RowIndex);
  2222. }
  2223. if (this.dataGridView1.Rows.Count > 0)
  2224. {
  2225. this.pointRectangleFs.RemoveAt(e.RowIndex);
  2226. this.pointCountA1.RemoveAt(e.RowIndex);
  2227. this.pointCountA2.RemoveAt(e.RowIndex);
  2228. this.pointCountA3.RemoveAt(e.RowIndex);
  2229. this.pointCountB1.RemoveAt(e.RowIndex);
  2230. this.pointCountB2.RemoveAt(e.RowIndex);
  2231. this.pointCountB3.RemoveAt(e.RowIndex);
  2232. this.pointCountB4.RemoveAt(e.RowIndex);
  2233. this.pointCountC1.RemoveAt(e.RowIndex);
  2234. this.pointCountC2.RemoveAt(e.RowIndex);
  2235. this.pointCountC3.RemoveAt(e.RowIndex);
  2236. this.pointCountC4.RemoveAt(e.RowIndex);
  2237. this.pointCountC5.RemoveAt(e.RowIndex);
  2238. }
  2239. int deleteIndex = 0;
  2240. foreach (var dataTable in this.pointDataTables)
  2241. {
  2242. if (this.pointDataTables[deleteIndex].TableName.Equals(this.dataGridView1.Rows[e.RowIndex].Cells[0].Value))
  2243. {
  2244. this.pointDataTables.RemoveAt(deleteIndex);
  2245. break;
  2246. }
  2247. deleteIndex++;
  2248. }
  2249. //if (e.RowIndex == this.dataGridView1.Rows.Count - 1)
  2250. //{
  2251. // this.pointCountA1 = 0;
  2252. // this.pointCountA2 = 0;
  2253. // this.pointCountA3 = 0;
  2254. // this.pointCountB1 = 0;
  2255. // this.pointCountB2 = 0;
  2256. // this.pointCountB3 = 0;
  2257. // this.pointCountB4 = 0;
  2258. // this.pointCountC1 = 0;
  2259. // this.pointCountC2 = 0;
  2260. // this.pointCountC3 = 0;
  2261. // this.pointCountC4 = 0;
  2262. // this.pointCountC5 = 0;
  2263. // this.rectangleFs.Clear();
  2264. //}
  2265. this.dataGridView1.Rows.RemoveAt(e.RowIndex);
  2266. if (this.dataGridView1.Rows.Count > 0)
  2267. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;
  2268. else
  2269. {
  2270. //this.pointCountA1 = 0;
  2271. //this.pointCountA2 = 0;
  2272. //this.pointCountA3 = 0;
  2273. //this.pointCountB1 = 0;
  2274. //this.pointCountB2 = 0;
  2275. //this.pointCountB3 = 0;
  2276. //this.pointCountB4 = 0;
  2277. //this.pointCountC1 = 0;
  2278. //this.pointCountC2 = 0;
  2279. //this.pointCountC3 = 0;
  2280. //this.pointCountC4 = 0;
  2281. //this.pointCountC5 = 0;
  2282. //this.rectangleFs.Clear();
  2283. this.pointDrawkb = false;
  2284. this.dataGridView2.Rows.Clear();
  2285. this.dataGridView3.Rows.Clear();
  2286. }
  2287. if (this.dataGridView1.DisplayedRowCount(false) == this.dataGridView1.RowCount)
  2288. this.dataGridView1.Columns[1].Width = 157;
  2289. this.saveSuccess = true;
  2290. this.documentWorkspace.Refresh();
  2291. }
  2292. }
  2293. else if (PdnResources.GetString("Menu.Edit.Text").Equals(this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value))
  2294. {
  2295. MessageBox.Show(PdnResources.GetString("Menu.Thecurrentlinecanbeedited.text")+"!");
  2296. this.dataGridView1.ClearSelection();
  2297. this.dataGridView1.Rows[e.RowIndex].ReadOnly = false;
  2298. this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.GreenYellow;
  2299. }
  2300. }
  2301. /// <summary>
  2302. /// 添加样品成功时初
  2303. /// 始化测量点列表
  2304. /// </summary>
  2305. private void InitializeMeasurementPpointList(string sampleName)
  2306. {
  2307. int dataTableIndex = 0;
  2308. for (int i = 0; i < this.pointDataTables.Count; i++)
  2309. {
  2310. if (this.pointDataTables[i].TableName.Equals(sampleName))
  2311. dataTableIndex = i;
  2312. }
  2313. // 配置文件中取得测量点列表值
  2314. if (workpieceMaintenanceModel.Workpieces != null && this.comboBox1.DataSource != null)
  2315. {
  2316. this.dataGridView2.Rows.Clear();
  2317. this.dataGridView3.Rows.Clear();
  2318. for (int i = 0; i < workpieceMaintenanceModel.Workpieces.Count; i++)
  2319. {
  2320. // 选中的工件
  2321. if (workpieceMaintenanceModel.Workpieces[i].Name.Equals(this.comboBox1.SelectedValue))
  2322. {
  2323. // 工件A
  2324. if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeA))
  2325. {
  2326. DataGridViewRow dgvr = new DataGridViewRow();
  2327. DataGridViewRow dgvr1 = new DataGridViewRow();
  2328. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2329. {
  2330. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2331. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2332. }
  2333. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2334. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2335. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2336. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2337. this.dataGridView2.Rows.Add(dgvr);
  2338. this.dataGridView3.Rows.Add(dgvr1);
  2339. }
  2340. // 工件B
  2341. else if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeB))
  2342. {
  2343. DataGridViewRow dgvr = new DataGridViewRow();
  2344. DataGridViewRow dgvr1 = new DataGridViewRow();
  2345. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2346. {
  2347. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2348. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2349. }
  2350. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2351. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2352. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2353. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2354. this.dataGridView2.Rows.Add(dgvr);
  2355. this.dataGridView3.Rows.Add(dgvr1);
  2356. dgvr = new DataGridViewRow();
  2357. dgvr1 = new DataGridViewRow();
  2358. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2359. {
  2360. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2361. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2362. }
  2363. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2364. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2365. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2366. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2367. this.dataGridView2.Rows.Add(dgvr);
  2368. this.dataGridView3.Rows.Add(dgvr1);
  2369. }
  2370. // 工件C
  2371. else if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeC))
  2372. {
  2373. DataGridViewRow dgvr = new DataGridViewRow();
  2374. DataGridViewRow dgvr1 = new DataGridViewRow();
  2375. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2376. {
  2377. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2378. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2379. }
  2380. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2381. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2382. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2383. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2384. this.dataGridView2.Rows.Add(dgvr);
  2385. this.dataGridView3.Rows.Add(dgvr1);
  2386. dgvr = new DataGridViewRow();
  2387. dgvr1 = new DataGridViewRow();
  2388. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2389. {
  2390. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2391. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2392. }
  2393. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2394. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2395. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2396. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2397. this.dataGridView2.Rows.Add(dgvr);
  2398. this.dataGridView3.Rows.Add(dgvr1);
  2399. dgvr = new DataGridViewRow();
  2400. dgvr1 = new DataGridViewRow();
  2401. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2402. {
  2403. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2404. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2405. }
  2406. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameC;
  2407. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueC + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorC;
  2408. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameC;
  2409. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueC + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorC;
  2410. this.dataGridView2.Rows.Add(dgvr);
  2411. this.dataGridView3.Rows.Add(dgvr1);
  2412. }
  2413. // 工件D
  2414. else if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeD))
  2415. {
  2416. DataGridViewRow dgvr = new DataGridViewRow();
  2417. DataGridViewRow dgvr1 = new DataGridViewRow();
  2418. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2419. {
  2420. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2421. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2422. }
  2423. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2424. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2425. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2426. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2427. this.dataGridView2.Rows.Add(dgvr);
  2428. this.dataGridView3.Rows.Add(dgvr1);
  2429. dgvr = new DataGridViewRow();
  2430. dgvr1 = new DataGridViewRow();
  2431. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2432. {
  2433. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2434. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2435. }
  2436. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2437. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2438. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2439. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2440. this.dataGridView2.Rows.Add(dgvr);
  2441. this.dataGridView3.Rows.Add(dgvr1);
  2442. dgvr = new DataGridViewRow();
  2443. dgvr1 = new DataGridViewRow();
  2444. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2445. {
  2446. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2447. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2448. }
  2449. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameC;
  2450. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueC + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorC;
  2451. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameC;
  2452. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueC + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorC;
  2453. this.dataGridView2.Rows.Add(dgvr);
  2454. this.dataGridView3.Rows.Add(dgvr1);
  2455. dgvr = new DataGridViewRow();
  2456. dgvr1 = new DataGridViewRow();
  2457. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2458. {
  2459. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2460. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2461. }
  2462. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameD;
  2463. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueD + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorD;
  2464. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameD;
  2465. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueD + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorD;
  2466. this.dataGridView2.Rows.Add(dgvr);
  2467. this.dataGridView3.Rows.Add(dgvr1);
  2468. }
  2469. // 工件E
  2470. else if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeE))
  2471. {
  2472. DataGridViewRow dgvr = new DataGridViewRow();
  2473. DataGridViewRow dgvr1 = new DataGridViewRow();
  2474. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2475. {
  2476. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2477. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2478. }
  2479. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2480. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2481. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2482. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2483. this.dataGridView2.Rows.Add(dgvr);
  2484. this.dataGridView3.Rows.Add(dgvr1);
  2485. dgvr = new DataGridViewRow();
  2486. dgvr1 = new DataGridViewRow();
  2487. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2488. {
  2489. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2490. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2491. }
  2492. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2493. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2494. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2495. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2496. this.dataGridView2.Rows.Add(dgvr);
  2497. this.dataGridView3.Rows.Add(dgvr1);
  2498. }
  2499. foreach (DataGridViewColumn c in this.dataGridView3.Columns)
  2500. {
  2501. this.pointDataTables[dataTableIndex].Columns.Add(c.Name);
  2502. }
  2503. for (int r = 0; r < this.dataGridView3.Rows.Count; r++)
  2504. {
  2505. DataRow dataRow = this.pointDataTables[dataTableIndex].NewRow();
  2506. for (int c = 0; c < this.dataGridView3.Rows[r].Cells.Count; c++)
  2507. {
  2508. dataRow[this.dataGridView3.Columns[c].Name] = this.dataGridView3.Rows[r].Cells[c].Value;
  2509. }
  2510. this.pointDataTables[dataTableIndex].Rows.Add(dataRow);
  2511. }
  2512. }
  2513. }
  2514. }
  2515. }
  2516. /// <summary>
  2517. /// 画布绘制
  2518. /// </summary>
  2519. /// <param name="sender"></param>
  2520. /// <param name="e"></param>
  2521. private void Panel_Paint(object sender, PaintEventArgs e)
  2522. {
  2523. if (this.documentWorkspace.CompositionSurface != null)
  2524. {
  2525. //
  2526. // 以下是计算绘制图片的位置和大小并绘制图片
  2527. //
  2528. Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
  2529. int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
  2530. int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
  2531. int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
  2532. int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
  2533. //
  2534. // 以下是绘制网格、标注、测量、视场等开始
  2535. //
  2536. e.Graphics.TranslateTransform(x, y);
  2537. e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
  2538. Draw(e.Graphics);
  2539. if (this.listView1.SelectedItems.Count > 0 && this.dataGridView1.SelectedCells.Count > 0)
  2540. {
  2541. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value.ToString();
  2542. //保存处理后的图片
  2543. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  2544. List<Bitmap> tempBit = new List<Bitmap>();
  2545. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  2546. originalBit.Tag = pantographRatio;
  2547. tempBit.Add(originalBit);
  2548. Graphics graphics;
  2549. Bitmap newBit;
  2550. Bitmap processedBit;
  2551. if (this.documentItems[this.listView1.FocusedItem.Index].phaseModels.Count != 0
  2552. && this.documentItems[this.listView1.FocusedItem.Index].phaseModels[0].mat != null)
  2553. {
  2554. processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
  2555. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2556. graphics = Graphics.FromImage(newBit);
  2557. graphics.DrawImage(processedBit, new PointF(0, 0));
  2558. Draw(graphics);
  2559. newBit.Tag = pantographRatio;
  2560. tempBit.Add(newBit);
  2561. }
  2562. else
  2563. {
  2564. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2565. graphics = Graphics.FromImage(newBit);
  2566. Draw(graphics);
  2567. newBit.Tag = pantographRatio;
  2568. tempBit.Add(newBit);
  2569. }
  2570. Draw(graphics);
  2571. newBit.Tag = pantographRatio;
  2572. tempBit.Add(newBit);
  2573. if (bitDic1.ContainsKey(tag))
  2574. bitDic1[tag] = tempBit;
  2575. }
  2576. e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
  2577. e.Graphics.TranslateTransform(-x, -y);
  2578. }
  2579. }
  2580. /// <summary>
  2581. /// 获取辅助线和测量点样式
  2582. /// </summary>
  2583. public void RefreshPanel()
  2584. {
  2585. // 辅助线样式
  2586. CompoundRatioStyleModel compoundRatioStyleModelGuideStyle = XmlSerializeHelper.DESerializer<CompoundRatioStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GuideStyle.xml", FileMode.Open));
  2587. if (compoundRatioStyleModelGuideStyle.guideStyle != null)
  2588. {
  2589. this.lineFont = compoundRatioStyleModelGuideStyle.guideStyle.font;
  2590. this.lineFontSize = compoundRatioStyleModelGuideStyle.guideStyle.fontSize;
  2591. this.lineColor = compoundRatioStyleModelGuideStyle.guideStyle.lineColor;
  2592. this.linesNumber = compoundRatioStyleModelGuideStyle.guideStyle.linesNumber;
  2593. this.lineWidth = compoundRatioStyleModelGuideStyle.guideStyle.lineWidth;
  2594. if(unitLength != 0)
  2595. this.lineSpacing = (float)(compoundRatioStyleModelGuideStyle.guideStyle.spacing / unitLength);
  2596. if (this.linesNumber == 3)
  2597. {
  2598. this.dataGridView2.Columns[5].Visible = false;
  2599. this.dataGridView2.Columns[6].Visible = false;
  2600. this.dataGridView3.Columns[5].Visible = false;
  2601. this.dataGridView3.Columns[6].Visible = false;
  2602. }
  2603. else if(this.linesNumber == 4)
  2604. {
  2605. this.dataGridView2.Columns[5].Visible = true;
  2606. this.dataGridView2.Columns[6].Visible = false;
  2607. this.dataGridView3.Columns[5].Visible = true;
  2608. this.dataGridView3.Columns[6].Visible = false;
  2609. }
  2610. else if (this.linesNumber == 5)
  2611. {
  2612. this.dataGridView2.Columns[5].Visible = true;
  2613. this.dataGridView2.Columns[6].Visible = true;
  2614. this.dataGridView3.Columns[5].Visible = true;
  2615. this.dataGridView3.Columns[6].Visible = true;
  2616. }
  2617. }
  2618. // 测量点样式
  2619. CompoundRatioStyleModel compoundRatioStyleModelSurvePointStyle = XmlSerializeHelper.DESerializer<CompoundRatioStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\SurvePointStyle.xml", FileMode.Open));
  2620. if (compoundRatioStyleModelSurvePointStyle.survePointStyle != null)
  2621. {
  2622. this.pointFont = compoundRatioStyleModelSurvePointStyle.survePointStyle.font;
  2623. this.pointFontSize = compoundRatioStyleModelSurvePointStyle.survePointStyle.fontSize;
  2624. this.pointColor = compoundRatioStyleModelSurvePointStyle.survePointStyle.pointColor;
  2625. this.pointDiameter = (float)(compoundRatioStyleModelSurvePointStyle.survePointStyle.pointDiameter / unitLength);
  2626. this.pointMarkerSymbol = compoundRatioStyleModelSurvePointStyle.survePointStyle.pointMarkerSymbol;
  2627. this.pointStyle = compoundRatioStyleModelSurvePointStyle.survePointStyle.pointStyle;
  2628. this.pointWidth = compoundRatioStyleModelSurvePointStyle.survePointStyle.pointWidth;
  2629. }
  2630. this.documentWorkspace.Refresh();
  2631. }
  2632. /// <summary>
  2633. /// 绘制
  2634. /// </summary>
  2635. private void Draw(Graphics graphics)
  2636. {
  2637. // 抗锯齿
  2638. graphics.SmoothingMode = SmoothingMode.AntiAlias;
  2639. // 以下为绘制样式
  2640. Pen linePen = new Pen(Color.FromArgb(this.lineColor), this.lineWidth);
  2641. Pen pointPen = new Pen(Color.FromArgb(this.pointColor), this.pointWidth);
  2642. Font pointFont = new Font(this.pointFont, this.pointFontSize);
  2643. Font lineFont = new Font(this.lineFont, this.lineFontSize);
  2644. SolidBrush brush = new SolidBrush(Color.FromArgb(this.pointColor));
  2645. /// 测量点操作限制
  2646. if(this.dataGridView1.SelectedRows.Count > 0)
  2647. {
  2648. this.button6.Enabled = this.pointDrawkb;
  2649. this.button7.Enabled = this.pointDrawkb;
  2650. this.button8.Enabled = this.pointDrawkb;
  2651. }
  2652. #region 绘制辅助线
  2653. // 线条数为三
  2654. if (this.linesNumber == 3)
  2655. {
  2656. // 绘制辅助线
  2657. graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing, 0), new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing, this.documentWorkspace.CompositionSurface.Height));
  2658. graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2, this.documentWorkspace.CompositionSurface.Height));
  2659. graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing, 0), new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing, this.documentWorkspace.CompositionSurface.Height));
  2660. }
  2661. // 线条数为四
  2662. else if (this.linesNumber == 4)
  2663. {
  2664. // 绘制辅助线
  2665. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2, this.documentWorkspace.CompositionSurface.Height));
  2666. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2, this.documentWorkspace.CompositionSurface.Height));
  2667. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2, this.documentWorkspace.CompositionSurface.Height));
  2668. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2, this.documentWorkspace.CompositionSurface.Height));
  2669. }
  2670. // 线条数为五
  2671. else if (this.linesNumber == 5)
  2672. {
  2673. // 绘制辅助线
  2674. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing, this.documentWorkspace.CompositionSurface.Height));
  2675. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing, this.documentWorkspace.CompositionSurface.Height));
  2676. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2, this.documentWorkspace.CompositionSurface.Height));
  2677. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing, this.documentWorkspace.CompositionSurface.Height));
  2678. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing, this.documentWorkspace.CompositionSurface.Height));
  2679. }
  2680. #endregion
  2681. if (this.dataGridView1.SelectedCells.Count == 0
  2682. || this.pointRectangleFs.Count == 0
  2683. || this.dataGridView1.SelectedCells[0].RowIndex >= this.pointRectangleFs.Count)
  2684. return;
  2685. RectangleF rectangleF = new RectangleF();
  2686. #region 线条数为三时的定义
  2687. List<RectangleF> threeLine1RectangleFs = new List<RectangleF>();
  2688. List<RectangleF> threeLine2RectangleFs = new List<RectangleF>();
  2689. List<RectangleF> threeLine3RectangleFs = new List<RectangleF>();
  2690. int threeLine1PointCount = 0;
  2691. int threeLine2PointCount = 0;
  2692. int threeLine3PointCount = 0;
  2693. #endregion
  2694. #region 线条数为四时的定义
  2695. List<RectangleF> fourLine1RectangleFs = new List<RectangleF>();
  2696. List<RectangleF> fourLine2RectangleFs = new List<RectangleF>();
  2697. List<RectangleF> fourLine3RectangleFs = new List<RectangleF>();
  2698. List<RectangleF> fourLine4RectangleFs = new List<RectangleF>();
  2699. int fourLine1PointCount = 0;
  2700. int fourLine2PointCount = 0;
  2701. int fourLine3PointCount = 0;
  2702. int fourLine4PointCount = 0;
  2703. #endregion
  2704. #region 线条数为五时的定义
  2705. List<RectangleF> fiveLine1RectangleFs = new List<RectangleF>();
  2706. List<RectangleF> fiveLine2RectangleFs = new List<RectangleF>();
  2707. List<RectangleF> fiveLine3RectangleFs = new List<RectangleF>();
  2708. List<RectangleF> fiveLine4RectangleFs = new List<RectangleF>();
  2709. List<RectangleF> fiveLine5RectangleFs = new List<RectangleF>();
  2710. int fiveLine1PointCount = 0;
  2711. int fiveLine2PointCount = 0;
  2712. int fiveLine3PointCount = 0;
  2713. int fiveLine4PointCount = 0;
  2714. int fiveLine5PointCount = 0;
  2715. #endregion
  2716. #region 循环用于绘制测量点的矩形的集合
  2717. for (int i = 0; i < this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count; i++)
  2718. {
  2719. #region 更改样式时的自动绘制
  2720. rectangleF = this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i];
  2721. // 更新矩形的宽高与测量点直径保持一致
  2722. rectangleF.Width = this.pointDiameter;
  2723. rectangleF.Height = this.pointDiameter;
  2724. // 线条数为三
  2725. if (this.linesNumber == 3)
  2726. {
  2727. // 第一条线
  2728. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2)
  2729. {
  2730. threeLine1PointCount++;
  2731. if (this.type.Equals(constTypeA))
  2732. {
  2733. if (threeLine1PointCount <= 3)
  2734. threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2735. }
  2736. else if (this.type.Equals(constTypeB))
  2737. {
  2738. if (threeLine1PointCount <= 4)
  2739. threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2740. }
  2741. else if (this.type.Equals(constTypeC))
  2742. {
  2743. if (threeLine1PointCount <= 5)
  2744. threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2745. }
  2746. else if (this.type.Equals(constTypeD))
  2747. {
  2748. if (threeLine1PointCount <= 6)
  2749. threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2750. }
  2751. else if (this.type.Equals(constTypeE))
  2752. {
  2753. if (threeLine1PointCount <= 4)
  2754. threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2755. }
  2756. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.pointDiameter / 2;
  2757. }
  2758. // 第二条线
  2759. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2
  2760. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2)
  2761. {
  2762. threeLine2PointCount++;
  2763. if (this.type.Equals(constTypeA))
  2764. {
  2765. if (threeLine2PointCount <= 3)
  2766. threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2767. }
  2768. else if (this.type.Equals(constTypeB))
  2769. {
  2770. if (threeLine2PointCount <= 4)
  2771. threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2772. }
  2773. else if (this.type.Equals(constTypeC))
  2774. {
  2775. if (threeLine2PointCount <= 5)
  2776. threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2777. }
  2778. else if (this.type.Equals(constTypeD))
  2779. {
  2780. if (threeLine2PointCount <= 6)
  2781. threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2782. }
  2783. else if (this.type.Equals(constTypeE))
  2784. {
  2785. if (threeLine2PointCount <= 4)
  2786. threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2787. }
  2788. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.pointDiameter / 2;
  2789. }
  2790. // 第三条线
  2791. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.pointDiameter / 2)
  2792. {
  2793. threeLine3PointCount++;
  2794. if (this.type.Equals(constTypeA))
  2795. {
  2796. if (threeLine3PointCount <= 3)
  2797. threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2798. }
  2799. else if (this.type.Equals(constTypeB))
  2800. {
  2801. if (threeLine3PointCount <= 4)
  2802. threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2803. }
  2804. else if (this.type.Equals(constTypeC))
  2805. {
  2806. if (threeLine3PointCount <= 5)
  2807. threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2808. }
  2809. else if (this.type.Equals(constTypeD))
  2810. {
  2811. if (threeLine3PointCount <= 6)
  2812. threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2813. }
  2814. else if (this.type.Equals(constTypeE))
  2815. {
  2816. if (threeLine3PointCount <= 4)
  2817. threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2818. }
  2819. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.pointDiameter / 2;
  2820. }
  2821. }
  2822. // 线条数为四
  2823. else if (this.linesNumber == 4)
  2824. {
  2825. // 第一条线
  2826. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing)
  2827. {
  2828. fourLine1PointCount++;
  2829. if (this.type.Equals(constTypeA))
  2830. {
  2831. if (fourLine1PointCount <= 3)
  2832. fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2833. }
  2834. else if (this.type.Equals(constTypeB))
  2835. {
  2836. if (fourLine1PointCount <= 4)
  2837. fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2838. }
  2839. else if (this.type.Equals(constTypeC))
  2840. {
  2841. if (fourLine1PointCount <= 5)
  2842. fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2843. }
  2844. else if (this.type.Equals(constTypeD))
  2845. {
  2846. if (fourLine1PointCount <= 6)
  2847. fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2848. }
  2849. else if (this.type.Equals(constTypeE))
  2850. {
  2851. if (fourLine1PointCount <= 4)
  2852. fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2853. }
  2854. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2 - this.pointDiameter / 2;
  2855. }
  2856. // 第二条线
  2857. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2
  2858. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing)
  2859. {
  2860. fourLine2PointCount++;
  2861. if (this.type.Equals(constTypeA))
  2862. {
  2863. if (fourLine2PointCount <= 3)
  2864. fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2865. }
  2866. else if (this.type.Equals(constTypeB))
  2867. {
  2868. if (fourLine2PointCount <= 4)
  2869. fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2870. }
  2871. else if (this.type.Equals(constTypeC))
  2872. {
  2873. if (fourLine2PointCount <= 5)
  2874. fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2875. }
  2876. else if (this.type.Equals(constTypeD))
  2877. {
  2878. if (fourLine2PointCount <= 6)
  2879. fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2880. }
  2881. else if (this.type.Equals(constTypeE))
  2882. {
  2883. if (fourLine2PointCount <= 4)
  2884. fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2885. }
  2886. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 - this.pointDiameter / 2;
  2887. }
  2888. // 第三条线
  2889. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing
  2890. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2)
  2891. {
  2892. fourLine3PointCount++;
  2893. if (this.type.Equals(constTypeA))
  2894. {
  2895. if (fourLine3PointCount <= 3)
  2896. fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2897. }
  2898. else if (this.type.Equals(constTypeB))
  2899. {
  2900. if (fourLine3PointCount <= 4)
  2901. fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2902. }
  2903. else if (this.type.Equals(constTypeC))
  2904. {
  2905. if (fourLine3PointCount <= 5)
  2906. fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2907. }
  2908. else if (this.type.Equals(constTypeD))
  2909. {
  2910. if (fourLine3PointCount <= 6)
  2911. fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2912. }
  2913. else if (this.type.Equals(constTypeE))
  2914. {
  2915. if (fourLine3PointCount <= 4)
  2916. fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2917. }
  2918. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 - this.pointDiameter / 2;
  2919. }
  2920. // 第四条线
  2921. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing)
  2922. {
  2923. fourLine4PointCount++;
  2924. if (this.type.Equals(constTypeA))
  2925. {
  2926. if (fourLine4PointCount <= 3)
  2927. fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2928. }
  2929. else if (this.type.Equals(constTypeB))
  2930. {
  2931. if (fourLine4PointCount <= 4)
  2932. fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2933. }
  2934. else if (this.type.Equals(constTypeC))
  2935. {
  2936. if (fourLine4PointCount <= 5)
  2937. fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2938. }
  2939. else if (this.type.Equals(constTypeD))
  2940. {
  2941. if (fourLine4PointCount <= 6)
  2942. fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2943. }
  2944. else if (this.type.Equals(constTypeE))
  2945. {
  2946. if (fourLine4PointCount <= 4)
  2947. fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2948. }
  2949. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 - this.pointDiameter / 2;
  2950. }
  2951. }
  2952. // 线条数为五
  2953. else if(this.linesNumber == 5)
  2954. {
  2955. // 第一条线
  2956. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2)
  2957. {
  2958. fiveLine1PointCount++;
  2959. if (this.type.Equals(constTypeA))
  2960. {
  2961. if (fiveLine1PointCount <= 3)
  2962. fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2963. }
  2964. else if (this.type.Equals(constTypeB))
  2965. {
  2966. if (fiveLine1PointCount <= 4)
  2967. fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2968. }
  2969. else if (this.type.Equals(constTypeC))
  2970. {
  2971. if (fiveLine1PointCount <= 5)
  2972. fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2973. }
  2974. else if (this.type.Equals(constTypeD))
  2975. {
  2976. if (fiveLine1PointCount <= 6)
  2977. fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2978. }
  2979. else if (this.type.Equals(constTypeE))
  2980. {
  2981. if (fiveLine1PointCount <= 4)
  2982. fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2983. }
  2984. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing - this.pointDiameter / 2;
  2985. }
  2986. // 第二条线
  2987. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2
  2988. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2)
  2989. {
  2990. fiveLine2PointCount++;
  2991. if (this.type.Equals(constTypeA))
  2992. {
  2993. if (fiveLine2PointCount <= 3)
  2994. fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2995. }
  2996. else if (this.type.Equals(constTypeB))
  2997. {
  2998. if (fiveLine2PointCount <= 4)
  2999. fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3000. }
  3001. else if (this.type.Equals(constTypeC))
  3002. {
  3003. if (fiveLine2PointCount <= 5)
  3004. fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3005. }
  3006. else if (this.type.Equals(constTypeD))
  3007. {
  3008. if (fiveLine2PointCount <= 6)
  3009. fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3010. }
  3011. else if (this.type.Equals(constTypeE))
  3012. {
  3013. if (fiveLine2PointCount <= 4)
  3014. fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3015. }
  3016. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.pointDiameter / 2;
  3017. }
  3018. // 第三条线
  3019. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2
  3020. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2)
  3021. {
  3022. fiveLine3PointCount++;
  3023. if (this.type.Equals(constTypeA))
  3024. {
  3025. if (fiveLine3PointCount <= 3)
  3026. fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3027. }
  3028. else if (this.type.Equals(constTypeB))
  3029. {
  3030. if (fiveLine3PointCount <= 4)
  3031. fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3032. }
  3033. else if (this.type.Equals(constTypeC))
  3034. {
  3035. if (fiveLine3PointCount <= 5)
  3036. fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3037. }
  3038. else if (this.type.Equals(constTypeD))
  3039. {
  3040. if (fiveLine3PointCount <= 6)
  3041. fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3042. }
  3043. else if (this.type.Equals(constTypeE))
  3044. {
  3045. if (fiveLine3PointCount <= 4)
  3046. fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3047. }
  3048. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.pointDiameter / 2;
  3049. }
  3050. // 第四条线
  3051. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2
  3052. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2)
  3053. {
  3054. fiveLine4PointCount++;
  3055. if (this.type.Equals(constTypeA))
  3056. {
  3057. if (fiveLine4PointCount <= 3)
  3058. fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3059. }
  3060. else if (this.type.Equals(constTypeB))
  3061. {
  3062. if (fiveLine4PointCount <= 4)
  3063. fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3064. }
  3065. else if (this.type.Equals(constTypeC))
  3066. {
  3067. if (fiveLine4PointCount <= 5)
  3068. fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3069. }
  3070. else if (this.type.Equals(constTypeD))
  3071. {
  3072. if (fiveLine4PointCount <= 6)
  3073. fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3074. }
  3075. else if (this.type.Equals(constTypeE))
  3076. {
  3077. if (fiveLine4PointCount <= 4)
  3078. fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3079. }
  3080. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.pointDiameter / 2;
  3081. }
  3082. // 第五条线
  3083. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2)
  3084. {
  3085. fiveLine5PointCount++;
  3086. if (this.type.Equals(constTypeA))
  3087. {
  3088. if (fiveLine5PointCount <= 3)
  3089. fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3090. }
  3091. else if (this.type.Equals(constTypeB))
  3092. {
  3093. if (fiveLine5PointCount <= 4)
  3094. fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3095. }
  3096. else if (this.type.Equals(constTypeC))
  3097. {
  3098. if (fiveLine5PointCount <= 5)
  3099. fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3100. }
  3101. else if (this.type.Equals(constTypeD))
  3102. {
  3103. if (fiveLine5PointCount <= 6)
  3104. fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3105. }
  3106. else if (this.type.Equals(constTypeE))
  3107. {
  3108. if (fiveLine5PointCount <= 4)
  3109. fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3110. }
  3111. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing - this.pointDiameter / 2;
  3112. }
  3113. }
  3114. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i] = rectangleF;
  3115. #endregion
  3116. #region 绘制测量点
  3117. // 选中点
  3118. if (i == selected)
  3119. {
  3120. // 绘制选中边框
  3121. graphics.DrawRectangle(new Pen(Color.Black, 2), new Rectangle(new Point((int)this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X, (int)this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Y), new System.Drawing.Size((int)this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Width, (int)this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Height)));
  3122. }
  3123. // 点样式为空心
  3124. if (this.pointStyle == 0)
  3125. graphics.DrawEllipse(pointPen, this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3126. // 实心
  3127. else
  3128. graphics.FillEllipse(brush, this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3129. // 点标记
  3130. if(pointMarkerSymbol)
  3131. graphics.DrawString("p" + (i + 1), pointFont, new SolidBrush(Color.Black), new PointF(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Width, this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Y));
  3132. #endregion
  3133. }
  3134. #endregion
  3135. // 测量点间距
  3136. float a1 = 0, b1 = 0, c1 = 0, d1 = 0;
  3137. float a2 = 0, b2 = 0, c2 = 0, d2 = 0;
  3138. float a3 = 0, b3 = 0, c3 = 0, d3 = 0;
  3139. float a4 = 0, b4 = 0, c4 = 0, d4 = 0;
  3140. float a5 = 0, b5 = 0, c5 = 0, d5 = 0;
  3141. float w = 0;
  3142. // 初始化中间数据
  3143. if(lengthL1.Count > 0 && lengthL1.Count > this.dataGridView1.SelectedCells[0].RowIndex)
  3144. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex] = new List<decimal>();
  3145. if (lengthL2.Count > 0 && lengthL2.Count > this.dataGridView1.SelectedCells[0].RowIndex)
  3146. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex] = new List<decimal>();
  3147. if (lengthL3.Count > 0 && lengthL3.Count > this.dataGridView1.SelectedCells[0].RowIndex)
  3148. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex] = new List<decimal>();
  3149. if (lengthL4.Count > 0 && lengthL4.Count > this.dataGridView1.SelectedCells[0].RowIndex)
  3150. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex] = new List<decimal>();
  3151. if (lengthL5.Count > 0 && lengthL5.Count > this.dataGridView1.SelectedCells[0].RowIndex)
  3152. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex] = new List<decimal>();
  3153. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count > 0)
  3154. {
  3155. #region 是否在图像上显示数据
  3156. // 文本尺寸
  3157. SizeF sizeF;
  3158. #region 线条数为三时的辅助线文本绘制
  3159. if (this.linesNumber == 3)
  3160. {
  3161. if (this.type.Equals(constTypeA))
  3162. {
  3163. if (threeLine1RectangleFs.Count == 2)
  3164. {
  3165. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3166. }
  3167. else if (threeLine1RectangleFs.Count == 3)
  3168. {
  3169. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3170. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3171. }
  3172. if (threeLine2RectangleFs.Count == 2)
  3173. {
  3174. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3175. }
  3176. else if (threeLine2RectangleFs.Count == 3)
  3177. {
  3178. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3179. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3180. }
  3181. if (threeLine3RectangleFs.Count == 2)
  3182. {
  3183. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3184. }
  3185. else if (threeLine3RectangleFs.Count == 3)
  3186. {
  3187. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3188. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3189. }
  3190. if (threeLine1RectangleFs.Count > 1)
  3191. {
  3192. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3193. if (this.checkBox1.Checked)
  3194. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3195. lineFont, new SolidBrush(Color.Black),
  3196. new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2));
  3197. a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y);
  3198. }
  3199. if (threeLine2RectangleFs.Count > 1)
  3200. {
  3201. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3202. if (this.checkBox1.Checked)
  3203. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3204. lineFont, new SolidBrush(Color.Black),
  3205. new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2));
  3206. a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y);
  3207. }
  3208. if (threeLine3RectangleFs.Count > 1)
  3209. {
  3210. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3211. if (this.checkBox1.Checked)
  3212. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3213. lineFont, new SolidBrush(Color.Black),
  3214. new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2));
  3215. a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y);
  3216. }
  3217. }
  3218. else if (this.type.Equals(constTypeB))
  3219. {
  3220. if (threeLine1RectangleFs.Count == 2)
  3221. {
  3222. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3223. }
  3224. else if (threeLine1RectangleFs.Count == 3)
  3225. {
  3226. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3227. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3228. }
  3229. else if (threeLine1RectangleFs.Count == 4)
  3230. {
  3231. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3232. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3233. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength));
  3234. }
  3235. if (threeLine2RectangleFs.Count == 2)
  3236. {
  3237. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3238. }
  3239. else if (threeLine2RectangleFs.Count == 3)
  3240. {
  3241. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3242. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3243. }
  3244. else if (threeLine2RectangleFs.Count == 4)
  3245. {
  3246. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3247. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3248. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength));
  3249. }
  3250. if (threeLine3RectangleFs.Count == 2)
  3251. {
  3252. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3253. }
  3254. else if (threeLine2RectangleFs.Count == 3)
  3255. {
  3256. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3257. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3258. }
  3259. else if (threeLine3RectangleFs.Count == 4)
  3260. {
  3261. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3262. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3263. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength));
  3264. }
  3265. if (threeLine1RectangleFs.Count > 1)
  3266. {
  3267. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3268. if (this.checkBox1.Checked)
  3269. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3270. lineFont, new SolidBrush(Color.Black),
  3271. new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2));
  3272. a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y);
  3273. }
  3274. if (threeLine1RectangleFs.Count > 3)
  3275. {
  3276. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3277. if (this.checkBox1.Checked)
  3278. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3279. lineFont, new SolidBrush(Color.Black),
  3280. new PointF(threeLine1RectangleFs[2].X - sizeF.Width / 4, (threeLine1RectangleFs[2].Y + threeLine1RectangleFs[3].Y) / 2));
  3281. b1 = Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y);
  3282. }
  3283. if (threeLine2RectangleFs.Count > 1)
  3284. {
  3285. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3286. if (this.checkBox1.Checked)
  3287. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3288. lineFont, new SolidBrush(Color.Black),
  3289. new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2));
  3290. a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y);
  3291. }
  3292. if (threeLine2RectangleFs.Count > 3)
  3293. {
  3294. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3295. if (this.checkBox1.Checked)
  3296. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3297. lineFont, new SolidBrush(Color.Black),
  3298. new PointF(threeLine2RectangleFs[2].X - sizeF.Width / 4, (threeLine2RectangleFs[2].Y + threeLine2RectangleFs[3].Y) / 2));
  3299. b2 = Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y);
  3300. }
  3301. if (threeLine3RectangleFs.Count > 1)
  3302. {
  3303. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3304. if (this.checkBox1.Checked)
  3305. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3306. lineFont, new SolidBrush(Color.Black),
  3307. new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2));
  3308. a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y);
  3309. }
  3310. if (threeLine3RectangleFs.Count > 3)
  3311. {
  3312. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3313. if (this.checkBox1.Checked)
  3314. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3315. lineFont, new SolidBrush(Color.Black),
  3316. new PointF(threeLine3RectangleFs[2].X - sizeF.Width / 4, (threeLine3RectangleFs[2].Y + threeLine3RectangleFs[3].Y) / 2));
  3317. b3 = Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y);
  3318. }
  3319. }
  3320. else if (this.type.Equals(constTypeC))
  3321. {
  3322. if (threeLine1RectangleFs.Count == 2)
  3323. {
  3324. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3325. }
  3326. else if (threeLine1RectangleFs.Count == 3)
  3327. {
  3328. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3329. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3330. }
  3331. else if (threeLine1RectangleFs.Count == 4)
  3332. {
  3333. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3334. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3335. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength));
  3336. }
  3337. else if (threeLine1RectangleFs.Count == 5)
  3338. {
  3339. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3340. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3341. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength));
  3342. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength));
  3343. }
  3344. if (threeLine2RectangleFs.Count == 2)
  3345. {
  3346. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3347. }
  3348. else if (threeLine2RectangleFs.Count == 3)
  3349. {
  3350. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3351. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3352. }
  3353. else if (threeLine2RectangleFs.Count == 4)
  3354. {
  3355. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3356. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3357. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength));
  3358. }
  3359. else if (threeLine2RectangleFs.Count == 5)
  3360. {
  3361. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3362. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3363. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength));
  3364. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength));
  3365. }
  3366. if (threeLine3RectangleFs.Count == 2)
  3367. {
  3368. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3369. }
  3370. else if (threeLine2RectangleFs.Count == 3)
  3371. {
  3372. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3373. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3374. }
  3375. else if (threeLine2RectangleFs.Count == 4)
  3376. {
  3377. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3378. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3379. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength));
  3380. }
  3381. else if (threeLine3RectangleFs.Count == 5)
  3382. {
  3383. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3384. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3385. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength));
  3386. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength));
  3387. }
  3388. if (threeLine1RectangleFs.Count > 1)
  3389. {
  3390. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3391. if (this.checkBox1.Checked)
  3392. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3393. lineFont, new SolidBrush(Color.Black),
  3394. new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2));
  3395. a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y);
  3396. }
  3397. if (threeLine1RectangleFs.Count > 2)
  3398. {
  3399. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3400. if (this.checkBox1.Checked)
  3401. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3402. lineFont, new SolidBrush(Color.Black),
  3403. new PointF(threeLine1RectangleFs[1].X - sizeF.Width / 4, (threeLine1RectangleFs[1].Y + threeLine1RectangleFs[2].Y) / 2));
  3404. c1 = Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y);
  3405. }
  3406. if (threeLine1RectangleFs.Count > 4)
  3407. {
  3408. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3409. if (this.checkBox1.Checked)
  3410. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  3411. lineFont, new SolidBrush(Color.Black),
  3412. new PointF(threeLine1RectangleFs[3].X - sizeF.Width / 4, (threeLine1RectangleFs[3].Y + threeLine1RectangleFs[4].Y) / 2));
  3413. b1 = Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y);
  3414. }
  3415. if (threeLine2RectangleFs.Count > 1)
  3416. {
  3417. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3418. if (this.checkBox1.Checked)
  3419. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3420. lineFont, new SolidBrush(Color.Black),
  3421. new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2));
  3422. a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y);
  3423. }
  3424. if (threeLine2RectangleFs.Count > 2)
  3425. {
  3426. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3427. if (this.checkBox1.Checked)
  3428. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3429. lineFont, new SolidBrush(Color.Black),
  3430. new PointF(threeLine2RectangleFs[1].X - sizeF.Width / 4, (threeLine2RectangleFs[1].Y + threeLine2RectangleFs[2].Y) / 2));
  3431. c2 = Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y);
  3432. }
  3433. if (threeLine2RectangleFs.Count > 4)
  3434. {
  3435. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3436. if (this.checkBox1.Checked)
  3437. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  3438. lineFont, new SolidBrush(Color.Black),
  3439. new PointF(threeLine2RectangleFs[3].X - sizeF.Width / 4, (threeLine2RectangleFs[3].Y + threeLine2RectangleFs[4].Y) / 2));
  3440. b2 = Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y);
  3441. }
  3442. if (threeLine3RectangleFs.Count > 1)
  3443. {
  3444. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3445. if (this.checkBox1.Checked)
  3446. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3447. lineFont, new SolidBrush(Color.Black),
  3448. new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2));
  3449. a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y);
  3450. }
  3451. if (threeLine3RectangleFs.Count > 2)
  3452. {
  3453. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3454. if (this.checkBox1.Checked)
  3455. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3456. lineFont, new SolidBrush(Color.Black),
  3457. new PointF(threeLine3RectangleFs[1].X - sizeF.Width / 4, (threeLine3RectangleFs[1].Y + threeLine3RectangleFs[2].Y) / 2));
  3458. c3 = Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y);
  3459. }
  3460. if (threeLine3RectangleFs.Count > 4)
  3461. {
  3462. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3463. if (this.checkBox1.Checked)
  3464. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  3465. lineFont, new SolidBrush(Color.Black),
  3466. new PointF(threeLine3RectangleFs[3].X - sizeF.Width / 4, (threeLine3RectangleFs[3].Y + threeLine3RectangleFs[4].Y) / 2));
  3467. b3 = Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y);
  3468. }
  3469. }
  3470. else if (this.type.Equals(constTypeD))
  3471. {
  3472. if (threeLine1RectangleFs.Count == 2)
  3473. {
  3474. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3475. }
  3476. else if (threeLine1RectangleFs.Count == 3)
  3477. {
  3478. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3479. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3480. }
  3481. else if (threeLine1RectangleFs.Count == 4)
  3482. {
  3483. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3484. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3485. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength));
  3486. }
  3487. else if (threeLine1RectangleFs.Count == 5)
  3488. {
  3489. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3490. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3491. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength));
  3492. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength));
  3493. }
  3494. else if (threeLine1RectangleFs.Count == 5)
  3495. {
  3496. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3497. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3498. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength));
  3499. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength));
  3500. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[4].Y - threeLine1RectangleFs[5].Y) * this.unitLength));
  3501. }
  3502. if (threeLine2RectangleFs.Count == 2)
  3503. {
  3504. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3505. }
  3506. else if (threeLine2RectangleFs.Count == 3)
  3507. {
  3508. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3509. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3510. }
  3511. else if (threeLine2RectangleFs.Count == 4)
  3512. {
  3513. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3514. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3515. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength));
  3516. }
  3517. else if (threeLine2RectangleFs.Count == 5)
  3518. {
  3519. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3520. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3521. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength));
  3522. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength));
  3523. }
  3524. else if (threeLine2RectangleFs.Count == 5)
  3525. {
  3526. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3527. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3528. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength));
  3529. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength));
  3530. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[4].Y - threeLine2RectangleFs[5].Y) * this.unitLength));
  3531. }
  3532. if (threeLine3RectangleFs.Count == 2)
  3533. {
  3534. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3535. }
  3536. else if (threeLine3RectangleFs.Count == 3)
  3537. {
  3538. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3539. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3540. }
  3541. else if (threeLine3RectangleFs.Count == 4)
  3542. {
  3543. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3544. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3545. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength));
  3546. }
  3547. else if (threeLine3RectangleFs.Count == 5)
  3548. {
  3549. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3550. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3551. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength));
  3552. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength));
  3553. }
  3554. else if (threeLine3RectangleFs.Count == 5)
  3555. {
  3556. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3557. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3558. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength));
  3559. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength));
  3560. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[4].Y - threeLine3RectangleFs[5].Y) * this.unitLength));
  3561. }
  3562. if (threeLine1RectangleFs.Count > 1)
  3563. {
  3564. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3565. if (this.checkBox1.Checked)
  3566. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3567. lineFont, new SolidBrush(Color.Black),
  3568. new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2));
  3569. a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y);
  3570. }
  3571. if (threeLine1RectangleFs.Count > 2)
  3572. {
  3573. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3574. if (this.checkBox1.Checked)
  3575. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3576. lineFont, new SolidBrush(Color.Black),
  3577. new PointF(threeLine1RectangleFs[1].X - sizeF.Width / 4, (threeLine1RectangleFs[1].Y + threeLine1RectangleFs[2].Y) / 2));
  3578. c1 = Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y);
  3579. }
  3580. if (threeLine1RectangleFs.Count > 4)
  3581. {
  3582. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3583. if (this.checkBox1.Checked)
  3584. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  3585. lineFont, new SolidBrush(Color.Black),
  3586. new PointF(threeLine1RectangleFs[3].X - sizeF.Width / 4, (threeLine1RectangleFs[3].Y + threeLine1RectangleFs[4].Y) / 2));
  3587. d1 = Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y);
  3588. }
  3589. if (threeLine1RectangleFs.Count > 5)
  3590. {
  3591. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[4].Y - threeLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3592. if (this.checkBox1.Checked)
  3593. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[4].Y - threeLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  3594. lineFont, new SolidBrush(Color.Black),
  3595. new PointF(threeLine1RectangleFs[4].X - sizeF.Width / 4, (threeLine1RectangleFs[4].Y + threeLine1RectangleFs[5].Y) / 2));
  3596. b1 = Math.Abs(threeLine1RectangleFs[4].Y - threeLine1RectangleFs[5].Y);
  3597. }
  3598. if (threeLine2RectangleFs.Count > 1)
  3599. {
  3600. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3601. if (this.checkBox1.Checked)
  3602. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3603. lineFont, new SolidBrush(Color.Black),
  3604. new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2));
  3605. a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y);
  3606. }
  3607. if (threeLine2RectangleFs.Count > 2)
  3608. {
  3609. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3610. if (this.checkBox1.Checked)
  3611. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3612. lineFont, new SolidBrush(Color.Black),
  3613. new PointF(threeLine2RectangleFs[1].X - sizeF.Width / 4, (threeLine2RectangleFs[1].Y + threeLine2RectangleFs[2].Y) / 2));
  3614. c2 = Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y);
  3615. }
  3616. if (threeLine2RectangleFs.Count > 4)
  3617. {
  3618. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3619. if (this.checkBox1.Checked)
  3620. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  3621. lineFont, new SolidBrush(Color.Black),
  3622. new PointF(threeLine2RectangleFs[3].X - sizeF.Width / 4, (threeLine2RectangleFs[3].Y + threeLine2RectangleFs[4].Y) / 2));
  3623. d2 = Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y);
  3624. }
  3625. if (threeLine2RectangleFs.Count > 5)
  3626. {
  3627. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[4].Y - threeLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3628. if (this.checkBox1.Checked)
  3629. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[4].Y - threeLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  3630. lineFont, new SolidBrush(Color.Black),
  3631. new PointF(threeLine2RectangleFs[4].X - sizeF.Width / 4, (threeLine2RectangleFs[4].Y + threeLine2RectangleFs[5].Y) / 2));
  3632. b2 = Math.Abs(threeLine2RectangleFs[4].Y - threeLine2RectangleFs[5].Y);
  3633. }
  3634. if (threeLine3RectangleFs.Count > 1)
  3635. {
  3636. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3637. if (this.checkBox1.Checked)
  3638. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3639. lineFont, new SolidBrush(Color.Black),
  3640. new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2));
  3641. a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y);
  3642. }
  3643. if (threeLine3RectangleFs.Count > 2)
  3644. {
  3645. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3646. if (this.checkBox1.Checked)
  3647. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3648. lineFont, new SolidBrush(Color.Black),
  3649. new PointF(threeLine3RectangleFs[1].X - sizeF.Width / 4, (threeLine3RectangleFs[1].Y + threeLine3RectangleFs[2].Y) / 2));
  3650. c3 = Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y);
  3651. }
  3652. if (threeLine3RectangleFs.Count > 4)
  3653. {
  3654. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3655. if (this.checkBox1.Checked)
  3656. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  3657. lineFont, new SolidBrush(Color.Black),
  3658. new PointF(threeLine3RectangleFs[3].X - sizeF.Width / 4, (threeLine3RectangleFs[3].Y + threeLine3RectangleFs[4].Y) / 2));
  3659. d3 = Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y);
  3660. }
  3661. if (threeLine3RectangleFs.Count > 5)
  3662. {
  3663. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[4].Y - threeLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3664. if (this.checkBox1.Checked)
  3665. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[4].Y - threeLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  3666. lineFont, new SolidBrush(Color.Black),
  3667. new PointF(threeLine3RectangleFs[4].X - sizeF.Width / 4, (threeLine3RectangleFs[4].Y + threeLine3RectangleFs[5].Y) / 2));
  3668. b3 = Math.Abs(threeLine3RectangleFs[4].Y - threeLine3RectangleFs[5].Y);
  3669. }
  3670. }
  3671. else if (this.type.Equals(constTypeE))
  3672. {
  3673. if (threeLine1RectangleFs.Count == 2)
  3674. {
  3675. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3676. }
  3677. else if (threeLine1RectangleFs.Count == 3)
  3678. {
  3679. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3680. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3681. }
  3682. if (threeLine2RectangleFs.Count == 2)
  3683. {
  3684. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3685. }
  3686. else if (threeLine2RectangleFs.Count == 3)
  3687. {
  3688. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3689. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3690. }
  3691. if (threeLine3RectangleFs.Count == 2)
  3692. {
  3693. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3694. }
  3695. else if (threeLine3RectangleFs.Count == 3)
  3696. {
  3697. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3698. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3699. }
  3700. if (threeLine1RectangleFs.Count > 1)
  3701. {
  3702. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3703. if (this.checkBox1.Checked)
  3704. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3705. lineFont, new SolidBrush(Color.Black),
  3706. new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2));
  3707. a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y);
  3708. }
  3709. if (threeLine1RectangleFs.Count > 2)
  3710. {
  3711. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3712. if (this.checkBox1.Checked)
  3713. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3714. lineFont, new SolidBrush(Color.Black),
  3715. new PointF(threeLine1RectangleFs[1].X - sizeF.Width / 4, (threeLine1RectangleFs[1].Y + threeLine1RectangleFs[2].Y) / 2));
  3716. c1 = Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y);
  3717. }
  3718. if (threeLine2RectangleFs.Count > 1)
  3719. {
  3720. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3721. if (this.checkBox1.Checked)
  3722. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3723. lineFont, new SolidBrush(Color.Black),
  3724. new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2));
  3725. a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y);
  3726. }
  3727. if (threeLine2RectangleFs.Count > 2)
  3728. {
  3729. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3730. if (this.checkBox1.Checked)
  3731. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3732. lineFont, new SolidBrush(Color.Black),
  3733. new PointF(threeLine2RectangleFs[1].X - sizeF.Width / 4, (threeLine2RectangleFs[1].Y + threeLine2RectangleFs[2].Y) / 2));
  3734. c2 = Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y);
  3735. }
  3736. if (threeLine3RectangleFs.Count > 1)
  3737. {
  3738. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3739. if (this.checkBox1.Checked)
  3740. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3741. lineFont, new SolidBrush(Color.Black),
  3742. new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2));
  3743. a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y);
  3744. }
  3745. if (threeLine3RectangleFs.Count > 2)
  3746. {
  3747. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3748. if (this.checkBox1.Checked)
  3749. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3750. lineFont, new SolidBrush(Color.Black),
  3751. new PointF(threeLine3RectangleFs[1].X - sizeF.Width / 4, (threeLine3RectangleFs[1].Y + threeLine3RectangleFs[2].Y) / 2));
  3752. c3 = Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y);
  3753. }
  3754. }
  3755. }
  3756. #endregion
  3757. #region 线条数为四时的辅助线文本绘制
  3758. if (this.linesNumber == 4)
  3759. {
  3760. if (this.type.Equals(constTypeA))
  3761. {
  3762. if (fourLine1RectangleFs.Count == 2)
  3763. {
  3764. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3765. }
  3766. else if (fourLine1RectangleFs.Count == 3)
  3767. {
  3768. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3769. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  3770. }
  3771. if (fourLine2RectangleFs.Count == 2)
  3772. {
  3773. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3774. }
  3775. else if (fourLine2RectangleFs.Count == 3)
  3776. {
  3777. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3778. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  3779. }
  3780. if (fourLine3RectangleFs.Count == 2)
  3781. {
  3782. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  3783. }
  3784. else if (fourLine3RectangleFs.Count == 3)
  3785. {
  3786. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  3787. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  3788. }
  3789. if (fourLine4RectangleFs.Count == 2)
  3790. {
  3791. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  3792. }
  3793. else if (fourLine4RectangleFs.Count == 3)
  3794. {
  3795. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  3796. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  3797. }
  3798. if (fourLine1RectangleFs.Count > 1)
  3799. {
  3800. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3801. if (this.checkBox1.Checked)
  3802. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3803. lineFont, new SolidBrush(Color.Black),
  3804. new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2));
  3805. a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y);
  3806. }
  3807. if (fourLine2RectangleFs.Count > 1)
  3808. {
  3809. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3810. if (this.checkBox1.Checked)
  3811. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3812. lineFont, new SolidBrush(Color.Black),
  3813. new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2));
  3814. a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y);
  3815. }
  3816. if (fourLine3RectangleFs.Count > 1)
  3817. {
  3818. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3819. if (this.checkBox1.Checked)
  3820. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3821. lineFont, new SolidBrush(Color.Black),
  3822. new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2));
  3823. a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y);
  3824. }
  3825. if (fourLine4RectangleFs.Count > 1)
  3826. {
  3827. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3828. if (this.checkBox1.Checked)
  3829. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3830. lineFont, new SolidBrush(Color.Black),
  3831. new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2));
  3832. a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y);
  3833. }
  3834. }
  3835. else if (this.type.Equals(constTypeB))
  3836. {
  3837. if (fourLine1RectangleFs.Count == 2)
  3838. {
  3839. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3840. }
  3841. else if (fourLine1RectangleFs.Count == 3)
  3842. {
  3843. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3844. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  3845. }
  3846. else if (fourLine1RectangleFs.Count == 4)
  3847. {
  3848. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3849. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  3850. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength));
  3851. }
  3852. if (fourLine2RectangleFs.Count == 2)
  3853. {
  3854. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3855. }
  3856. else if (fourLine2RectangleFs.Count == 3)
  3857. {
  3858. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3859. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  3860. }
  3861. else if (fourLine2RectangleFs.Count == 4)
  3862. {
  3863. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3864. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  3865. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength));
  3866. }
  3867. if (fourLine3RectangleFs.Count == 2)
  3868. {
  3869. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  3870. }
  3871. else if (fourLine3RectangleFs.Count == 3)
  3872. {
  3873. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  3874. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  3875. }
  3876. else if (fourLine3RectangleFs.Count == 4)
  3877. {
  3878. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  3879. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  3880. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength));
  3881. }
  3882. if (fourLine4RectangleFs.Count == 2)
  3883. {
  3884. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  3885. }
  3886. else if (fourLine4RectangleFs.Count == 3)
  3887. {
  3888. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  3889. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  3890. }
  3891. else if (fourLine4RectangleFs.Count == 4)
  3892. {
  3893. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  3894. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  3895. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength));
  3896. }
  3897. if (fourLine1RectangleFs.Count > 1)
  3898. {
  3899. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3900. if (this.checkBox1.Checked)
  3901. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3902. lineFont, new SolidBrush(Color.Black),
  3903. new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2));
  3904. a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y);
  3905. }
  3906. if (fourLine1RectangleFs.Count > 3)
  3907. {
  3908. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3909. if (this.checkBox1.Checked)
  3910. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3911. lineFont, new SolidBrush(Color.Black),
  3912. new PointF(fourLine1RectangleFs[2].X - sizeF.Width / 4, (fourLine1RectangleFs[2].Y + fourLine1RectangleFs[3].Y) / 2));
  3913. b1 = Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y);
  3914. }
  3915. if (fourLine2RectangleFs.Count > 1)
  3916. {
  3917. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3918. if (this.checkBox1.Checked)
  3919. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3920. lineFont, new SolidBrush(Color.Black),
  3921. new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2));
  3922. a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y);
  3923. }
  3924. if (fourLine2RectangleFs.Count > 3)
  3925. {
  3926. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3927. if (this.checkBox1.Checked)
  3928. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3929. lineFont, new SolidBrush(Color.Black),
  3930. new PointF(fourLine2RectangleFs[2].X - sizeF.Width / 4, (fourLine2RectangleFs[2].Y + fourLine2RectangleFs[3].Y) / 2));
  3931. b2 = Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y);
  3932. }
  3933. if (fourLine3RectangleFs.Count > 1)
  3934. {
  3935. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3936. if (this.checkBox1.Checked)
  3937. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3938. lineFont, new SolidBrush(Color.Black),
  3939. new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2));
  3940. a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y);
  3941. }
  3942. if (fourLine3RectangleFs.Count > 3)
  3943. {
  3944. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3945. if (this.checkBox1.Checked)
  3946. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3947. lineFont, new SolidBrush(Color.Black),
  3948. new PointF(fourLine3RectangleFs[2].X - sizeF.Width / 4, (fourLine3RectangleFs[2].Y + fourLine3RectangleFs[3].Y) / 2));
  3949. b3 = Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y);
  3950. }
  3951. if (fourLine4RectangleFs.Count > 1)
  3952. {
  3953. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3954. if (this.checkBox1.Checked)
  3955. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3956. lineFont, new SolidBrush(Color.Black),
  3957. new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2));
  3958. a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y);
  3959. }
  3960. if (fourLine4RectangleFs.Count > 3)
  3961. {
  3962. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3963. if (this.checkBox1.Checked)
  3964. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3965. lineFont, new SolidBrush(Color.Black),
  3966. new PointF(fourLine4RectangleFs[2].X - sizeF.Width / 4, (fourLine4RectangleFs[2].Y + fourLine4RectangleFs[3].Y) / 2));
  3967. b4 = Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y);
  3968. }
  3969. }
  3970. else if (this.type.Equals(constTypeC))
  3971. {
  3972. if (fourLine1RectangleFs.Count == 2)
  3973. {
  3974. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3975. }
  3976. else if (fourLine1RectangleFs.Count == 3)
  3977. {
  3978. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3979. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  3980. }
  3981. else if (fourLine1RectangleFs.Count == 4)
  3982. {
  3983. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3984. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  3985. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength));
  3986. }
  3987. else if (fourLine1RectangleFs.Count == 5)
  3988. {
  3989. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3990. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  3991. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength));
  3992. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength));
  3993. }
  3994. if (fourLine2RectangleFs.Count == 2)
  3995. {
  3996. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3997. }
  3998. else if (fourLine1RectangleFs.Count == 3)
  3999. {
  4000. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4001. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4002. }
  4003. else if (fourLine1RectangleFs.Count == 4)
  4004. {
  4005. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4006. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4007. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength));
  4008. }
  4009. else if (fourLine1RectangleFs.Count == 5)
  4010. {
  4011. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4012. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4013. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength));
  4014. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength));
  4015. }
  4016. if (fourLine3RectangleFs.Count == 2)
  4017. {
  4018. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4019. }
  4020. else if (fourLine3RectangleFs.Count == 3)
  4021. {
  4022. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4023. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4024. }
  4025. else if (fourLine3RectangleFs.Count == 4)
  4026. {
  4027. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4028. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4029. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength));
  4030. }
  4031. else if (fourLine3RectangleFs.Count == 5)
  4032. {
  4033. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4034. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4035. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength));
  4036. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength));
  4037. }
  4038. if (fourLine4RectangleFs.Count == 2)
  4039. {
  4040. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4041. }
  4042. else if (fourLine4RectangleFs.Count == 3)
  4043. {
  4044. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4045. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4046. }
  4047. else if (fourLine4RectangleFs.Count == 4)
  4048. {
  4049. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4050. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4051. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength));
  4052. }
  4053. else if (fourLine4RectangleFs.Count == 5)
  4054. {
  4055. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4056. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4057. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength));
  4058. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength));
  4059. }
  4060. if (fourLine1RectangleFs.Count > 1)
  4061. {
  4062. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4063. if (this.checkBox1.Checked)
  4064. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4065. lineFont, new SolidBrush(Color.Black),
  4066. new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2));
  4067. a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y);
  4068. }
  4069. if (fourLine1RectangleFs.Count > 2)
  4070. {
  4071. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4072. if (this.checkBox1.Checked)
  4073. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4074. lineFont, new SolidBrush(Color.Black),
  4075. new PointF(fourLine1RectangleFs[1].X - sizeF.Width / 4, (fourLine1RectangleFs[1].Y + fourLine1RectangleFs[2].Y) / 2));
  4076. c1 = Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y);
  4077. }
  4078. if (fourLine1RectangleFs.Count > 4)
  4079. {
  4080. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4081. if (this.checkBox1.Checked)
  4082. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4083. lineFont, new SolidBrush(Color.Black),
  4084. new PointF(fourLine1RectangleFs[3].X - sizeF.Width / 4, (fourLine1RectangleFs[3].Y + fourLine1RectangleFs[4].Y) / 2));
  4085. b1 = Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y);
  4086. }
  4087. if (fourLine2RectangleFs.Count > 1)
  4088. {
  4089. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4090. if (this.checkBox1.Checked)
  4091. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4092. lineFont, new SolidBrush(Color.Black),
  4093. new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2));
  4094. a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y);
  4095. }
  4096. if (fourLine2RectangleFs.Count > 2)
  4097. {
  4098. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4099. if (this.checkBox1.Checked)
  4100. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4101. lineFont, new SolidBrush(Color.Black),
  4102. new PointF(fourLine2RectangleFs[1].X - sizeF.Width / 4, (fourLine2RectangleFs[1].Y + fourLine2RectangleFs[2].Y) / 2));
  4103. c2 = Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y);
  4104. }
  4105. if (fourLine2RectangleFs.Count > 4)
  4106. {
  4107. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4108. if (this.checkBox1.Checked)
  4109. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4110. lineFont, new SolidBrush(Color.Black),
  4111. new PointF(fourLine2RectangleFs[3].X - sizeF.Width / 4, (fourLine2RectangleFs[3].Y + fourLine2RectangleFs[4].Y) / 2));
  4112. b2 = Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y);
  4113. }
  4114. if (fourLine3RectangleFs.Count > 1)
  4115. {
  4116. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4117. if (this.checkBox1.Checked)
  4118. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4119. lineFont, new SolidBrush(Color.Black),
  4120. new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2));
  4121. a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y);
  4122. }
  4123. if (fourLine3RectangleFs.Count > 2)
  4124. {
  4125. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4126. if (this.checkBox1.Checked)
  4127. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4128. lineFont, new SolidBrush(Color.Black),
  4129. new PointF(fourLine3RectangleFs[1].X - sizeF.Width / 4, (fourLine3RectangleFs[1].Y + fourLine3RectangleFs[2].Y) / 2));
  4130. c3 = Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y);
  4131. }
  4132. if (fourLine3RectangleFs.Count > 4)
  4133. {
  4134. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4135. if (this.checkBox1.Checked)
  4136. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4137. lineFont, new SolidBrush(Color.Black),
  4138. new PointF(fourLine3RectangleFs[3].X - sizeF.Width / 4, (fourLine3RectangleFs[3].Y + fourLine3RectangleFs[4].Y) / 2));
  4139. b3 = Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y);
  4140. }
  4141. if (fourLine4RectangleFs.Count > 1)
  4142. {
  4143. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4144. if (this.checkBox1.Checked)
  4145. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4146. lineFont, new SolidBrush(Color.Black),
  4147. new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2));
  4148. a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y);
  4149. }
  4150. if (fourLine4RectangleFs.Count > 2)
  4151. {
  4152. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4153. if (this.checkBox1.Checked)
  4154. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4155. lineFont, new SolidBrush(Color.Black),
  4156. new PointF(fourLine4RectangleFs[1].X - sizeF.Width / 4, (fourLine4RectangleFs[1].Y + fourLine4RectangleFs[2].Y) / 2));
  4157. c4 = Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y);
  4158. }
  4159. if (fourLine4RectangleFs.Count > 4)
  4160. {
  4161. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4162. if (this.checkBox1.Checked)
  4163. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4164. lineFont, new SolidBrush(Color.Black),
  4165. new PointF(fourLine4RectangleFs[3].X - sizeF.Width / 4, (fourLine4RectangleFs[3].Y + fourLine4RectangleFs[4].Y) / 2));
  4166. b4 = Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y);
  4167. }
  4168. }
  4169. else if (this.type.Equals(constTypeD))
  4170. {
  4171. if (fourLine1RectangleFs.Count == 2)
  4172. {
  4173. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4174. }
  4175. else if (fourLine1RectangleFs.Count == 3)
  4176. {
  4177. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4178. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  4179. }
  4180. else if (fourLine1RectangleFs.Count == 4)
  4181. {
  4182. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4183. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  4184. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength));
  4185. }
  4186. else if (fourLine1RectangleFs.Count == 5)
  4187. {
  4188. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4189. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  4190. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength));
  4191. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength));
  4192. }
  4193. else if (fourLine1RectangleFs.Count == 6)
  4194. {
  4195. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4196. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  4197. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength));
  4198. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength));
  4199. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[4].Y - fourLine1RectangleFs[5].Y) * this.unitLength));
  4200. }
  4201. if (fourLine2RectangleFs.Count == 2)
  4202. {
  4203. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4204. }
  4205. else if (fourLine2RectangleFs.Count == 3)
  4206. {
  4207. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4208. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4209. }
  4210. else if (fourLine2RectangleFs.Count == 4)
  4211. {
  4212. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4213. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4214. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength));
  4215. }
  4216. else if (fourLine2RectangleFs.Count == 5)
  4217. {
  4218. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4219. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4220. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength));
  4221. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength));
  4222. }
  4223. else if (fourLine2RectangleFs.Count == 6)
  4224. {
  4225. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4226. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4227. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength));
  4228. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength));
  4229. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[4].Y - fourLine2RectangleFs[5].Y) * this.unitLength));
  4230. }
  4231. if (fourLine3RectangleFs.Count == 2)
  4232. {
  4233. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4234. }
  4235. else if (fourLine3RectangleFs.Count == 3)
  4236. {
  4237. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4238. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4239. }
  4240. else if (fourLine3RectangleFs.Count == 4)
  4241. {
  4242. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4243. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4244. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength));
  4245. }
  4246. else if (fourLine3RectangleFs.Count == 5)
  4247. {
  4248. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4249. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4250. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength));
  4251. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength));
  4252. }
  4253. else if (fourLine3RectangleFs.Count == 6)
  4254. {
  4255. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4256. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4257. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength));
  4258. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength));
  4259. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[4].Y - fourLine3RectangleFs[5].Y) * this.unitLength));
  4260. }
  4261. if (fourLine4RectangleFs.Count == 2)
  4262. {
  4263. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4264. }
  4265. else if (fourLine4RectangleFs.Count == 3)
  4266. {
  4267. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4268. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4269. }
  4270. else if (fourLine4RectangleFs.Count == 4)
  4271. {
  4272. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4273. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4274. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength));
  4275. }
  4276. else if (fourLine4RectangleFs.Count == 5)
  4277. {
  4278. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4279. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4280. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength));
  4281. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength));
  4282. }
  4283. else if (fourLine4RectangleFs.Count == 6)
  4284. {
  4285. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4286. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4287. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength));
  4288. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength));
  4289. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[4].Y - fourLine4RectangleFs[5].Y) * this.unitLength));
  4290. }
  4291. if (fourLine1RectangleFs.Count > 1)
  4292. {
  4293. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4294. if (this.checkBox1.Checked)
  4295. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4296. lineFont, new SolidBrush(Color.Black),
  4297. new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2));
  4298. a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y);
  4299. }
  4300. if (fourLine1RectangleFs.Count > 2)
  4301. {
  4302. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4303. if (this.checkBox1.Checked)
  4304. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4305. lineFont, new SolidBrush(Color.Black),
  4306. new PointF(fourLine1RectangleFs[1].X - sizeF.Width / 4, (fourLine1RectangleFs[1].Y + fourLine1RectangleFs[2].Y) / 2));
  4307. c1 = Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y);
  4308. }
  4309. if (fourLine1RectangleFs.Count > 4)
  4310. {
  4311. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4312. if (this.checkBox1.Checked)
  4313. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4314. lineFont, new SolidBrush(Color.Black),
  4315. new PointF(fourLine1RectangleFs[3].X - sizeF.Width / 4, (fourLine1RectangleFs[3].Y + fourLine1RectangleFs[4].Y) / 2));
  4316. d1 = Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y);
  4317. }
  4318. if (fourLine1RectangleFs.Count > 5)
  4319. {
  4320. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[4].Y - fourLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4321. if (this.checkBox1.Checked)
  4322. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[4].Y - fourLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  4323. lineFont, new SolidBrush(Color.Black),
  4324. new PointF(fourLine1RectangleFs[4].X - sizeF.Width / 4, (fourLine1RectangleFs[4].Y + fourLine1RectangleFs[5].Y) / 2));
  4325. b1 = Math.Abs(fourLine1RectangleFs[4].Y - fourLine1RectangleFs[5].Y);
  4326. }
  4327. if (fourLine2RectangleFs.Count > 1)
  4328. {
  4329. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4330. if (this.checkBox1.Checked)
  4331. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4332. lineFont, new SolidBrush(Color.Black),
  4333. new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2));
  4334. a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y);
  4335. }
  4336. if (fourLine2RectangleFs.Count > 2)
  4337. {
  4338. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4339. if (this.checkBox1.Checked)
  4340. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4341. lineFont, new SolidBrush(Color.Black),
  4342. new PointF(fourLine2RectangleFs[1].X - sizeF.Width / 4, (fourLine2RectangleFs[1].Y + fourLine2RectangleFs[2].Y) / 2));
  4343. c2 = Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y);
  4344. }
  4345. if (fourLine2RectangleFs.Count > 4)
  4346. {
  4347. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4348. if (this.checkBox1.Checked)
  4349. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4350. lineFont, new SolidBrush(Color.Black),
  4351. new PointF(fourLine2RectangleFs[3].X - sizeF.Width / 4, (fourLine2RectangleFs[3].Y + fourLine2RectangleFs[4].Y) / 2));
  4352. d2 = Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y);
  4353. }
  4354. if (fourLine2RectangleFs.Count > 5)
  4355. {
  4356. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[4].Y - fourLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4357. if (this.checkBox1.Checked)
  4358. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[4].Y - fourLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  4359. lineFont, new SolidBrush(Color.Black),
  4360. new PointF(fourLine2RectangleFs[4].X - sizeF.Width / 4, (fourLine2RectangleFs[4].Y + fourLine2RectangleFs[5].Y) / 2));
  4361. b2 = Math.Abs(fourLine2RectangleFs[4].Y - fourLine2RectangleFs[5].Y);
  4362. }
  4363. if (fourLine3RectangleFs.Count > 1)
  4364. {
  4365. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4366. if (this.checkBox1.Checked)
  4367. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4368. lineFont, new SolidBrush(Color.Black),
  4369. new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2));
  4370. a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y);
  4371. }
  4372. if (fourLine3RectangleFs.Count > 2)
  4373. {
  4374. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4375. if (this.checkBox1.Checked)
  4376. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4377. lineFont, new SolidBrush(Color.Black),
  4378. new PointF(fourLine3RectangleFs[1].X - sizeF.Width / 4, (fourLine3RectangleFs[1].Y + fourLine3RectangleFs[2].Y) / 2));
  4379. c3 = Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y);
  4380. }
  4381. if (fourLine3RectangleFs.Count > 4)
  4382. {
  4383. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4384. if (this.checkBox1.Checked)
  4385. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4386. lineFont, new SolidBrush(Color.Black),
  4387. new PointF(fourLine3RectangleFs[3].X - sizeF.Width / 4, (fourLine3RectangleFs[3].Y + fourLine3RectangleFs[4].Y) / 2));
  4388. d3 = Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y);
  4389. }
  4390. if (fourLine3RectangleFs.Count > 5)
  4391. {
  4392. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[4].Y - fourLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4393. if (this.checkBox1.Checked)
  4394. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[4].Y - fourLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  4395. lineFont, new SolidBrush(Color.Black),
  4396. new PointF(fourLine3RectangleFs[4].X - sizeF.Width / 4, (fourLine3RectangleFs[4].Y + fourLine3RectangleFs[5].Y) / 2));
  4397. b3 = Math.Abs(fourLine3RectangleFs[4].Y - fourLine3RectangleFs[5].Y);
  4398. }
  4399. if (fourLine4RectangleFs.Count > 1)
  4400. {
  4401. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4402. if (this.checkBox1.Checked)
  4403. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4404. lineFont, new SolidBrush(Color.Black),
  4405. new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2));
  4406. a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y);
  4407. }
  4408. if (fourLine4RectangleFs.Count > 2)
  4409. {
  4410. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4411. if (this.checkBox1.Checked)
  4412. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4413. lineFont, new SolidBrush(Color.Black),
  4414. new PointF(fourLine4RectangleFs[1].X - sizeF.Width / 4, (fourLine4RectangleFs[1].Y + fourLine4RectangleFs[2].Y) / 2));
  4415. c4 = Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y);
  4416. }
  4417. if (fourLine4RectangleFs.Count > 4)
  4418. {
  4419. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4420. if (this.checkBox1.Checked)
  4421. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4422. lineFont, new SolidBrush(Color.Black),
  4423. new PointF(fourLine4RectangleFs[3].X - sizeF.Width / 4, (fourLine4RectangleFs[3].Y + fourLine4RectangleFs[4].Y) / 2));
  4424. d4 = Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y);
  4425. }
  4426. if (fourLine4RectangleFs.Count > 5)
  4427. {
  4428. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[4].Y - fourLine4RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4429. if (this.checkBox1.Checked)
  4430. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[4].Y - fourLine4RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  4431. lineFont, new SolidBrush(Color.Black),
  4432. new PointF(fourLine4RectangleFs[4].X - sizeF.Width / 4, (fourLine4RectangleFs[4].Y + fourLine4RectangleFs[5].Y) / 2));
  4433. b4 = Math.Abs(fourLine4RectangleFs[4].Y - fourLine4RectangleFs[5].Y);
  4434. }
  4435. }
  4436. else if (this.type.Equals(constTypeE))
  4437. {
  4438. if (fourLine1RectangleFs.Count == 2)
  4439. {
  4440. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4441. }
  4442. else if (fourLine1RectangleFs.Count == 3)
  4443. {
  4444. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4445. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  4446. }
  4447. if (fourLine2RectangleFs.Count == 2)
  4448. {
  4449. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4450. }
  4451. else if (fourLine2RectangleFs.Count == 3)
  4452. {
  4453. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4454. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4455. }
  4456. if (fourLine3RectangleFs.Count == 2)
  4457. {
  4458. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4459. }
  4460. else if (fourLine3RectangleFs.Count == 3)
  4461. {
  4462. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4463. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4464. }
  4465. if (fourLine4RectangleFs.Count == 2)
  4466. {
  4467. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4468. }
  4469. else if (fourLine3RectangleFs.Count == 3)
  4470. {
  4471. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4472. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4473. }
  4474. if (fourLine1RectangleFs.Count > 1)
  4475. {
  4476. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4477. if (this.checkBox1.Checked)
  4478. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4479. lineFont, new SolidBrush(Color.Black),
  4480. new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2));
  4481. a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y);
  4482. }
  4483. if (fourLine1RectangleFs.Count > 2)
  4484. {
  4485. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4486. if (this.checkBox1.Checked)
  4487. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4488. lineFont, new SolidBrush(Color.Black),
  4489. new PointF(fourLine1RectangleFs[1].X - sizeF.Width / 4, (fourLine1RectangleFs[1].Y + fourLine1RectangleFs[2].Y) / 2));
  4490. c1 = Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y);
  4491. }
  4492. if (fourLine2RectangleFs.Count > 1)
  4493. {
  4494. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4495. if (this.checkBox1.Checked)
  4496. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4497. lineFont, new SolidBrush(Color.Black),
  4498. new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2));
  4499. a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y);
  4500. }
  4501. if (fourLine2RectangleFs.Count > 2)
  4502. {
  4503. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4504. if (this.checkBox1.Checked)
  4505. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4506. lineFont, new SolidBrush(Color.Black),
  4507. new PointF(fourLine2RectangleFs[1].X - sizeF.Width / 4, (fourLine2RectangleFs[1].Y + fourLine2RectangleFs[2].Y) / 2));
  4508. c2 = Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y);
  4509. }
  4510. if (fourLine3RectangleFs.Count > 1)
  4511. {
  4512. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4513. if (this.checkBox1.Checked)
  4514. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4515. lineFont, new SolidBrush(Color.Black),
  4516. new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2));
  4517. a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y);
  4518. }
  4519. if (fourLine3RectangleFs.Count > 2)
  4520. {
  4521. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4522. if (this.checkBox1.Checked)
  4523. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4524. lineFont, new SolidBrush(Color.Black),
  4525. new PointF(fourLine3RectangleFs[1].X - sizeF.Width / 4, (fourLine3RectangleFs[1].Y + fourLine3RectangleFs[2].Y) / 2));
  4526. c3 = Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y);
  4527. }
  4528. if (fourLine4RectangleFs.Count > 1)
  4529. {
  4530. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4531. if (this.checkBox1.Checked)
  4532. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4533. lineFont, new SolidBrush(Color.Black),
  4534. new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2));
  4535. a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y);
  4536. }
  4537. if (fourLine4RectangleFs.Count > 2)
  4538. {
  4539. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4540. if (this.checkBox1.Checked)
  4541. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4542. lineFont, new SolidBrush(Color.Black),
  4543. new PointF(fourLine4RectangleFs[1].X - sizeF.Width / 4, (fourLine4RectangleFs[1].Y + fourLine4RectangleFs[2].Y) / 2));
  4544. c4 = Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y);
  4545. }
  4546. }
  4547. }
  4548. #endregion
  4549. #region 线条数为五时的辅助线文本绘制
  4550. if (this.linesNumber == 5)
  4551. {
  4552. if (this.type.Equals(constTypeA))
  4553. {
  4554. if (fiveLine1RectangleFs.Count == 2)
  4555. {
  4556. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4557. }
  4558. else if (fiveLine1RectangleFs.Count == 3)
  4559. {
  4560. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4561. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  4562. }
  4563. if (fiveLine2RectangleFs.Count == 2)
  4564. {
  4565. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4566. }
  4567. else if (fiveLine2RectangleFs.Count == 3)
  4568. {
  4569. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4570. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  4571. }
  4572. if (fiveLine3RectangleFs.Count == 2)
  4573. {
  4574. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4575. }
  4576. else if (fiveLine3RectangleFs.Count == 3)
  4577. {
  4578. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4579. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  4580. }
  4581. if (fiveLine4RectangleFs.Count == 2)
  4582. {
  4583. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4584. }
  4585. else if (fiveLine4RectangleFs.Count == 3)
  4586. {
  4587. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4588. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  4589. }
  4590. if (fiveLine5RectangleFs.Count == 2)
  4591. {
  4592. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4593. }
  4594. else if (fiveLine5RectangleFs.Count == 3)
  4595. {
  4596. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4597. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  4598. }
  4599. if (fiveLine1RectangleFs.Count > 1)
  4600. {
  4601. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4602. if (this.checkBox1.Checked)
  4603. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4604. lineFont, new SolidBrush(Color.Black),
  4605. new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2));
  4606. a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y);
  4607. }
  4608. if (fiveLine2RectangleFs.Count > 1)
  4609. {
  4610. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4611. if (this.checkBox1.Checked)
  4612. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4613. lineFont, new SolidBrush(Color.Black),
  4614. new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2));
  4615. a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y);
  4616. }
  4617. if (fiveLine3RectangleFs.Count > 1)
  4618. {
  4619. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4620. if (this.checkBox1.Checked)
  4621. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4622. lineFont, new SolidBrush(Color.Black),
  4623. new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2));
  4624. a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y);
  4625. }
  4626. if (fiveLine4RectangleFs.Count > 1)
  4627. {
  4628. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4629. if (this.checkBox1.Checked)
  4630. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4631. lineFont, new SolidBrush(Color.Black),
  4632. new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2));
  4633. a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y);
  4634. }
  4635. if (fiveLine5RectangleFs.Count > 1)
  4636. {
  4637. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4638. if (this.checkBox1.Checked)
  4639. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4640. lineFont, new SolidBrush(Color.Black),
  4641. new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2));
  4642. a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y);
  4643. }
  4644. }
  4645. else if (this.type.Equals(constTypeB))
  4646. {
  4647. if (fiveLine1RectangleFs.Count == 2)
  4648. {
  4649. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4650. }
  4651. else if (fiveLine1RectangleFs.Count == 3)
  4652. {
  4653. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4654. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  4655. }
  4656. else if (fiveLine1RectangleFs.Count == 4)
  4657. {
  4658. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4659. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  4660. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength));
  4661. }
  4662. if (fiveLine2RectangleFs.Count == 2)
  4663. {
  4664. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4665. }
  4666. else if (fiveLine2RectangleFs.Count == 3)
  4667. {
  4668. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4669. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  4670. }
  4671. else if (fiveLine2RectangleFs.Count == 4)
  4672. {
  4673. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4674. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  4675. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength));
  4676. }
  4677. if (fiveLine3RectangleFs.Count == 2)
  4678. {
  4679. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4680. }
  4681. else if (fiveLine3RectangleFs.Count == 3)
  4682. {
  4683. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4684. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  4685. }
  4686. else if (fiveLine3RectangleFs.Count == 4)
  4687. {
  4688. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4689. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  4690. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength));
  4691. }
  4692. if (fiveLine4RectangleFs.Count == 2)
  4693. {
  4694. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4695. }
  4696. else if (fiveLine4RectangleFs.Count == 3)
  4697. {
  4698. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4699. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  4700. }
  4701. else if (fiveLine4RectangleFs.Count == 4)
  4702. {
  4703. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4704. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  4705. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength));
  4706. }
  4707. if (fiveLine5RectangleFs.Count == 2)
  4708. {
  4709. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4710. }
  4711. else if (fiveLine5RectangleFs.Count == 3)
  4712. {
  4713. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4714. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  4715. }
  4716. else if (fiveLine5RectangleFs.Count == 4)
  4717. {
  4718. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4719. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  4720. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength));
  4721. }
  4722. if (fiveLine1RectangleFs.Count > 1)
  4723. {
  4724. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4725. if (this.checkBox1.Checked)
  4726. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4727. lineFont, new SolidBrush(Color.Black),
  4728. new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2));
  4729. a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y);
  4730. }
  4731. if (fiveLine1RectangleFs.Count > 3)
  4732. {
  4733. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4734. if (this.checkBox1.Checked)
  4735. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  4736. lineFont, new SolidBrush(Color.Black),
  4737. new PointF(fiveLine1RectangleFs[2].X - sizeF.Width / 4, (fiveLine1RectangleFs[2].Y + fiveLine1RectangleFs[3].Y) / 2));
  4738. b1 = Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y);
  4739. }
  4740. if (fiveLine2RectangleFs.Count > 1)
  4741. {
  4742. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4743. if (this.checkBox1.Checked)
  4744. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4745. lineFont, new SolidBrush(Color.Black),
  4746. new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2));
  4747. a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y);
  4748. }
  4749. if (fiveLine2RectangleFs.Count > 3)
  4750. {
  4751. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4752. if (this.checkBox1.Checked)
  4753. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  4754. lineFont, new SolidBrush(Color.Black),
  4755. new PointF(fiveLine2RectangleFs[2].X - sizeF.Width / 4, (fiveLine2RectangleFs[2].Y + fiveLine2RectangleFs[3].Y) / 2));
  4756. b2 = Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y);
  4757. }
  4758. if (fiveLine3RectangleFs.Count > 1)
  4759. {
  4760. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4761. if (this.checkBox1.Checked)
  4762. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4763. lineFont, new SolidBrush(Color.Black),
  4764. new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2));
  4765. a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y);
  4766. }
  4767. if (fiveLine3RectangleFs.Count > 3)
  4768. {
  4769. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4770. if (this.checkBox1.Checked)
  4771. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  4772. lineFont, new SolidBrush(Color.Black),
  4773. new PointF(fiveLine3RectangleFs[2].X - sizeF.Width / 4, (fiveLine3RectangleFs[2].Y + fiveLine3RectangleFs[3].Y) / 2));
  4774. b3 = Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y);
  4775. }
  4776. if (fiveLine4RectangleFs.Count > 1)
  4777. {
  4778. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4779. if (this.checkBox1.Checked)
  4780. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4781. lineFont, new SolidBrush(Color.Black),
  4782. new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2));
  4783. a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y);
  4784. }
  4785. if (fiveLine4RectangleFs.Count > 3)
  4786. {
  4787. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4788. if (this.checkBox1.Checked)
  4789. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  4790. lineFont, new SolidBrush(Color.Black),
  4791. new PointF(fiveLine4RectangleFs[2].X - sizeF.Width / 4, (fiveLine4RectangleFs[2].Y + fiveLine4RectangleFs[3].Y) / 2));
  4792. b4 = Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y);
  4793. }
  4794. if (fiveLine5RectangleFs.Count > 1)
  4795. {
  4796. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4797. if (this.checkBox1.Checked)
  4798. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4799. lineFont, new SolidBrush(Color.Black),
  4800. new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2));
  4801. a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y);
  4802. }
  4803. if (fiveLine5RectangleFs.Count > 3)
  4804. {
  4805. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4806. if (this.checkBox1.Checked)
  4807. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  4808. lineFont, new SolidBrush(Color.Black),
  4809. new PointF(fiveLine5RectangleFs[2].X - sizeF.Width / 4, (fiveLine5RectangleFs[2].Y + fiveLine5RectangleFs[3].Y) / 2));
  4810. b5 = Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y);
  4811. }
  4812. }
  4813. else if (this.type.Equals(constTypeC))
  4814. {
  4815. if (fiveLine1RectangleFs.Count == 2)
  4816. {
  4817. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4818. }
  4819. else if (fiveLine1RectangleFs.Count == 3)
  4820. {
  4821. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4822. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  4823. }
  4824. else if (fiveLine1RectangleFs.Count == 4)
  4825. {
  4826. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4827. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  4828. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength));
  4829. }
  4830. else if (fiveLine1RectangleFs.Count == 5)
  4831. {
  4832. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4833. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  4834. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength));
  4835. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength));
  4836. }
  4837. if (fiveLine2RectangleFs.Count == 2)
  4838. {
  4839. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4840. }
  4841. else if (fiveLine2RectangleFs.Count == 3)
  4842. {
  4843. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4844. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  4845. }
  4846. else if (fiveLine2RectangleFs.Count == 4)
  4847. {
  4848. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4849. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  4850. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength));
  4851. }
  4852. else if (fiveLine2RectangleFs.Count == 5)
  4853. {
  4854. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4855. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  4856. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength));
  4857. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength));
  4858. }
  4859. if (fiveLine3RectangleFs.Count == 2)
  4860. {
  4861. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4862. }
  4863. else if (fiveLine3RectangleFs.Count == 3)
  4864. {
  4865. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4866. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  4867. }
  4868. else if (fiveLine3RectangleFs.Count == 4)
  4869. {
  4870. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4871. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  4872. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength));
  4873. }
  4874. else if (fiveLine3RectangleFs.Count == 5)
  4875. {
  4876. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4877. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  4878. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength));
  4879. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength));
  4880. }
  4881. if (fiveLine4RectangleFs.Count == 2)
  4882. {
  4883. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4884. }
  4885. else if (fiveLine4RectangleFs.Count == 3)
  4886. {
  4887. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4888. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  4889. }
  4890. else if (fiveLine4RectangleFs.Count == 4)
  4891. {
  4892. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4893. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  4894. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength));
  4895. }
  4896. else if (fiveLine4RectangleFs.Count == 5)
  4897. {
  4898. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4899. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  4900. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength));
  4901. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength));
  4902. }
  4903. if (fiveLine5RectangleFs.Count == 2)
  4904. {
  4905. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4906. }
  4907. else if (fiveLine5RectangleFs.Count == 3)
  4908. {
  4909. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4910. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  4911. }
  4912. else if (fiveLine5RectangleFs.Count == 4)
  4913. {
  4914. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4915. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  4916. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength));
  4917. }
  4918. else if (fiveLine5RectangleFs.Count == 5)
  4919. {
  4920. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4921. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  4922. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength));
  4923. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength));
  4924. }
  4925. if (fiveLine1RectangleFs.Count > 1)
  4926. {
  4927. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4928. if (this.checkBox1.Checked)
  4929. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4930. lineFont, new SolidBrush(Color.Black),
  4931. new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2));
  4932. a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y);
  4933. }
  4934. if (fiveLine1RectangleFs.Count > 2)
  4935. {
  4936. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4937. if (this.checkBox1.Checked)
  4938. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4939. lineFont, new SolidBrush(Color.Black),
  4940. new PointF(fiveLine1RectangleFs[1].X - sizeF.Width / 4, (fiveLine1RectangleFs[1].Y + fiveLine1RectangleFs[2].Y) / 2));
  4941. c1 = Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y);
  4942. }
  4943. if (fiveLine1RectangleFs.Count > 4)
  4944. {
  4945. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4946. if (this.checkBox1.Checked)
  4947. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4948. lineFont, new SolidBrush(Color.Black),
  4949. new PointF(fiveLine1RectangleFs[3].X - sizeF.Width / 4, (fiveLine1RectangleFs[3].Y + fiveLine1RectangleFs[4].Y) / 2));
  4950. b1 = Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y);
  4951. }
  4952. if (fiveLine2RectangleFs.Count > 1)
  4953. {
  4954. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4955. if (this.checkBox1.Checked)
  4956. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4957. lineFont, new SolidBrush(Color.Black),
  4958. new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2));
  4959. a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y);
  4960. }
  4961. if (fiveLine2RectangleFs.Count > 2)
  4962. {
  4963. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4964. if (this.checkBox1.Checked)
  4965. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4966. lineFont, new SolidBrush(Color.Black),
  4967. new PointF(fiveLine2RectangleFs[1].X - sizeF.Width / 4, (fiveLine2RectangleFs[1].Y + fiveLine2RectangleFs[2].Y) / 2));
  4968. c2 = Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y);
  4969. }
  4970. if (fiveLine2RectangleFs.Count > 4)
  4971. {
  4972. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4973. if (this.checkBox1.Checked)
  4974. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4975. lineFont, new SolidBrush(Color.Black),
  4976. new PointF(fiveLine2RectangleFs[3].X - sizeF.Width / 4, (fiveLine2RectangleFs[3].Y + fiveLine2RectangleFs[4].Y) / 2));
  4977. b2 = Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y);
  4978. }
  4979. if (fiveLine3RectangleFs.Count > 1)
  4980. {
  4981. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4982. if (this.checkBox1.Checked)
  4983. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4984. lineFont, new SolidBrush(Color.Black),
  4985. new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2));
  4986. a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y);
  4987. }
  4988. if (fiveLine3RectangleFs.Count > 2)
  4989. {
  4990. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4991. if (this.checkBox1.Checked)
  4992. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4993. lineFont, new SolidBrush(Color.Black),
  4994. new PointF(fiveLine3RectangleFs[1].X - sizeF.Width / 4, (fiveLine3RectangleFs[1].Y + fiveLine3RectangleFs[2].Y) / 2));
  4995. c3 = Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y);
  4996. }
  4997. if (fiveLine3RectangleFs.Count > 4)
  4998. {
  4999. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5000. if (this.checkBox1.Checked)
  5001. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5002. lineFont, new SolidBrush(Color.Black),
  5003. new PointF(fiveLine3RectangleFs[3].X - sizeF.Width / 4, (fiveLine3RectangleFs[3].Y + fiveLine3RectangleFs[4].Y) / 2));
  5004. b3 = Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y);
  5005. }
  5006. if (fiveLine4RectangleFs.Count > 1)
  5007. {
  5008. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5009. if (this.checkBox1.Checked)
  5010. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5011. lineFont, new SolidBrush(Color.Black),
  5012. new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2));
  5013. a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y);
  5014. }
  5015. if (fiveLine4RectangleFs.Count > 2)
  5016. {
  5017. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5018. if (this.checkBox1.Checked)
  5019. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5020. lineFont, new SolidBrush(Color.Black),
  5021. new PointF(fiveLine4RectangleFs[1].X - sizeF.Width / 4, (fiveLine4RectangleFs[1].Y + fiveLine4RectangleFs[2].Y) / 2));
  5022. c4 = Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y);
  5023. }
  5024. if (fiveLine4RectangleFs.Count > 4)
  5025. {
  5026. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5027. if (this.checkBox1.Checked)
  5028. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5029. lineFont, new SolidBrush(Color.Black),
  5030. new PointF(fiveLine4RectangleFs[3].X - sizeF.Width / 4, (fiveLine4RectangleFs[3].Y + fiveLine4RectangleFs[4].Y) / 2));
  5031. b4 = Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y);
  5032. }
  5033. if (fiveLine5RectangleFs.Count > 1)
  5034. {
  5035. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5036. if (this.checkBox1.Checked)
  5037. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5038. lineFont, new SolidBrush(Color.Black),
  5039. new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2));
  5040. a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y);
  5041. }
  5042. if (fiveLine5RectangleFs.Count > 2)
  5043. {
  5044. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5045. if (this.checkBox1.Checked)
  5046. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5047. lineFont, new SolidBrush(Color.Black),
  5048. new PointF(fiveLine5RectangleFs[1].X - sizeF.Width / 4, (fiveLine5RectangleFs[1].Y + fiveLine5RectangleFs[2].Y) / 2));
  5049. c5 = Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y);
  5050. }
  5051. if (fiveLine5RectangleFs.Count > 4)
  5052. {
  5053. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5054. if (this.checkBox1.Checked)
  5055. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5056. lineFont, new SolidBrush(Color.Black),
  5057. new PointF(fiveLine5RectangleFs[3].X - sizeF.Width / 4, (fiveLine5RectangleFs[3].Y + fiveLine5RectangleFs[4].Y) / 2));
  5058. b5 = Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y);
  5059. }
  5060. }
  5061. else if (this.type.Equals(constTypeD))
  5062. {
  5063. if (fiveLine1RectangleFs.Count == 2)
  5064. {
  5065. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5066. }
  5067. else if (fiveLine1RectangleFs.Count == 3)
  5068. {
  5069. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5070. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  5071. }
  5072. else if (fiveLine1RectangleFs.Count == 4)
  5073. {
  5074. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5075. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  5076. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength));
  5077. }
  5078. else if (fiveLine1RectangleFs.Count == 5)
  5079. {
  5080. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5081. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  5082. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength));
  5083. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength));
  5084. }
  5085. else if (fiveLine1RectangleFs.Count == 6)
  5086. {
  5087. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5088. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  5089. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength));
  5090. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength));
  5091. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[4].Y - fiveLine1RectangleFs[5].Y) * this.unitLength));
  5092. }
  5093. if (fiveLine2RectangleFs.Count == 2)
  5094. {
  5095. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5096. }
  5097. else if (fiveLine2RectangleFs.Count == 3)
  5098. {
  5099. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5100. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  5101. }
  5102. else if (fiveLine2RectangleFs.Count == 4)
  5103. {
  5104. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5105. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  5106. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength));
  5107. }
  5108. else if (fiveLine2RectangleFs.Count == 5)
  5109. {
  5110. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5111. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  5112. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength));
  5113. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength));
  5114. }
  5115. else if (fiveLine2RectangleFs.Count == 6)
  5116. {
  5117. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5118. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  5119. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength));
  5120. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength));
  5121. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[4].Y - fiveLine2RectangleFs[5].Y) * this.unitLength));
  5122. }
  5123. if (fiveLine3RectangleFs.Count == 2)
  5124. {
  5125. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5126. }
  5127. else if (fiveLine3RectangleFs.Count == 3)
  5128. {
  5129. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5130. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  5131. }
  5132. else if (fiveLine3RectangleFs.Count == 4)
  5133. {
  5134. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5135. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  5136. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength));
  5137. }
  5138. else if (fiveLine3RectangleFs.Count == 5)
  5139. {
  5140. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5141. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  5142. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength));
  5143. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength));
  5144. }
  5145. else if (fiveLine3RectangleFs.Count == 6)
  5146. {
  5147. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5148. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  5149. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength));
  5150. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength));
  5151. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[4].Y - fiveLine3RectangleFs[5].Y) * this.unitLength));
  5152. }
  5153. if (fiveLine4RectangleFs.Count == 2)
  5154. {
  5155. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5156. }
  5157. else if (fiveLine4RectangleFs.Count == 3)
  5158. {
  5159. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5160. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  5161. }
  5162. else if (fiveLine4RectangleFs.Count == 4)
  5163. {
  5164. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5165. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  5166. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength));
  5167. }
  5168. else if (fiveLine4RectangleFs.Count == 5)
  5169. {
  5170. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5171. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  5172. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength));
  5173. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength));
  5174. }
  5175. else if (fiveLine4RectangleFs.Count == 6)
  5176. {
  5177. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5178. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  5179. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength));
  5180. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength));
  5181. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[4].Y - fiveLine4RectangleFs[5].Y) * this.unitLength));
  5182. }
  5183. if (fiveLine5RectangleFs.Count == 2)
  5184. {
  5185. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5186. }
  5187. else if (fiveLine5RectangleFs.Count == 3)
  5188. {
  5189. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5190. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  5191. }
  5192. else if (fiveLine5RectangleFs.Count == 4)
  5193. {
  5194. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5195. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  5196. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength));
  5197. }
  5198. else if (fiveLine5RectangleFs.Count == 5)
  5199. {
  5200. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5201. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  5202. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength));
  5203. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength));
  5204. }
  5205. else if (fiveLine5RectangleFs.Count == 6)
  5206. {
  5207. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5208. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  5209. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength));
  5210. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength));
  5211. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[4].Y - fiveLine5RectangleFs[5].Y) * this.unitLength));
  5212. }
  5213. if (fiveLine1RectangleFs.Count > 1)
  5214. {
  5215. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5216. if (this.checkBox1.Checked)
  5217. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5218. lineFont, new SolidBrush(Color.Black),
  5219. new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2));
  5220. a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y);
  5221. }
  5222. if (fiveLine1RectangleFs.Count > 2)
  5223. {
  5224. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5225. if (this.checkBox1.Checked)
  5226. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5227. lineFont, new SolidBrush(Color.Black),
  5228. new PointF(fiveLine1RectangleFs[1].X - sizeF.Width / 4, (fiveLine1RectangleFs[1].Y + fiveLine1RectangleFs[2].Y) / 2));
  5229. c1 = Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y);
  5230. }
  5231. if (fiveLine1RectangleFs.Count > 4)
  5232. {
  5233. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5234. if (this.checkBox1.Checked)
  5235. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5236. lineFont, new SolidBrush(Color.Black),
  5237. new PointF(fiveLine1RectangleFs[3].X - sizeF.Width / 4, (fiveLine1RectangleFs[3].Y + fiveLine1RectangleFs[4].Y) / 2));
  5238. d1 = Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y);
  5239. }
  5240. if (fiveLine1RectangleFs.Count > 5)
  5241. {
  5242. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[4].Y - fiveLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5243. if (this.checkBox1.Checked)
  5244. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[4].Y - fiveLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  5245. lineFont, new SolidBrush(Color.Black),
  5246. new PointF(fiveLine1RectangleFs[4].X - sizeF.Width / 4, (fiveLine1RectangleFs[4].Y + fiveLine1RectangleFs[5].Y) / 2));
  5247. b1 = Math.Abs(fiveLine1RectangleFs[4].Y - fiveLine1RectangleFs[5].Y);
  5248. }
  5249. if (fiveLine2RectangleFs.Count > 1)
  5250. {
  5251. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5252. if (this.checkBox1.Checked)
  5253. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5254. lineFont, new SolidBrush(Color.Black),
  5255. new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2));
  5256. a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y);
  5257. }
  5258. if (fiveLine2RectangleFs.Count > 2)
  5259. {
  5260. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5261. if (this.checkBox1.Checked)
  5262. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5263. lineFont, new SolidBrush(Color.Black),
  5264. new PointF(fiveLine2RectangleFs[1].X - sizeF.Width / 4, (fiveLine2RectangleFs[1].Y + fiveLine2RectangleFs[2].Y) / 2));
  5265. c2 = Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y);
  5266. }
  5267. if (fiveLine2RectangleFs.Count > 4)
  5268. {
  5269. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5270. if (this.checkBox1.Checked)
  5271. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5272. lineFont, new SolidBrush(Color.Black),
  5273. new PointF(fiveLine2RectangleFs[3].X - sizeF.Width / 4, (fiveLine2RectangleFs[3].Y + fiveLine2RectangleFs[4].Y) / 2));
  5274. d2 = Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y);
  5275. }
  5276. if (fiveLine2RectangleFs.Count > 5)
  5277. {
  5278. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[4].Y - fiveLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5279. if (this.checkBox1.Checked)
  5280. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[4].Y - fiveLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  5281. lineFont, new SolidBrush(Color.Black),
  5282. new PointF(fiveLine2RectangleFs[4].X - sizeF.Width / 4, (fiveLine2RectangleFs[4].Y + fiveLine2RectangleFs[5].Y) / 2));
  5283. b2 = Math.Abs(fiveLine2RectangleFs[4].Y - fiveLine2RectangleFs[5].Y);
  5284. }
  5285. if (fiveLine3RectangleFs.Count > 1)
  5286. {
  5287. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5288. if (this.checkBox1.Checked)
  5289. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5290. lineFont, new SolidBrush(Color.Black),
  5291. new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2));
  5292. a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y);
  5293. }
  5294. if (fiveLine3RectangleFs.Count > 2)
  5295. {
  5296. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5297. if (this.checkBox1.Checked)
  5298. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5299. lineFont, new SolidBrush(Color.Black),
  5300. new PointF(fiveLine3RectangleFs[1].X - sizeF.Width / 4, (fiveLine3RectangleFs[1].Y + fiveLine3RectangleFs[2].Y) / 2));
  5301. c3 = Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y);
  5302. }
  5303. if (fiveLine3RectangleFs.Count > 4)
  5304. {
  5305. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5306. if (this.checkBox1.Checked)
  5307. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5308. lineFont, new SolidBrush(Color.Black),
  5309. new PointF(fiveLine3RectangleFs[3].X - sizeF.Width / 4, (fiveLine3RectangleFs[3].Y + fiveLine3RectangleFs[4].Y) / 2));
  5310. d3 = Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y);
  5311. }
  5312. if (fiveLine3RectangleFs.Count > 5)
  5313. {
  5314. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[4].Y - fiveLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5315. if (this.checkBox1.Checked)
  5316. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[4].Y - fiveLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  5317. lineFont, new SolidBrush(Color.Black),
  5318. new PointF(fiveLine3RectangleFs[4].X - sizeF.Width / 4, (fiveLine3RectangleFs[4].Y + fiveLine3RectangleFs[5].Y) / 2));
  5319. b3 = Math.Abs(fiveLine3RectangleFs[4].Y - fiveLine3RectangleFs[5].Y);
  5320. }
  5321. if (fiveLine4RectangleFs.Count > 1)
  5322. {
  5323. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5324. if (this.checkBox1.Checked)
  5325. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5326. lineFont, new SolidBrush(Color.Black),
  5327. new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2));
  5328. a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y);
  5329. }
  5330. if (fiveLine4RectangleFs.Count > 2)
  5331. {
  5332. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5333. if (this.checkBox1.Checked)
  5334. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5335. lineFont, new SolidBrush(Color.Black),
  5336. new PointF(fiveLine4RectangleFs[1].X - sizeF.Width / 4, (fiveLine4RectangleFs[1].Y + fiveLine4RectangleFs[2].Y) / 2));
  5337. c4 = Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y);
  5338. }
  5339. if (fiveLine4RectangleFs.Count > 4)
  5340. {
  5341. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5342. if (this.checkBox1.Checked)
  5343. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5344. lineFont, new SolidBrush(Color.Black),
  5345. new PointF(fiveLine4RectangleFs[3].X - sizeF.Width / 4, (fiveLine4RectangleFs[3].Y + fiveLine4RectangleFs[4].Y) / 2));
  5346. d4 = Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y);
  5347. }
  5348. if (fiveLine4RectangleFs.Count > 5)
  5349. {
  5350. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[4].Y - fiveLine4RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5351. if (this.checkBox1.Checked)
  5352. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[4].Y - fiveLine4RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  5353. lineFont, new SolidBrush(Color.Black),
  5354. new PointF(fiveLine4RectangleFs[4].X - sizeF.Width / 4, (fiveLine4RectangleFs[4].Y + fiveLine4RectangleFs[5].Y) / 2));
  5355. b4 = Math.Abs(fiveLine4RectangleFs[4].Y - fiveLine4RectangleFs[5].Y);
  5356. }
  5357. if (fiveLine5RectangleFs.Count > 1)
  5358. {
  5359. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5360. if (this.checkBox1.Checked)
  5361. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5362. lineFont, new SolidBrush(Color.Black),
  5363. new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2));
  5364. a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y);
  5365. }
  5366. if (fiveLine5RectangleFs.Count > 2)
  5367. {
  5368. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5369. if (this.checkBox1.Checked)
  5370. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5371. lineFont, new SolidBrush(Color.Black),
  5372. new PointF(fiveLine5RectangleFs[1].X - sizeF.Width / 4, (fiveLine5RectangleFs[1].Y + fiveLine5RectangleFs[2].Y) / 2));
  5373. c5 = Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y);
  5374. }
  5375. if (fiveLine5RectangleFs.Count > 4)
  5376. {
  5377. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5378. if (this.checkBox1.Checked)
  5379. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5380. lineFont, new SolidBrush(Color.Black),
  5381. new PointF(fiveLine5RectangleFs[3].X - sizeF.Width / 4, (fiveLine5RectangleFs[3].Y + fiveLine5RectangleFs[4].Y) / 2));
  5382. d5 = Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y);
  5383. }
  5384. if (fiveLine5RectangleFs.Count > 5)
  5385. {
  5386. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[4].Y - fiveLine5RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5387. if (this.checkBox1.Checked)
  5388. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[4].Y - fiveLine5RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  5389. lineFont, new SolidBrush(Color.Black),
  5390. new PointF(fiveLine5RectangleFs[4].X - sizeF.Width / 4, (fiveLine5RectangleFs[4].Y + fiveLine5RectangleFs[5].Y) / 2));
  5391. b5 = Math.Abs(fiveLine5RectangleFs[4].Y - fiveLine5RectangleFs[5].Y);
  5392. }
  5393. }
  5394. else if (this.type.Equals(constTypeE))
  5395. {
  5396. if (fiveLine1RectangleFs.Count == 2)
  5397. {
  5398. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5399. }
  5400. else if (fiveLine1RectangleFs.Count == 3)
  5401. {
  5402. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5403. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  5404. }
  5405. if (fiveLine2RectangleFs.Count == 2)
  5406. {
  5407. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5408. }
  5409. else if (fiveLine2RectangleFs.Count == 3)
  5410. {
  5411. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5412. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  5413. }
  5414. if (fiveLine3RectangleFs.Count == 2)
  5415. {
  5416. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5417. }
  5418. else if (fiveLine3RectangleFs.Count == 3)
  5419. {
  5420. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5421. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  5422. }
  5423. if (fiveLine4RectangleFs.Count == 2)
  5424. {
  5425. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5426. }
  5427. else if (fiveLine4RectangleFs.Count == 3)
  5428. {
  5429. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5430. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  5431. }
  5432. if (fiveLine5RectangleFs.Count == 2)
  5433. {
  5434. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5435. }
  5436. else if (fiveLine5RectangleFs.Count == 3)
  5437. {
  5438. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5439. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  5440. }
  5441. if (fiveLine1RectangleFs.Count > 1)
  5442. {
  5443. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5444. if (this.checkBox1.Checked)
  5445. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5446. lineFont, new SolidBrush(Color.Black),
  5447. new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2));
  5448. a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y);
  5449. }
  5450. if (fiveLine1RectangleFs.Count > 2)
  5451. {
  5452. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5453. if (this.checkBox1.Checked)
  5454. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5455. lineFont, new SolidBrush(Color.Black),
  5456. new PointF(fiveLine1RectangleFs[1].X - sizeF.Width / 4, (fiveLine1RectangleFs[1].Y + fiveLine1RectangleFs[2].Y) / 2));
  5457. c1 = Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y);
  5458. }
  5459. if (fiveLine2RectangleFs.Count > 1)
  5460. {
  5461. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5462. if (this.checkBox1.Checked)
  5463. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5464. lineFont, new SolidBrush(Color.Black),
  5465. new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2));
  5466. a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y);
  5467. }
  5468. if (fiveLine2RectangleFs.Count > 2)
  5469. {
  5470. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5471. if (this.checkBox1.Checked)
  5472. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5473. lineFont, new SolidBrush(Color.Black),
  5474. new PointF(fiveLine2RectangleFs[1].X - sizeF.Width / 4, (fiveLine2RectangleFs[1].Y + fiveLine2RectangleFs[2].Y) / 2));
  5475. c2 = Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y);
  5476. }
  5477. if (fiveLine3RectangleFs.Count > 1)
  5478. {
  5479. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5480. if (this.checkBox1.Checked)
  5481. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5482. lineFont, new SolidBrush(Color.Black),
  5483. new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2));
  5484. a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y);
  5485. }
  5486. if (fiveLine3RectangleFs.Count > 2)
  5487. {
  5488. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5489. if (this.checkBox1.Checked)
  5490. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5491. lineFont, new SolidBrush(Color.Black),
  5492. new PointF(fiveLine3RectangleFs[1].X - sizeF.Width / 4, (fiveLine3RectangleFs[1].Y + fiveLine3RectangleFs[2].Y) / 2));
  5493. c3 = Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y);
  5494. }
  5495. if (fiveLine4RectangleFs.Count > 1)
  5496. {
  5497. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5498. if (this.checkBox1.Checked)
  5499. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5500. lineFont, new SolidBrush(Color.Black),
  5501. new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2));
  5502. a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y);
  5503. }
  5504. if (fiveLine4RectangleFs.Count > 2)
  5505. {
  5506. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5507. if (this.checkBox1.Checked)
  5508. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5509. lineFont, new SolidBrush(Color.Black),
  5510. new PointF(fiveLine4RectangleFs[1].X - sizeF.Width / 4, (fiveLine4RectangleFs[1].Y + fiveLine4RectangleFs[2].Y) / 2));
  5511. c4 = Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y);
  5512. }
  5513. if (fiveLine5RectangleFs.Count > 1)
  5514. {
  5515. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5516. if (this.checkBox1.Checked)
  5517. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5518. lineFont, new SolidBrush(Color.Black),
  5519. new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2));
  5520. a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y);
  5521. }
  5522. if (fiveLine5RectangleFs.Count > 2)
  5523. {
  5524. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5525. if (this.checkBox1.Checked)
  5526. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5527. lineFont, new SolidBrush(Color.Black),
  5528. new PointF(fiveLine5RectangleFs[1].X - sizeF.Width / 4, (fiveLine5RectangleFs[1].Y + fiveLine5RectangleFs[2].Y) / 2));
  5529. c5 = Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y);
  5530. }
  5531. }
  5532. }
  5533. #endregion
  5534. #endregion
  5535. #region 计算百分比基数
  5536. if (this.linesNumber == 3)
  5537. {
  5538. if (this.type.Equals(constTypeA))
  5539. {
  5540. int line = 0;
  5541. if (threeLine1RectangleFs.Count > 2)
  5542. {
  5543. line++;
  5544. w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[2].Y);
  5545. }
  5546. if (threeLine2RectangleFs.Count > 2)
  5547. {
  5548. line++;
  5549. w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[2].Y);
  5550. }
  5551. if (threeLine3RectangleFs.Count > 2)
  5552. {
  5553. line++;
  5554. w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[2].Y);
  5555. }
  5556. w = w / line;
  5557. }
  5558. else if (this.type.Equals(constTypeB))
  5559. {
  5560. int line = 0;
  5561. if (threeLine1RectangleFs.Count > 3)
  5562. {
  5563. line++;
  5564. w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[3].Y);
  5565. }
  5566. if (threeLine2RectangleFs.Count > 3 )
  5567. {
  5568. line++;
  5569. w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[3].Y);
  5570. }
  5571. if (threeLine3RectangleFs.Count > 3)
  5572. {
  5573. line++;
  5574. w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[3].Y);
  5575. }
  5576. w = w / line;
  5577. }
  5578. else if (this.type.Equals(constTypeC))
  5579. {
  5580. int line = 0;
  5581. if (threeLine1RectangleFs.Count > 4)
  5582. {
  5583. line++;
  5584. w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[4].Y);
  5585. }
  5586. if (threeLine2RectangleFs.Count > 4)
  5587. {
  5588. line++;
  5589. w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[4].Y);
  5590. }
  5591. if (threeLine3RectangleFs.Count > 4)
  5592. {
  5593. line++;
  5594. w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[4].Y);
  5595. }
  5596. w = w / line;
  5597. }
  5598. else if (this.type.Equals(constTypeD))
  5599. {
  5600. int line = 0;
  5601. if (threeLine1RectangleFs.Count > 5)
  5602. {
  5603. line++;
  5604. w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[5].Y);
  5605. }
  5606. if (threeLine2RectangleFs.Count > 5)
  5607. {
  5608. line++;
  5609. w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[5].Y);
  5610. }
  5611. if (threeLine3RectangleFs.Count > 5)
  5612. {
  5613. line++;
  5614. w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[5].Y);
  5615. }
  5616. w = w / line;
  5617. }
  5618. else if (this.type.Equals(constTypeE))
  5619. {
  5620. int line = 0;
  5621. if (threeLine1RectangleFs.Count > 3)
  5622. {
  5623. line++;
  5624. w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[3].Y);
  5625. }
  5626. if (threeLine2RectangleFs.Count > 3)
  5627. {
  5628. line++;
  5629. w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[3].Y);
  5630. }
  5631. if (threeLine3RectangleFs.Count > 3)
  5632. {
  5633. line++;
  5634. w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[3].Y);
  5635. }
  5636. w = w / line;
  5637. }
  5638. }
  5639. else if (this.linesNumber == 4)
  5640. {
  5641. if (this.type.Equals(constTypeA))
  5642. {
  5643. int line = 0;
  5644. if (fourLine1RectangleFs.Count > 2)
  5645. {
  5646. line++;
  5647. w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[2].Y);
  5648. }
  5649. if (fourLine2RectangleFs.Count > 2)
  5650. {
  5651. line++;
  5652. w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[2].Y);
  5653. }
  5654. if (fourLine3RectangleFs.Count > 2)
  5655. {
  5656. line++;
  5657. w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[2].Y);
  5658. }
  5659. if (fourLine4RectangleFs.Count > 2)
  5660. {
  5661. line++;
  5662. w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[2].Y);
  5663. }
  5664. w = w / line;
  5665. }
  5666. else if (this.type.Equals(constTypeB))
  5667. {
  5668. int line = 0;
  5669. if (fourLine1RectangleFs.Count > 3)
  5670. {
  5671. line++;
  5672. w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[3].Y);
  5673. }
  5674. if (fourLine2RectangleFs.Count > 3)
  5675. {
  5676. line++;
  5677. w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[3].Y);
  5678. }
  5679. if (fourLine3RectangleFs.Count > 3)
  5680. {
  5681. line++;
  5682. w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[3].Y);
  5683. }
  5684. if (fourLine4RectangleFs.Count > 3)
  5685. {
  5686. line++;
  5687. w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[3].Y);
  5688. }
  5689. w = w / line;
  5690. }
  5691. else if (this.type.Equals(constTypeC))
  5692. {
  5693. int line = 0;
  5694. if (fourLine1RectangleFs.Count > 4)
  5695. {
  5696. line++;
  5697. w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[4].Y);
  5698. }
  5699. if (fourLine2RectangleFs.Count > 4)
  5700. {
  5701. line++;
  5702. w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[4].Y);
  5703. }
  5704. if (fourLine3RectangleFs.Count > 4)
  5705. {
  5706. line++;
  5707. w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[4].Y);
  5708. }
  5709. if (fourLine4RectangleFs.Count > 4)
  5710. {
  5711. line++;
  5712. w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[4].Y);
  5713. }
  5714. w = w / line;
  5715. }
  5716. else if (this.type.Equals(constTypeD))
  5717. {
  5718. int line = 0;
  5719. if (fourLine1RectangleFs.Count > 5)
  5720. {
  5721. line++;
  5722. w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[5].Y);
  5723. }
  5724. if (fourLine2RectangleFs.Count > 5)
  5725. {
  5726. line++;
  5727. w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[5].Y);
  5728. }
  5729. if (fourLine3RectangleFs.Count > 5)
  5730. {
  5731. line++;
  5732. w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[5].Y);
  5733. }
  5734. if (fourLine4RectangleFs.Count > 5)
  5735. {
  5736. line++;
  5737. w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[5].Y);
  5738. }
  5739. w = w / line;
  5740. }
  5741. else if (this.type.Equals(constTypeE))
  5742. {
  5743. int line = 0;
  5744. if (fourLine1RectangleFs.Count > 3)
  5745. {
  5746. line++;
  5747. w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[3].Y);
  5748. }
  5749. if (fourLine2RectangleFs.Count > 3)
  5750. {
  5751. line++;
  5752. w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[3].Y);
  5753. }
  5754. if (fourLine3RectangleFs.Count > 3)
  5755. {
  5756. line++;
  5757. w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[3].Y);
  5758. }
  5759. if (fourLine4RectangleFs.Count > 3)
  5760. {
  5761. line++;
  5762. w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[3].Y);
  5763. }
  5764. w = w / line;
  5765. }
  5766. }
  5767. else if (this.linesNumber == 5)
  5768. {
  5769. if (this.type.Equals(constTypeA))
  5770. {
  5771. int line = 0;
  5772. if (fiveLine1RectangleFs.Count > 2)
  5773. {
  5774. line++;
  5775. w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[2].Y);
  5776. }
  5777. if (fiveLine2RectangleFs.Count > 2)
  5778. {
  5779. line++;
  5780. w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[2].Y);
  5781. }
  5782. if (fiveLine3RectangleFs.Count > 2)
  5783. {
  5784. line++;
  5785. w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[2].Y);
  5786. }
  5787. if (fiveLine4RectangleFs.Count > 2)
  5788. {
  5789. line++;
  5790. w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[2].Y);
  5791. }
  5792. if (fiveLine5RectangleFs.Count > 2)
  5793. {
  5794. line++;
  5795. w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[2].Y);
  5796. }
  5797. w = w / line;
  5798. }
  5799. else if (this.type.Equals(constTypeB))
  5800. {
  5801. int line = 0;
  5802. if (fiveLine1RectangleFs.Count > 3)
  5803. {
  5804. line++;
  5805. w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[3].Y);
  5806. }
  5807. if (fiveLine2RectangleFs.Count > 3)
  5808. {
  5809. line++;
  5810. w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[3].Y);
  5811. }
  5812. if (fiveLine3RectangleFs.Count > 3)
  5813. {
  5814. line++;
  5815. w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[3].Y);
  5816. }
  5817. if (fiveLine4RectangleFs.Count > 3)
  5818. {
  5819. line++;
  5820. w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[3].Y);
  5821. }
  5822. if (fiveLine5RectangleFs.Count > 3)
  5823. {
  5824. line++;
  5825. w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[3].Y);
  5826. }
  5827. w = w / line;
  5828. }
  5829. else if (this.type.Equals(constTypeC))
  5830. {
  5831. int line = 0;
  5832. if (fiveLine1RectangleFs.Count > 4)
  5833. {
  5834. line++;
  5835. w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[4].Y);
  5836. }
  5837. if (fiveLine2RectangleFs.Count > 4)
  5838. {
  5839. line++;
  5840. w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[4].Y);
  5841. }
  5842. if (fiveLine3RectangleFs.Count > 4)
  5843. {
  5844. line++;
  5845. w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[4].Y);
  5846. }
  5847. if (fiveLine4RectangleFs.Count > 4)
  5848. {
  5849. line++;
  5850. w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[4].Y);
  5851. }
  5852. if (fiveLine5RectangleFs.Count > 4)
  5853. {
  5854. line++;
  5855. w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[4].Y);
  5856. }
  5857. w = w / line;
  5858. }
  5859. else if (this.type.Equals(constTypeD))
  5860. {
  5861. int line = 0;
  5862. if (fiveLine1RectangleFs.Count > 5)
  5863. {
  5864. line++;
  5865. w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[5].Y);
  5866. }
  5867. if (fiveLine2RectangleFs.Count > 5)
  5868. {
  5869. line++;
  5870. w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[5].Y);
  5871. }
  5872. if (fiveLine3RectangleFs.Count > 5)
  5873. {
  5874. line++;
  5875. w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[5].Y);
  5876. }
  5877. if (fiveLine4RectangleFs.Count > 5)
  5878. {
  5879. line++;
  5880. w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[5].Y);
  5881. }
  5882. if (fiveLine5RectangleFs.Count > 5)
  5883. {
  5884. line++;
  5885. w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[5].Y);
  5886. }
  5887. w = w / line;
  5888. }
  5889. else if (this.type.Equals(constTypeE))
  5890. {
  5891. int line = 0;
  5892. if (fiveLine1RectangleFs.Count > 3)
  5893. {
  5894. line++;
  5895. w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[3].Y);
  5896. }
  5897. if (fiveLine2RectangleFs.Count > 3)
  5898. {
  5899. line++;
  5900. w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[3].Y);
  5901. }
  5902. if (fiveLine3RectangleFs.Count > 3)
  5903. {
  5904. line++;
  5905. w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[3].Y);
  5906. }
  5907. if (fiveLine4RectangleFs.Count > 3)
  5908. {
  5909. line++;
  5910. w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[3].Y);
  5911. }
  5912. if (fiveLine5RectangleFs.Count > 3)
  5913. {
  5914. line++;
  5915. w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[3].Y);
  5916. }
  5917. w = w / line;
  5918. }
  5919. }
  5920. #endregion
  5921. if(w > 0)
  5922. {
  5923. Matrix mtxSave = graphics.Transform;
  5924. Matrix matrix = graphics.Transform;
  5925. float sp = 0;
  5926. // 线条数为三
  5927. if (this.linesNumber == 3)
  5928. {
  5929. sp = this.documentWorkspace.CompositionSurface.Width - (this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing);
  5930. PointF point = new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + sp / 2 - this.lineWidth / 2, this.documentWorkspace.CompositionSurface.Height / 2);
  5931. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + sp / 2, this.documentWorkspace.CompositionSurface.Height / 2 - (int)w / 2), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + sp / 2, this.documentWorkspace.CompositionSurface.Height / 2 + (int)w / 2));
  5932. matrix.RotateAt((float)90, new PointF(point.X, point.Y));
  5933. graphics.Transform = matrix;
  5934. graphics.DrawString("" + Math.Round(w * this.unitLength, this.decimalCls) + "μm", lineFont, brush, point);
  5935. //还原为原始旋转矩阵
  5936. graphics.Transform = mtxSave;
  5937. }
  5938. // 线条数为四
  5939. else if (this.linesNumber == 4)
  5940. {
  5941. sp = this.documentWorkspace.CompositionSurface.Width - (this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2);
  5942. PointF point = new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 + sp / 2 - this.lineWidth / 2, this.documentWorkspace.CompositionSurface.Height / 2);
  5943. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 + sp / 2, this.documentWorkspace.CompositionSurface.Height / 2 - (int)w / 2), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 + sp / 2, this.documentWorkspace.CompositionSurface.Height / 2 + (int)w / 2));
  5944. matrix.RotateAt((float)90, new PointF(point.X, point.Y));
  5945. graphics.Transform = matrix;
  5946. graphics.DrawString("" + Math.Round(w * this.unitLength, this.decimalCls) + "μm", lineFont, brush, point);
  5947. //还原为原始旋转矩阵
  5948. graphics.Transform = mtxSave;
  5949. }
  5950. // 线条数为五
  5951. else if (this.linesNumber == 5)
  5952. {
  5953. sp = this.documentWorkspace.CompositionSurface.Width - (this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing);
  5954. PointF point = new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing + sp / 2 - this.lineWidth / 2, this.documentWorkspace.CompositionSurface.Height / 2);
  5955. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing + sp / 2, this.documentWorkspace.CompositionSurface.Height / 2 - (int)w / 2), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing + sp / 2, this.documentWorkspace.CompositionSurface.Height / 2 + (int)w / 2));
  5956. matrix.RotateAt((float)90, new PointF(point.X, point.Y));
  5957. graphics.Transform = matrix;
  5958. graphics.DrawString("" + Math.Round(w * this.unitLength, this.decimalCls) + "μm", lineFont, brush, point);
  5959. //还原为原始旋转矩阵
  5960. graphics.Transform = mtxSave;
  5961. }
  5962. matrix.Dispose();
  5963. }
  5964. }
  5965. #region 计算测量点百分比
  5966. if (this.pointDrawkb)
  5967. {
  5968. // 取目标值/误差
  5969. int left;
  5970. int right;
  5971. string leftValue;
  5972. string rightValue;
  5973. float length1 = 0;
  5974. float length2 = 0;
  5975. float length3 = 0;
  5976. float length4 = 0;
  5977. float length5 = 0;
  5978. // 线条数为三
  5979. if (this.linesNumber == 3)
  5980. {
  5981. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  5982. {
  5983. // 总百分比
  5984. float all = 0;
  5985. if (i == 0)
  5986. {
  5987. length1 = a1;
  5988. length2 = a2;
  5989. length3 = a3;
  5990. }
  5991. else if (i == 1)
  5992. {
  5993. if (this.type.Equals(constTypeE))
  5994. {
  5995. length1 = c1;
  5996. length2 = c2;
  5997. length3 = c3;
  5998. }
  5999. else
  6000. {
  6001. length1 = b1;
  6002. length2 = b2;
  6003. length3 = b3;
  6004. }
  6005. }
  6006. else if (i == 2)
  6007. {
  6008. length1 = c1;
  6009. length2 = c2;
  6010. length3 = c3;
  6011. }
  6012. else if (i == 3)
  6013. {
  6014. length1 = d1;
  6015. length2 = d2;
  6016. length3 = d3;
  6017. }
  6018. left = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("%");
  6019. right = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("-");
  6020. leftValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(0, left);
  6021. rightValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(right + 1);
  6022. if (pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6023. {
  6024. this.dataGridView2.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6025. this.dataGridView3.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6026. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6027. }
  6028. else
  6029. {
  6030. this.dataGridView2.Rows[i].Cells[2].Value = "" + Math.Round((length1 / w) * 100, decimalCls);
  6031. this.dataGridView3.Rows[i].Cells[2].Value = "" + ((length1 / w) * 100);
  6032. all += (length1 / w) * 100;
  6033. if (length1 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6034. || length1 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6035. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6036. else
  6037. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = SystemColors.ControlLightLight;
  6038. }
  6039. if (pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6040. {
  6041. this.dataGridView2.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6042. this.dataGridView3.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6043. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6044. }
  6045. else
  6046. {
  6047. this.dataGridView2.Rows[i].Cells[3].Value = "" + Math.Round((length2 / w) * 100, decimalCls);
  6048. this.dataGridView3.Rows[i].Cells[3].Value = "" + ((length2 / w) * 100);
  6049. all += (length2 / w) * 100;
  6050. if (length2 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6051. || length2 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6052. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6053. else
  6054. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = SystemColors.ControlLightLight;
  6055. }
  6056. if (pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6057. {
  6058. this.dataGridView2.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6059. this.dataGridView3.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6060. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6061. }
  6062. else
  6063. {
  6064. this.dataGridView2.Rows[i].Cells[4].Value = "" + Math.Round((length3 / w) * 100, decimalCls);
  6065. this.dataGridView3.Rows[i].Cells[4].Value = "" + ((length3 / w) * 100);
  6066. all += (length3 / w) * 100;
  6067. if (length3 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6068. || length3 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6069. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6070. else
  6071. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = SystemColors.ControlLightLight;
  6072. }
  6073. // 平均值
  6074. this.dataGridView2.Rows[i].Cells[7].Value = "" + Math.Round(all / 3, decimalCls);
  6075. this.dataGridView3.Rows[i].Cells[7].Value = "" + (all / 3);
  6076. if (all / 3 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6077. || all / 3 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6078. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = Color.Red;
  6079. else
  6080. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = SystemColors.ControlLightLight;
  6081. }
  6082. }
  6083. // 线条数为四
  6084. else if (this.linesNumber == 4)
  6085. {
  6086. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  6087. {
  6088. // 总百分比
  6089. float all = 0;
  6090. if (i == 0)
  6091. {
  6092. length1 = a1;
  6093. length2 = a2;
  6094. length3 = a3;
  6095. length4 = a4;
  6096. }
  6097. else if (i == 1)
  6098. {
  6099. if (this.type.Equals(constTypeE))
  6100. {
  6101. length1 = c1;
  6102. length2 = c2;
  6103. length3 = c3;
  6104. length4 = c4;
  6105. }
  6106. else
  6107. {
  6108. length1 = b1;
  6109. length2 = b2;
  6110. length3 = b3;
  6111. length4 = b4;
  6112. }
  6113. }
  6114. else if (i == 2)
  6115. {
  6116. length1 = c1;
  6117. length2 = c2;
  6118. length3 = c3;
  6119. length4 = c4;
  6120. }
  6121. else if (i == 3)
  6122. {
  6123. length1 = d1;
  6124. length2 = d2;
  6125. length3 = d3;
  6126. length4 = d4;
  6127. }
  6128. left = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("%");
  6129. right = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("-");
  6130. leftValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(0, left);
  6131. rightValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(right + 1);
  6132. if (pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6133. {
  6134. this.dataGridView2.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6135. this.dataGridView3.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6136. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6137. }
  6138. else
  6139. {
  6140. this.dataGridView2.Rows[i].Cells[2].Value = "" + Math.Round((length1 / w) * 100, decimalCls);
  6141. this.dataGridView3.Rows[i].Cells[2].Value = "" + ((length1 / w) * 100);
  6142. all += (length1 / w) * 100;
  6143. if (length1 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6144. || length1 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6145. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6146. else
  6147. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = SystemColors.ControlLightLight;
  6148. }
  6149. if (pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6150. {
  6151. this.dataGridView2.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6152. this.dataGridView3.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6153. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6154. }
  6155. else
  6156. {
  6157. this.dataGridView2.Rows[i].Cells[3].Value = "" + Math.Round((length2 / w) * 100, decimalCls);
  6158. this.dataGridView3.Rows[i].Cells[3].Value = "" + ((length2 / w) * 100);
  6159. all += (length2 / w) * 100;
  6160. if (length2 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6161. || length2 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6162. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6163. else
  6164. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = SystemColors.ControlLightLight;
  6165. }
  6166. if (pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6167. {
  6168. this.dataGridView2.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6169. this.dataGridView3.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6170. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6171. }
  6172. else
  6173. {
  6174. this.dataGridView2.Rows[i].Cells[4].Value = "" + Math.Round((length3 / w) * 100, decimalCls);
  6175. this.dataGridView3.Rows[i].Cells[4].Value = "" + ((length3 / w) * 100);
  6176. all += (length3 / w) * 100;
  6177. if (length3 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6178. || length3 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6179. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6180. else
  6181. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = SystemColors.ControlLightLight;
  6182. }
  6183. if (pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6184. {
  6185. this.dataGridView2.Rows[i].Cells[5].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6186. this.dataGridView3.Rows[i].Cells[5].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6187. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red;
  6188. }
  6189. else
  6190. {
  6191. this.dataGridView2.Rows[i].Cells[5].Value = "" + Math.Round((length4 / w) * 100, decimalCls);
  6192. this.dataGridView3.Rows[i].Cells[5].Value = "" + ((length4 / w) * 100);
  6193. all += (length4 / w) * 100;
  6194. if (length4 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6195. || length4 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6196. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red;
  6197. else
  6198. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = SystemColors.ControlLightLight;
  6199. }
  6200. // 平均值
  6201. this.dataGridView2.Rows[i].Cells[7].Value = "" + Math.Round(all / 4, decimalCls);
  6202. this.dataGridView3.Rows[i].Cells[7].Value = "" + (all / 4);
  6203. if (all / 4 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6204. || all / 4 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6205. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = Color.Red;
  6206. else
  6207. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = SystemColors.ControlLightLight;
  6208. }
  6209. }
  6210. // 线条数为五
  6211. else if (this.linesNumber == 5)
  6212. {
  6213. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  6214. {
  6215. // 总百分比
  6216. float all = 0;
  6217. if (i == 0)
  6218. {
  6219. length1 = a1;
  6220. length2 = a2;
  6221. length3 = a3;
  6222. length4 = a4;
  6223. length5 = a5;
  6224. }
  6225. else if (i == 1)
  6226. {
  6227. if (this.type.Equals(constTypeE))
  6228. {
  6229. length1 = c1;
  6230. length2 = c2;
  6231. length3 = c3;
  6232. length4 = c4;
  6233. length4 = c5;
  6234. }
  6235. else
  6236. {
  6237. length1 = b1;
  6238. length2 = b2;
  6239. length3 = b3;
  6240. length4 = b4;
  6241. length4 = b5;
  6242. }
  6243. }
  6244. else if (i == 2)
  6245. {
  6246. length1 = c1;
  6247. length2 = c2;
  6248. length3 = c3;
  6249. length4 = c4;
  6250. length5 = c5;
  6251. }
  6252. else if (i == 3)
  6253. {
  6254. length1 = d1;
  6255. length2 = d2;
  6256. length3 = d3;
  6257. length4 = d4;
  6258. length5 = d5;
  6259. }
  6260. left = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("%");
  6261. right = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("-");
  6262. leftValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(0, left);
  6263. rightValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(right + 1);
  6264. if (pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6265. {
  6266. this.dataGridView2.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6267. this.dataGridView3.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6268. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6269. }
  6270. else
  6271. {
  6272. this.dataGridView2.Rows[i].Cells[2].Value = "" + Math.Round((length1 / w) * 100, decimalCls);
  6273. this.dataGridView3.Rows[i].Cells[2].Value = "" + ((length1 / w) * 100);
  6274. all += (length1 / w) * 100;
  6275. if (length1 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6276. || length1 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6277. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6278. else
  6279. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = SystemColors.ControlLightLight;
  6280. }
  6281. if (pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6282. {
  6283. this.dataGridView2.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6284. this.dataGridView3.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6285. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6286. }
  6287. else
  6288. {
  6289. this.dataGridView2.Rows[i].Cells[3].Value = "" + Math.Round((length2 / w) * 100, decimalCls);
  6290. this.dataGridView3.Rows[i].Cells[3].Value = "" + ((length2 / w) * 100);
  6291. all += (length2 / w) * 100;
  6292. if (length2 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6293. || length2 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6294. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6295. else
  6296. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = SystemColors.ControlLightLight;
  6297. }
  6298. if (pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6299. {
  6300. this.dataGridView2.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6301. this.dataGridView3.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6302. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6303. }
  6304. else
  6305. {
  6306. this.dataGridView2.Rows[i].Cells[4].Value = "" + Math.Round((length3 / w) * 100, decimalCls);
  6307. this.dataGridView3.Rows[i].Cells[4].Value = "" + ((length3 / w) * 100);
  6308. all += (length3 / w) * 100;
  6309. if (length3 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6310. || length3 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6311. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6312. else
  6313. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = SystemColors.ControlLightLight;
  6314. }
  6315. if (pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6316. {
  6317. this.dataGridView2.Rows[i].Cells[5].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6318. this.dataGridView3.Rows[i].Cells[5].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6319. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red;
  6320. }
  6321. else
  6322. {
  6323. this.dataGridView2.Rows[i].Cells[5].Value = "" + Math.Round((length4 / w) * 100, decimalCls);
  6324. this.dataGridView3.Rows[i].Cells[5].Value = "" + ((length4 / w) * 100);
  6325. all += (length4 / w) * 100;
  6326. if (length4 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6327. || length4 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6328. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red;
  6329. else
  6330. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = SystemColors.ControlLightLight;
  6331. }
  6332. if (pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6333. {
  6334. this.dataGridView2.Rows[i].Cells[6].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6335. this.dataGridView3.Rows[i].Cells[6].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6336. this.dataGridView2.Rows[i].Cells[6].Style.BackColor = Color.Red;
  6337. }
  6338. else
  6339. {
  6340. this.dataGridView2.Rows[i].Cells[6].Value = "" + Math.Round((length5 / w) * 100, decimalCls);
  6341. this.dataGridView3.Rows[i].Cells[6].Value = "" + ((length5 / w) * 100);
  6342. all += (length5 / w) * 100;
  6343. if (length5 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6344. || length5 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6345. this.dataGridView2.Rows[i].Cells[6].Style.BackColor = Color.Red;
  6346. else
  6347. this.dataGridView2.Rows[i].Cells[6].Style.BackColor = SystemColors.ControlLightLight;
  6348. }
  6349. // 平均值
  6350. this.dataGridView2.Rows[i].Cells[7].Value = "" + Math.Round(all / 5, decimalCls);
  6351. this.dataGridView3.Rows[i].Cells[7].Value = "" + (all / 5);
  6352. if (all / 5 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6353. || all / 5 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6354. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = Color.Red;
  6355. else
  6356. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = SystemColors.ControlLightLight;
  6357. }
  6358. }
  6359. }
  6360. #endregion
  6361. brush.Dispose();
  6362. }
  6363. /// <summary>
  6364. /// 鼠标按下
  6365. /// </summary>
  6366. /// <param name="drawArea"></param>
  6367. /// <param name="e"></param>
  6368. private void OnMouseDown(object sender, MouseEventArgs e)
  6369. {
  6370. if (e.Button != MouseButtons.Left)
  6371. return;
  6372. for (int i = 0; i < this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count; i++)
  6373. {
  6374. this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].Selected = false;
  6375. }
  6376. // 换算后的点
  6377. PointF point1 = documentWorkspace.GetScalePoint(e.Location);
  6378. // 选择范围
  6379. int selectTop = 0;
  6380. int selectBottom = 0;
  6381. if (operationK == 0)
  6382. {
  6383. selectTop = 0;
  6384. selectBottom = this.documentWorkspace.CompositionSurface.Height;
  6385. }
  6386. else if (operationK == 1 || operationK == 2)
  6387. {
  6388. selectTop = - (int)this.pointDiameter / 2;
  6389. selectBottom = this.documentWorkspace.CompositionSurface.Height + (int)this.pointDiameter / 2;
  6390. }
  6391. // 点在图片内
  6392. if (point1.Y >= selectTop && point1.Y <= selectBottom)
  6393. {
  6394. // 添加测量点
  6395. if (operationK == 0)
  6396. {
  6397. // 线条数为三
  6398. if (this.linesNumber == 3)
  6399. {
  6400. // 在线条上添加测量点
  6401. if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing + this.lineWidth / 2
  6402. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineWidth / 2)
  6403. {
  6404. // 可绘制的点数
  6405. if (pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6406. {
  6407. // 创建用于绘制测量点的矩形
  6408. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6409. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6410. this.saveSuccess = true;
  6411. }
  6412. pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6413. if (pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6414. pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6415. }
  6416. // 在线条上添加测量点
  6417. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineWidth / 2
  6418. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineWidth / 2)
  6419. {
  6420. // 可绘制的点数
  6421. if (pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6422. {
  6423. // 创建用于绘制测量点的矩形
  6424. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6425. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6426. this.saveSuccess = true;
  6427. }
  6428. pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6429. if (pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6430. pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6431. }
  6432. // 在线条上添加测量点
  6433. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineWidth / 2
  6434. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.lineWidth / 2)
  6435. {
  6436. // 可绘制的点数
  6437. if (pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6438. {
  6439. // 创建用于绘制测量点的矩形
  6440. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6441. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6442. this.saveSuccess = true;
  6443. }
  6444. pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6445. if (pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6446. pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6447. }
  6448. }
  6449. // 线条数为四
  6450. else if (this.linesNumber == 4)
  6451. {
  6452. // 在线条上添加测量点
  6453. if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2 + this.lineWidth / 2
  6454. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2 - this.lineWidth / 2)
  6455. {
  6456. // 可绘制的点数
  6457. if (pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6458. {
  6459. // 创建用于绘制测量点的矩形
  6460. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6461. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6462. this.saveSuccess = true;
  6463. }
  6464. pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6465. if (pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6466. pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6467. }
  6468. // 在线条上添加测量点
  6469. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 + this.lineWidth / 2
  6470. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 - this.lineWidth / 2)
  6471. {
  6472. // 可绘制的点数
  6473. if (pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6474. {
  6475. // 创建用于绘制测量点的矩形
  6476. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6477. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6478. this.saveSuccess = true;
  6479. }
  6480. pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6481. if (pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6482. pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6483. }
  6484. // 在线条上添加测量点
  6485. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 + this.lineWidth / 2
  6486. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 - this.lineWidth / 2)
  6487. {
  6488. // 可绘制的点数
  6489. if (pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6490. {
  6491. // 创建用于绘制测量点的矩形
  6492. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6493. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6494. this.saveSuccess = true;
  6495. }
  6496. pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6497. if (pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6498. pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6499. }
  6500. // 在线条上添加测量点
  6501. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 + this.lineWidth / 2
  6502. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 - this.lineWidth / 2)
  6503. {
  6504. // 可绘制的点数
  6505. if (pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6506. {
  6507. // 创建用于绘制测量点的矩形
  6508. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6509. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6510. this.saveSuccess = true;
  6511. }
  6512. pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6513. if (pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6514. pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6515. }
  6516. }
  6517. // 线条数为五
  6518. else if (this.linesNumber == 5)
  6519. {
  6520. // 在线条上添加测量点
  6521. if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing + this.lineWidth / 2
  6522. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing - this.lineWidth / 2)
  6523. {
  6524. // 可绘制的点数
  6525. if (pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6526. {
  6527. // 创建用于绘制测量点的矩形
  6528. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6529. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6530. this.saveSuccess = true;
  6531. }
  6532. pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6533. if (pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6534. pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6535. }
  6536. // 在线条上添加测量点
  6537. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing + this.lineWidth / 2
  6538. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineWidth / 2)
  6539. {
  6540. // 可绘制的点数
  6541. if (pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6542. {
  6543. // 创建用于绘制测量点的矩形
  6544. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6545. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6546. this.saveSuccess = true;
  6547. }
  6548. pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6549. if (pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6550. pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6551. }
  6552. // 在线条上添加测量点
  6553. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineWidth / 2
  6554. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineWidth / 2)
  6555. {
  6556. // 可绘制的点数
  6557. if (pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6558. {
  6559. // 创建用于绘制测量点的矩形
  6560. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6561. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6562. this.saveSuccess = true;
  6563. }
  6564. pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6565. if (pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6566. pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6567. }
  6568. // 在线条上添加测量点
  6569. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineWidth / 2
  6570. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.lineWidth / 2)
  6571. {
  6572. // 可绘制的点数
  6573. if (pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6574. {
  6575. // 创建用于绘制测量点的矩形
  6576. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6577. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6578. this.saveSuccess = true;
  6579. }
  6580. pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6581. if (pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6582. pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6583. }
  6584. // 在线条上添加测量点
  6585. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing + this.lineWidth / 2
  6586. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing - this.lineWidth / 2)
  6587. {
  6588. // 可绘制的点数
  6589. if (pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6590. {
  6591. // 创建用于绘制测量点的矩形
  6592. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6593. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6594. this.saveSuccess = true;
  6595. }
  6596. pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6597. if (pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6598. pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6599. }
  6600. }
  6601. }
  6602. // 选择测量点
  6603. else if (operationK == 1)
  6604. {
  6605. for (int i = 0; i < this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count; i++)
  6606. {
  6607. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Contains(point1))
  6608. {
  6609. m_canMove = true;
  6610. selected = i;
  6611. this.m_StartPoint = point1;
  6612. }
  6613. }
  6614. }
  6615. // 删除测量点
  6616. else if (operationK == 2)
  6617. {
  6618. int count = this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count;
  6619. // 循环测量点矩形集合
  6620. for (int i = count - 1; i >= 0; i--)
  6621. {
  6622. // 线条数为三
  6623. if (this.linesNumber == 3)
  6624. {
  6625. // 鼠标在矩形内
  6626. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Contains(point1))
  6627. {
  6628. // 第一条线
  6629. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2)
  6630. {
  6631. pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6632. if (pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6633. pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6634. }
  6635. // 第二条线
  6636. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2
  6637. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2)
  6638. {
  6639. pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6640. if (pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6641. pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6642. }
  6643. // 第三条线
  6644. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2)
  6645. {
  6646. pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6647. if (pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6648. pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6649. }
  6650. // 删除选择的矩形
  6651. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].RemoveAt(i);
  6652. this.saveSuccess = true;
  6653. break;
  6654. }
  6655. }
  6656. // 线条数为四
  6657. else if (this.linesNumber == 4)
  6658. {
  6659. // 鼠标在矩形内
  6660. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Contains(point1))
  6661. {
  6662. // 第一条线
  6663. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing)
  6664. {
  6665. pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6666. if (pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6667. pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6668. }
  6669. // 第二条线
  6670. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2
  6671. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing)
  6672. {
  6673. pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6674. if (pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6675. pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6676. }
  6677. // 第三条线
  6678. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing
  6679. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2)
  6680. {
  6681. pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6682. if (pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6683. pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6684. }
  6685. // 第四条线
  6686. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing)
  6687. {
  6688. pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6689. if (pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6690. pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6691. }
  6692. // 删除选择的矩形
  6693. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].RemoveAt(i);
  6694. this.saveSuccess = true;
  6695. break;
  6696. }
  6697. }
  6698. // 线条数为五
  6699. else if (this.linesNumber == 5)
  6700. {
  6701. // 鼠标在矩形内
  6702. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Contains(point1))
  6703. {
  6704. // 第一条线
  6705. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2)
  6706. {
  6707. pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6708. if (pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6709. pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6710. }
  6711. // 第二条线
  6712. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2
  6713. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2)
  6714. {
  6715. pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6716. if (pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6717. pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6718. }
  6719. // 第三条线
  6720. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2
  6721. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2)
  6722. {
  6723. pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6724. if (pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6725. pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6726. }
  6727. // 第四条线
  6728. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2
  6729. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2)
  6730. {
  6731. pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6732. if (pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6733. pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6734. }
  6735. // 第五条线
  6736. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2)
  6737. {
  6738. pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6739. if (pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6740. pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6741. }
  6742. // 删除选择的矩形
  6743. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].RemoveAt(i);
  6744. this.saveSuccess = true;
  6745. break;
  6746. }
  6747. }
  6748. }
  6749. }
  6750. }
  6751. this.documentWorkspace.Refresh();
  6752. }
  6753. /// <summary>
  6754. /// 选择测量点移动
  6755. /// </summary>
  6756. /// <param name="sender"></param>
  6757. /// <param name="e"></param>
  6758. private void onMouseMove(object sender, MouseEventArgs e)
  6759. {
  6760. // 换算后的点
  6761. PointF point1 = documentWorkspace.GetScalePoint(e.Location);
  6762. if (e.Button == MouseButtons.Left && m_canMove)
  6763. {
  6764. RectangleF rectangleF = new RectangleF();
  6765. rectangleF = this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][selected];
  6766. // 矩形偏移
  6767. rectangleF.Offset(0, point1.Y - this.m_StartPoint.Y);
  6768. if (rectangleF.Bottom > this.documentWorkspace.CompositionSurface.Height + rectangleF.Height / 2)
  6769. rectangleF.Y = this.documentWorkspace.CompositionSurface.Height - rectangleF.Height + rectangleF.Height / 2;
  6770. if (rectangleF.Top < - rectangleF.Height / 2)
  6771. rectangleF.Y = - rectangleF.Height / 2;
  6772. if (point1.Y <= this.documentWorkspace.CompositionSurface.Height && point1.Y >= 0)
  6773. this.m_StartPoint = point1;
  6774. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][selected] = rectangleF;
  6775. this.saveSuccess = true;
  6776. this.documentWorkspace.Refresh();
  6777. }
  6778. }
  6779. /// <summary>
  6780. /// 鼠标抬起(测量点不可移动)
  6781. /// </summary>
  6782. /// <param name="sender"></param>
  6783. /// <param name="e"></param>
  6784. private void onMouseUp(object sender, MouseEventArgs e)
  6785. {
  6786. m_canMove = false;
  6787. }
  6788. /// <summary>
  6789. /// 添加测量点
  6790. /// </summary>
  6791. /// <param name="sender"></param>
  6792. /// <param name="e"></param>
  6793. private void button6_Click(object sender, EventArgs e)
  6794. {
  6795. if (dataGridView1.SelectedRows.Count == 0)
  6796. return;
  6797. operationK = 0;
  6798. selected = -1;
  6799. this.documentWorkspace.Refresh();
  6800. }
  6801. /// <summary>
  6802. /// 失去焦点
  6803. /// </summary>
  6804. /// <param name="sender"></param>
  6805. /// <param name="e"></param>
  6806. private void button6_LostFocus(object sender, EventArgs e)
  6807. {
  6808. operationK = -1;
  6809. selected = -1;
  6810. this.documentWorkspace.Refresh();
  6811. }
  6812. /// <summary>
  6813. /// 失去焦点
  6814. /// </summary>
  6815. /// <param name="sender"></param>
  6816. /// <param name="e"></param>
  6817. private void button7_LostFocus(object sender, EventArgs e)
  6818. {
  6819. operationK = -1;
  6820. selected = -1;
  6821. this.documentWorkspace.Refresh();
  6822. }
  6823. /// <summary>
  6824. /// 失去焦点
  6825. /// </summary>
  6826. /// <param name="sender"></param>
  6827. /// <param name="e"></param>
  6828. private void button8_LostFocus(object sender, EventArgs e)
  6829. {
  6830. operationK = -1;
  6831. selected = -1;
  6832. this.documentWorkspace.Refresh();
  6833. }
  6834. /// <summary>
  6835. /// 选择测量点
  6836. /// </summary>
  6837. /// <param name="sender"></param>
  6838. /// <param name="e"></param>
  6839. private void button8_Click(object sender, EventArgs e)
  6840. {
  6841. if (dataGridView1.SelectedRows.Count == 0)
  6842. return;
  6843. operationK = 1;
  6844. }
  6845. /// <summary>
  6846. /// 删除测量点
  6847. /// </summary>
  6848. /// <param name="sender"></param>
  6849. /// <param name="e"></param>
  6850. private void button7_Click(object sender, EventArgs e)
  6851. {
  6852. if (dataGridView1.SelectedRows.Count == 0)
  6853. return;
  6854. operationK = 2;
  6855. selected = -1;
  6856. this.documentWorkspace.Refresh();
  6857. }
  6858. /// <summary>
  6859. /// 辅助线样式设置
  6860. /// </summary>
  6861. /// <param name="sender"></param>
  6862. /// <param name="e"></param>
  6863. private void button9_Click(object sender, EventArgs e)
  6864. {
  6865. GuideStyleSettingsDialog guideStyleSettingsDialog = new GuideStyleSettingsDialog(this.lineChange);
  6866. guideStyleSettingsDialog.StartPosition = FormStartPosition.CenterScreen;
  6867. guideStyleSettingsDialog.ShowDialog(this);
  6868. }
  6869. /// <summary>
  6870. /// 测量点样式设置
  6871. /// </summary>
  6872. /// <param name="sender"></param>
  6873. /// <param name="e"></param>
  6874. private void button10_Click(object sender, EventArgs e)
  6875. {
  6876. SurveyPointStyleSettingDialog surveyPointStyleSettingDialog = new SurveyPointStyleSettingDialog();
  6877. surveyPointStyleSettingDialog.StartPosition = FormStartPosition.CenterScreen;
  6878. surveyPointStyleSettingDialog.ShowDialog(this);
  6879. }
  6880. /// <summary>
  6881. /// 从XML获取数据
  6882. /// </summary>
  6883. private void GetDataFromXML()
  6884. {
  6885. workpieceMaintenanceModel = XmlSerializeHelper.DESerializer<WorkpieceMaintenanceModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkpieceMaintenanceModel.xml", FileMode.Open));
  6886. // 工件类型
  6887. this.type = string.Empty;
  6888. if (workpieceMaintenanceModel.Workpieces != null && this.comboBox1.DataSource != null)
  6889. {
  6890. for (int i = 0; i < workpieceMaintenanceModel.Workpieces.Count; i++)
  6891. {
  6892. if (workpieceMaintenanceModel.Workpieces[i].Name.Equals(this.comboBox1.SelectedValue))
  6893. this.type = workpieceMaintenanceModel.Workpieces[i].Type;
  6894. }
  6895. if (this.type.Equals(constTypeA))
  6896. pointDrawCount = 3;
  6897. else if (this.type.Equals(constTypeB))
  6898. pointDrawCount = 4;
  6899. else if (this.type.Equals(constTypeC))
  6900. pointDrawCount = 5;
  6901. else if (this.type.Equals(constTypeD))
  6902. pointDrawCount = 6;
  6903. else if (this.type.Equals(constTypeE))
  6904. pointDrawCount = 4;
  6905. }
  6906. }
  6907. /// <summary>
  6908. /// 选择样品更改
  6909. /// </summary>
  6910. /// <param name="sender"></param>
  6911. /// <param name="e"></param>
  6912. private void dataGridView1_SelectionChanged(object sender, EventArgs e)
  6913. {
  6914. if (this.dataGridView1.SelectedCells.Count > 0)
  6915. {
  6916. int dataTableIndex = 0;
  6917. for (int i = 0; i < this.pointDataTables.Count; i++)
  6918. {
  6919. if (this.pointDataTables[i].TableName.Equals(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value))
  6920. dataTableIndex = i;
  6921. }
  6922. if (this.pointDataTables[dataTableIndex].Rows.Count > 0)
  6923. {
  6924. this.dataGridView2.Rows.Clear();
  6925. this.dataGridView3.Rows.Clear();
  6926. for (int r = 0; r < this.pointDataTables[dataTableIndex].Rows.Count; r++)
  6927. {
  6928. DataGridViewRow dgvr = new DataGridViewRow();
  6929. DataGridViewRow dgvr1 = new DataGridViewRow();
  6930. foreach (DataGridViewColumn Column in this.dataGridView2.Columns)
  6931. {
  6932. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  6933. dgvr1.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  6934. }
  6935. for (int c = 0; c < this.pointDataTables[dataTableIndex].Columns.Count; c++)
  6936. {
  6937. if(c > 1 && !this.pointDataTables[dataTableIndex].Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(this.pointDataTables[dataTableIndex].Rows[r][c].ToString()))
  6938. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pointDataTables[dataTableIndex].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  6939. else
  6940. dgvr.Cells[c].Value = this.pointDataTables[dataTableIndex].Rows[r][c].ToString();
  6941. dgvr1.Cells[c].Value = this.pointDataTables[dataTableIndex].Rows[r][c].ToString();
  6942. }
  6943. this.dataGridView2.Rows.Add(dgvr);
  6944. this.dataGridView3.Rows.Add(dgvr1);
  6945. }
  6946. int left;
  6947. int right;
  6948. string leftValue;
  6949. string rightValue;
  6950. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  6951. {
  6952. left = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("%");
  6953. right = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("-");
  6954. leftValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(0, left);
  6955. rightValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(right + 1);
  6956. if (this.dataGridView2.Rows[i].Cells[2].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6957. || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[2].Value.ToString())
  6958. && !this.dataGridView2.Rows[i].Cells[2].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6959. && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[2].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6960. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[2].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))))
  6961. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6962. if (this.dataGridView2.Rows[i].Cells[3].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6963. || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[3].Value.ToString())
  6964. && !this.dataGridView2.Rows[i].Cells[3].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6965. && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[3].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6966. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[3].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))))
  6967. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6968. if (this.dataGridView2.Rows[i].Cells[4].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6969. || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[4].Value.ToString())
  6970. && !this.dataGridView2.Rows[i].Cells[4].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6971. && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[4].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6972. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[4].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))))
  6973. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6974. if (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[7].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6975. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[7].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6976. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = Color.Red;
  6977. if (this.linesNumber == 4)
  6978. {
  6979. if (this.dataGridView2.Rows[i].Cells[5].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6980. || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[5].Value.ToString())
  6981. && !this.dataGridView2.Rows[i].Cells[5].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6982. && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[5].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6983. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[5].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))))
  6984. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red;
  6985. }
  6986. else if (this.linesNumber == 5)
  6987. {
  6988. if (this.dataGridView2.Rows[i].Cells[5].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6989. || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[5].Value.ToString())
  6990. && !this.dataGridView2.Rows[i].Cells[5].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6991. && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[5].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6992. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[5].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))))
  6993. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red;
  6994. if (this.dataGridView2.Rows[i].Cells[6].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6995. || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[6].Value.ToString())
  6996. && !this.dataGridView2.Rows[i].Cells[6].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6997. && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[6].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6998. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[6].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))))
  6999. this.dataGridView2.Rows[i].Cells[6].Style.BackColor = Color.Red;
  7000. }
  7001. }
  7002. }
  7003. this.documentWorkspace.Refresh();
  7004. }
  7005. }
  7006. /// <summary>
  7007. /// 显示测量点间距
  7008. /// </summary>
  7009. /// <param name="sender"></param>
  7010. /// <param name="e"></param>
  7011. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  7012. {
  7013. this.documentWorkspace.Refresh();
  7014. }
  7015. private void dataGridView3_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  7016. {
  7017. int dataTableIndex = 0;
  7018. if (this.dataGridView3.Rows.Count > 0)
  7019. {
  7020. for (int i = 0; i < this.pointDataTables.Count; i++)
  7021. {
  7022. if (this.pointDataTables[i].TableName.Equals(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value))
  7023. dataTableIndex = i;
  7024. }
  7025. this.pointDataTables[dataTableIndex].Rows.Clear();
  7026. for (int r = 0; r < this.dataGridView3.Rows.Count; r++)
  7027. {
  7028. DataRow dataRow = this.pointDataTables[dataTableIndex].NewRow();
  7029. for (int c = 0; c < this.dataGridView3.Rows[r].Cells.Count; c++)
  7030. {
  7031. dataRow[this.dataGridView3.Columns[c].Name] = this.dataGridView3.Rows[r].Cells[c].Value;
  7032. }
  7033. this.pointDataTables[dataTableIndex].Rows.Add(dataRow);
  7034. }
  7035. }
  7036. }
  7037. /// <summary>
  7038. /// 单元格修改验证
  7039. /// </summary>
  7040. /// <param name="sender"></param>
  7041. /// <param name="e"></param>
  7042. private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  7043. {
  7044. if(e.RowIndex >= 0)
  7045. {
  7046. string newValue = this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
  7047. for (int i = 0; i < dataGridView1.Rows.Count; i++)
  7048. {
  7049. if (i != e.RowIndex && newValue.Equals(this.dataGridView1.Rows[i].Cells[0].Value.ToString()))
  7050. {
  7051. MessageBox.Show(PdnResources.GetString("Menu.Namealreadyexists.text")+"!");
  7052. this.dataGridView1.Rows[e.RowIndex].Cells[0].Value = oldValue;
  7053. return;
  7054. }
  7055. }
  7056. foreach (DataTable item in this.pointDataTables)
  7057. {
  7058. if (item.TableName.Equals(oldValue))
  7059. item.TableName = newValue;
  7060. }
  7061. this.saveSuccess = true;
  7062. }
  7063. }
  7064. /// <summary>
  7065. /// 获取单元格修改之前的值
  7066. /// </summary>
  7067. /// <param name="sender"></param>
  7068. /// <param name="e"></param>
  7069. private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
  7070. {
  7071. oldValue = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
  7072. }
  7073. /// <summary>
  7074. /// 保存结果
  7075. /// </summary>
  7076. /// <param name="sender"></param>
  7077. /// <param name="e"></param>
  7078. private void button2_Click(object sender, EventArgs e)
  7079. {
  7080. SaveMeasurementResults();
  7081. }
  7082. /// <summary>
  7083. /// 保存结果
  7084. /// </summary>
  7085. private void SaveMeasurementResults()
  7086. {
  7087. if (this.listView1.SelectedItems.Count > 0)
  7088. {
  7089. string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
  7090. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
  7091. if (this.button3.Visible)
  7092. {
  7093. MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!");
  7094. return;
  7095. }
  7096. if (this.pointDataTables.Count > 0)
  7097. {
  7098. DataTable dataTable1 = new DataTable();
  7099. bool replace = false;
  7100. int add = 0;
  7101. foreach (ListViewItem item in this.listView2.Items)
  7102. {
  7103. if (item.Name.Equals(tag))
  7104. {
  7105. add++;
  7106. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Themeasurementdertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  7107. if (dr == DialogResult.OK)
  7108. {
  7109. replace = true;
  7110. this.listView2.Items.Remove(item);
  7111. }
  7112. break;
  7113. }
  7114. }
  7115. if (replace || this.listView2.Items.Count == 0 || add == 0)
  7116. {
  7117. this.dataGridView4.Rows.Clear();
  7118. if (this.linesNumber == 3)
  7119. {
  7120. this.dataGridView4.Columns[7].Visible = false;
  7121. this.dataGridView4.Columns[8].Visible = false;
  7122. }
  7123. else if (this.linesNumber == 4)
  7124. {
  7125. this.dataGridView4.Columns[7].Visible = true;
  7126. this.dataGridView4.Columns[8].Visible = false;
  7127. }
  7128. else if (this.linesNumber == 5)
  7129. {
  7130. this.dataGridView4.Columns[7].Visible = true;
  7131. this.dataGridView4.Columns[8].Visible = true;
  7132. }
  7133. ListViewItem listViewItem = new ListViewItem();
  7134. listViewItem.Name = tag;
  7135. listViewItem.SubItems[0].Text = imgName;
  7136. listViewItem.Tag = "" + this.linesNumber;
  7137. if (this.listView2.Items.Count == 0)
  7138. this.listView2.Items.Add(listViewItem);
  7139. else
  7140. this.listView2.Items.Insert(0, listViewItem);
  7141. dataTable1.TableName = tag;
  7142. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  7143. {
  7144. dataTable1.Columns.Add(c.HeaderText);
  7145. }
  7146. foreach (DataTable dataTable in this.pointDataTables)
  7147. {
  7148. for (int r = 0; r < dataTable.Rows.Count; r++)
  7149. {
  7150. DataGridViewRow dgvr = new DataGridViewRow();
  7151. dgvr.Tag = tag;
  7152. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7153. {
  7154. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7155. }
  7156. for (int c = 0; c < dataTable.Columns.Count; c++)
  7157. {
  7158. dgvr.Cells[0].Value = imgName;
  7159. dgvr.Cells[1].Value = dataTable.TableName;
  7160. if (c > 1 && !dataTable.Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")))
  7161. {
  7162. if (this.linesNumber == 3)
  7163. {
  7164. if (c + 2 != 7 && c + 2 != 8)
  7165. dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7166. else
  7167. dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString();
  7168. }
  7169. else if (this.linesNumber == 4)
  7170. {
  7171. if (c + 2 != 8)
  7172. dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7173. else
  7174. dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString();
  7175. }
  7176. else if (this.linesNumber == 5)
  7177. {
  7178. dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7179. }
  7180. }
  7181. else
  7182. dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString();
  7183. }
  7184. this.dataGridView4.Rows.Add(dgvr);
  7185. DataRow dataRow = dataTable1.NewRow();
  7186. for (int c = 0; c < dataTable.Columns.Count + 2; c++)
  7187. {
  7188. if (c == 0)
  7189. dataRow[this.dataGridView4.Columns[c].HeaderText] = imgName;
  7190. else if (c == 1)
  7191. dataRow[this.dataGridView4.Columns[c].HeaderText] = dataTable.TableName;
  7192. else
  7193. dataRow[this.dataGridView4.Columns[c].HeaderText] = dataTable.Rows[r][c - 2].ToString();
  7194. }
  7195. dataTable1.Rows.Add(dataRow);
  7196. }
  7197. }
  7198. foreach (DataTable dataTable2 in pictureDataTables)
  7199. {
  7200. if (dataTable2.TableName.Equals(dataTable1.TableName))
  7201. {
  7202. pictureDataTables.Remove(dataTable2);
  7203. break;
  7204. }
  7205. }
  7206. this.pictureDataTables.Add(dataTable1);
  7207. if (this.allShow)
  7208. AllShow();
  7209. this.listView2.Items[0].Selected = true;
  7210. this.saveSuccess = false;
  7211. this.bitDic.Clear();
  7212. foreach (var item in this.bitDic1)
  7213. {
  7214. this.bitDic.Add(item.Key, item.Value);
  7215. }
  7216. //拼接中间数据
  7217. List<List<string>> dataList = new List<List<string>>();
  7218. List<string> columnName = new List<string>();
  7219. columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
  7220. columnName.Add(PdnResources.GetString("Menu.Thesamplename.Text"));
  7221. columnName.Add(PdnResources.GetString("Menu.Theintersectionsofthefirstline.Text"));
  7222. columnName.Add(PdnResources.GetString("Menu.Theintersectionsofthesecondtline.Text"));
  7223. columnName.Add(PdnResources.GetString("Menu.Theintersectionsofthethirdtline.Text"));
  7224. if (this.linesNumber == 4)
  7225. {
  7226. columnName.Add(PdnResources.GetString("Menu.Theintersectionsoftheforthtline.Text"));
  7227. }
  7228. else if (this.linesNumber == 5)
  7229. {
  7230. columnName.Add(PdnResources.GetString("Menu.Theintersectionsoftheforthtline.Text"));
  7231. columnName.Add(PdnResources.GetString("Menu.Theintersectionsofthefivthtline.Text"));
  7232. }
  7233. dataList.Add(columnName);
  7234. string valuesL1 = string.Empty;
  7235. string valuesL2 = string.Empty;
  7236. string valuesL3 = string.Empty;
  7237. string valuesL4 = string.Empty;
  7238. string valuesL5 = string.Empty;
  7239. int valueCt1 = 0;
  7240. int valueCt2 = 0;
  7241. int valueCt3 = 0;
  7242. int valueCt4 = 0;
  7243. int valueCt5 = 0;
  7244. if (this.linesNumber == 3)
  7245. {
  7246. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  7247. {
  7248. valuesL1 = string.Empty;
  7249. valuesL2 = string.Empty;
  7250. valuesL3 = string.Empty;
  7251. List<string> strList = new List<string>();
  7252. strList.Add((i + 1).ToString());
  7253. strList.Add(this.dataGridView1.Rows[i].Cells[0].Value.ToString());
  7254. foreach (var lengthList in this.lengthL1[i])
  7255. {
  7256. if (this.lengthL1[i].Count == 1 || valueCt1 == this.lengthL1[i].Count - 1)
  7257. valuesL1 += lengthList.ToString();
  7258. else
  7259. valuesL1 += lengthList.ToString() + ",";
  7260. valueCt1++;
  7261. }
  7262. foreach (var lengthList in this.lengthL2[i])
  7263. {
  7264. if (this.lengthL2[i].Count == 1 || valueCt2 == this.lengthL2[i].Count - 1)
  7265. valuesL2 += lengthList.ToString();
  7266. else
  7267. valuesL2 += lengthList.ToString() + ",";
  7268. valueCt2++;
  7269. }
  7270. foreach (var lengthList in this.lengthL3[i])
  7271. {
  7272. if (this.lengthL3[i].Count == 1 || valueCt3 == this.lengthL3[i].Count - 1)
  7273. valuesL3 += lengthList.ToString();
  7274. else
  7275. valuesL3 += lengthList.ToString() + ",";
  7276. valueCt3++;
  7277. }
  7278. strList.Add(valuesL1);
  7279. strList.Add(valuesL2);
  7280. strList.Add(valuesL3);
  7281. dataList.Add(strList);
  7282. }
  7283. }
  7284. else if (this.linesNumber == 4)
  7285. {
  7286. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  7287. {
  7288. valuesL1 = string.Empty;
  7289. valuesL2 = string.Empty;
  7290. valuesL3 = string.Empty;
  7291. valuesL4 = string.Empty;
  7292. List<string> strList = new List<string>();
  7293. strList.Add((i + 1).ToString());
  7294. strList.Add(this.dataGridView1.Rows[i].Cells[0].Value.ToString());
  7295. foreach (var lengthList in this.lengthL1[i])
  7296. {
  7297. if (this.lengthL1[i].Count == 1 || valueCt1 == this.lengthL1[i].Count - 1)
  7298. valuesL1 += lengthList.ToString();
  7299. else
  7300. valuesL1 += lengthList.ToString() + ",";
  7301. valueCt1++;
  7302. }
  7303. foreach (var lengthList in this.lengthL2[i])
  7304. {
  7305. if (this.lengthL2[i].Count == 1 || valueCt2 == this.lengthL2[i].Count - 1)
  7306. valuesL2 += lengthList.ToString();
  7307. else
  7308. valuesL2 += lengthList.ToString() + ",";
  7309. valueCt2++;
  7310. }
  7311. foreach (var lengthList in this.lengthL3[i])
  7312. {
  7313. if (this.lengthL3[i].Count == 1 || valueCt3 == this.lengthL3[i].Count - 1)
  7314. valuesL3 += lengthList.ToString();
  7315. else
  7316. valuesL3 += lengthList.ToString() + ",";
  7317. valueCt3++;
  7318. }
  7319. foreach (var lengthList in this.lengthL4[i])
  7320. {
  7321. if (this.lengthL4[i].Count == 1 || valueCt4 == this.lengthL4[i].Count - 1)
  7322. valuesL4 += lengthList.ToString();
  7323. else
  7324. valuesL4 += lengthList.ToString() + ",";
  7325. valueCt4++;
  7326. }
  7327. strList.Add(valuesL1);
  7328. strList.Add(valuesL2);
  7329. strList.Add(valuesL3);
  7330. strList.Add(valuesL4);
  7331. dataList.Add(strList);
  7332. }
  7333. }
  7334. else if(this.linesNumber == 5)
  7335. {
  7336. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  7337. {
  7338. valuesL1 = string.Empty;
  7339. valuesL2 = string.Empty;
  7340. valuesL3 = string.Empty;
  7341. valuesL4 = string.Empty;
  7342. valuesL5 = string.Empty;
  7343. List<string> strList = new List<string>();
  7344. strList.Add((i + 1).ToString());
  7345. strList.Add(this.dataGridView1.Rows[i].Cells[0].Value.ToString());
  7346. foreach (var lengthList in this.lengthL1[i])
  7347. {
  7348. if (this.lengthL1[i].Count == 1 || valueCt1 == this.lengthL1[i].Count - 1)
  7349. valuesL1 += lengthList.ToString();
  7350. else
  7351. valuesL1 += lengthList.ToString() + ",";
  7352. valueCt1++;
  7353. }
  7354. foreach (var lengthList in this.lengthL2[i])
  7355. {
  7356. if (this.lengthL2[i].Count == 1 || valueCt2 == this.lengthL2[i].Count - 1)
  7357. valuesL2 += lengthList.ToString();
  7358. else
  7359. valuesL2 += lengthList.ToString() + ",";
  7360. valueCt2++;
  7361. }
  7362. foreach (var lengthList in this.lengthL3[i])
  7363. {
  7364. if (this.lengthL3[i].Count == 1 || valueCt3 == this.lengthL3[i].Count - 1)
  7365. valuesL3 += lengthList.ToString();
  7366. else
  7367. valuesL3 += lengthList.ToString() + ",";
  7368. valueCt3++;
  7369. }
  7370. foreach (var lengthList in this.lengthL4[i])
  7371. {
  7372. if (this.lengthL4[i].Count == 1 || valueCt4 == this.lengthL4[i].Count - 1)
  7373. valuesL4 += lengthList.ToString();
  7374. else
  7375. valuesL4 += lengthList.ToString() + ",";
  7376. valueCt4++;
  7377. }
  7378. foreach (var lengthList in this.lengthL5[i])
  7379. {
  7380. if (this.lengthL5[i].Count == 1 || valueCt5 == this.lengthL5[i].Count - 1)
  7381. valuesL5 += lengthList.ToString();
  7382. else
  7383. valuesL5 += lengthList.ToString() + ",";
  7384. valueCt5++;
  7385. }
  7386. strList.Add(valuesL1);
  7387. strList.Add(valuesL2);
  7388. strList.Add(valuesL3);
  7389. strList.Add(valuesL4);
  7390. strList.Add(valuesL5);
  7391. dataList.Add(strList);
  7392. }
  7393. }
  7394. bool isExist = false;//是否已存在进行替换
  7395. int modelIndex = -1;//要替换的下标
  7396. for (int j = 0; j < tempDataModel.Count; j++)
  7397. {
  7398. if (tempDataModel[j].tagName.Equals(tag))
  7399. {
  7400. isExist = true;
  7401. modelIndex = j;
  7402. break;
  7403. }
  7404. }
  7405. if (isExist && modelIndex > -1)
  7406. tempDataModel[modelIndex].dataList = dataList;
  7407. else
  7408. {
  7409. ExportProjectModel newModel = new ExportProjectModel();
  7410. newModel.tagName = tag;
  7411. newModel.picName = imgName;
  7412. newModel.dataList = dataList;
  7413. tempDataModel.Add(newModel);
  7414. }
  7415. }
  7416. }
  7417. else
  7418. {
  7419. MessageBox.Show(PdnResources.GetString("Menu.Pleaseaddsamples.text")+"!");
  7420. }
  7421. }
  7422. else
  7423. {
  7424. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapictureandmeasure.text")+"!");
  7425. }
  7426. }
  7427. /// <summary>
  7428. /// 切换测量记录
  7429. /// </summary>
  7430. /// <param name="sender"></param>
  7431. /// <param name="e"></param>
  7432. private void listView_SelectedIndexChanged(object sender, EventArgs e)
  7433. {
  7434. if(!this.allShow)
  7435. {
  7436. if (this.listView2.SelectedItems.Count > 0)
  7437. {
  7438. if(this.listView2.SelectedItems[0].Tag.ToString().Equals("3"))
  7439. {
  7440. this.dataGridView4.Columns[7].Visible = false;
  7441. this.dataGridView4.Columns[8].Visible = false;
  7442. }
  7443. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("4"))
  7444. {
  7445. this.dataGridView4.Columns[7].Visible = true;
  7446. this.dataGridView4.Columns[8].Visible = false;
  7447. }
  7448. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("5"))
  7449. {
  7450. this.dataGridView4.Columns[7].Visible = true;
  7451. this.dataGridView4.Columns[8].Visible = true;
  7452. }
  7453. List<int> dataTableIndex = new List<int>();
  7454. for (int i = 0; i < this.pictureDataTables.Count; i++)
  7455. {
  7456. foreach (ListViewItem item in this.listView2.SelectedItems)
  7457. {
  7458. if (this.pictureDataTables[i].TableName.Equals(item.Name))
  7459. dataTableIndex .Add(i);
  7460. }
  7461. }
  7462. this.dataGridView4.Rows.Clear();
  7463. foreach (var item in dataTableIndex)
  7464. {
  7465. if (this.pictureDataTables[item].Rows.Count > 0)
  7466. {
  7467. for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
  7468. {
  7469. DataGridViewRow dgvr = new DataGridViewRow();
  7470. dgvr.Tag = this.pictureDataTables[item].TableName;
  7471. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7472. {
  7473. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7474. }
  7475. for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
  7476. {
  7477. if (c > 3 && !this.pictureDataTables[item].Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(this.pictureDataTables[item].Rows[r][c].ToString()))
  7478. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c])
  7479. , Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7480. else
  7481. dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
  7482. }
  7483. this.dataGridView4.Rows.Add(dgvr);
  7484. }
  7485. }
  7486. }
  7487. }
  7488. }
  7489. else
  7490. {
  7491. this.dataGridView4.Columns[7].Visible = true;
  7492. this.dataGridView4.Columns[8].Visible = true;
  7493. }
  7494. }
  7495. /// <summary>
  7496. /// 全部显示
  7497. /// </summary>
  7498. /// <param name="sender"></param>
  7499. /// <param name="e"></param>
  7500. private void button11_Click(object sender, EventArgs e)
  7501. {
  7502. this.allShow = true;
  7503. this.button11.Visible = false;
  7504. this.button16.Visible = true;
  7505. AllShow();
  7506. }
  7507. private void AllShow()
  7508. {
  7509. this.dataGridView4.Rows.Clear();
  7510. DataTable dataTable = new DataTable();
  7511. foreach (DataTable item in this.pictureDataTables)
  7512. {
  7513. if (item.Columns.Count == 8)
  7514. {
  7515. this.dataGridView4.Columns[7].Visible = false;
  7516. this.dataGridView4.Columns[8].Visible = false;
  7517. }
  7518. if (item.Columns.Count == 9)
  7519. {
  7520. this.dataGridView4.Columns[7].Visible = true;
  7521. this.dataGridView4.Columns[8].Visible = false;
  7522. }
  7523. if (item.Columns.Count == 10)
  7524. {
  7525. this.dataGridView4.Columns[7].Visible = true;
  7526. this.dataGridView4.Columns[8].Visible = true;
  7527. }
  7528. }
  7529. for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
  7530. {
  7531. dataTable = this.pictureDataTables[i];
  7532. for (int r = 0; r < dataTable.Rows.Count; r++)
  7533. {
  7534. DataGridViewRow dgvr = new DataGridViewRow();
  7535. dgvr.Tag = dataTable.TableName;
  7536. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7537. {
  7538. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7539. }
  7540. for (int c = 0; c < dataTable.Columns.Count; c++)
  7541. {
  7542. if (c > 3 && !dataTable.Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(dataTable.Rows[r][c].ToString()))
  7543. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c])
  7544. , Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7545. else
  7546. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  7547. }
  7548. this.dataGridView4.Rows.Add(dgvr);
  7549. }
  7550. }
  7551. }
  7552. /// <summary>
  7553. /// 取消全部显示
  7554. /// </summary>
  7555. /// <param name="sender"></param>
  7556. /// <param name="e"></param>
  7557. private void button16_Click(object sender, EventArgs e)
  7558. {
  7559. this.allShow = false;
  7560. this.button11.Visible = true;
  7561. this.button16.Visible = false;
  7562. if (this.listView2.SelectedItems.Count > 0)
  7563. {
  7564. if (this.listView2.SelectedItems[0].Tag.ToString().Equals("3"))
  7565. {
  7566. this.dataGridView4.Columns[7].Visible = false;
  7567. this.dataGridView4.Columns[8].Visible = false;
  7568. }
  7569. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("4"))
  7570. {
  7571. this.dataGridView4.Columns[7].Visible = true;
  7572. this.dataGridView4.Columns[8].Visible = false;
  7573. }
  7574. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("5"))
  7575. {
  7576. this.dataGridView4.Columns[7].Visible = true;
  7577. this.dataGridView4.Columns[8].Visible = true;
  7578. }
  7579. List<int> dataTableIndex = new List<int>();
  7580. for (int i = 0; i < this.pictureDataTables.Count; i++)
  7581. {
  7582. foreach (ListViewItem item in this.listView2.SelectedItems)
  7583. {
  7584. if (this.pictureDataTables[i].TableName.Equals(item.Name))
  7585. dataTableIndex.Add(i);
  7586. }
  7587. }
  7588. this.dataGridView4.Rows.Clear();
  7589. foreach (var item in dataTableIndex)
  7590. {
  7591. if (this.pictureDataTables[item].Rows.Count > 0)
  7592. {
  7593. for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
  7594. {
  7595. DataGridViewRow dgvr = new DataGridViewRow();
  7596. dgvr.Tag = this.pictureDataTables[item].TableName;
  7597. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7598. {
  7599. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7600. }
  7601. for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
  7602. {
  7603. if (c > 3 && !this.pictureDataTables[item].Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(this.pictureDataTables[item].Rows[r][c].ToString()))
  7604. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c])
  7605. , Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7606. else
  7607. dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
  7608. }
  7609. this.dataGridView4.Rows.Add(dgvr);
  7610. }
  7611. }
  7612. }
  7613. }
  7614. else
  7615. {
  7616. this.listView2.Items[0].Selected = true;
  7617. if (this.pictureDataTables.Count > 0
  7618. && this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count > 0)
  7619. {
  7620. this.dataGridView4.Rows.Clear();
  7621. for (int r = 0; r < this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count; r++)
  7622. {
  7623. DataGridViewRow dgvr = new DataGridViewRow();
  7624. dgvr.Tag = this.pictureDataTables[this.pictureDataTables.Count - 1].TableName;
  7625. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7626. {
  7627. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7628. }
  7629. for (int c = 0; c < this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count; c++)
  7630. {
  7631. if (c > 3 && !this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c].ToString()))
  7632. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c])
  7633. , Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7634. else
  7635. dgvr.Cells[c].Value = this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c].ToString();
  7636. }
  7637. this.dataGridView4.Rows.Add(dgvr);
  7638. }
  7639. }
  7640. }
  7641. }
  7642. /// <summary>
  7643. /// 导出结果Excel
  7644. /// </summary>
  7645. /// <param name="sender"></param>
  7646. /// <param name="e"></param>
  7647. private void button14_Click(object sender, EventArgs e)
  7648. {
  7649. if(this.listView2.Items.Count > 0)
  7650. {
  7651. SaveFileDialog exe = new SaveFileDialog();
  7652. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  7653. exe.FilterIndex = 0;
  7654. exe.RestoreDirectory = true;
  7655. exe.Title = "Export Excel File";
  7656. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  7657. exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + PdnResources.GetString("Menu.DedicatedAnalysis.NonferrousMetal.RecombinationRate.Text")+ PdnResources.GetString("Menu.Analysisresult.text");
  7658. DialogResult dr = exe.ShowDialog();
  7659. if (dr == DialogResult.OK)
  7660. {
  7661. DataTable dtb = new DataTable();
  7662. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  7663. {
  7664. dtb.Columns.Add(c.HeaderText);
  7665. }
  7666. for (int r = 0; r < this.dataGridView4.Rows.Count; r++)
  7667. {
  7668. DataRow dataRow = dtb.NewRow();
  7669. for (int c = 0; c < this.dataGridView4.Rows[r].Cells.Count; c++)
  7670. {
  7671. dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView4.Rows[r].Cells[c].Value;
  7672. }
  7673. dtb.Rows.Add(dataRow);
  7674. }
  7675. List<DataTable> list = new List<DataTable>();
  7676. list.Add(dtb);
  7677. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
  7678. }
  7679. }
  7680. else
  7681. {
  7682. MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
  7683. }
  7684. }
  7685. /// <summary>
  7686. /// 小数
  7687. /// </summary>
  7688. /// <param name="sender"></param>
  7689. /// <param name="e"></param>
  7690. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  7691. {
  7692. this.decimalCls = (int)this.numericUpDown1.Value;
  7693. this.documentWorkspace.Refresh();
  7694. RefreshDataGridView4();
  7695. }
  7696. /// <summary>
  7697. /// 分析结果删除
  7698. /// </summary>
  7699. /// <param name="sender"></param>
  7700. /// <param name="e"></param>
  7701. private void button12_Click(object sender, EventArgs e)
  7702. {
  7703. if(this.listView2.Items.Count > 0)
  7704. {
  7705. if (this.listView2.SelectedItems.Count > 0)
  7706. {
  7707. if (this.listView2.SelectedItems[0].Tag.ToString().Equals("3"))
  7708. {
  7709. this.dataGridView4.Columns[7].Visible = false;
  7710. this.dataGridView4.Columns[8].Visible = false;
  7711. }
  7712. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("4"))
  7713. {
  7714. this.dataGridView4.Columns[7].Visible = true;
  7715. this.dataGridView4.Columns[8].Visible = false;
  7716. }
  7717. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("5"))
  7718. {
  7719. this.dataGridView4.Columns[7].Visible = true;
  7720. this.dataGridView4.Columns[8].Visible = true;
  7721. }
  7722. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethisanalysisresult.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  7723. if (dr == DialogResult.OK)
  7724. {
  7725. List<string> detaleName = new List<string>();
  7726. int selectIndex = this.listView2.SelectedItems[0].Index;
  7727. foreach (ListViewItem item in this.listView2.SelectedItems)
  7728. {
  7729. detaleName.Add(item.Name.ToString());
  7730. this.listView2.Items.Remove(item);
  7731. }
  7732. foreach (string item in detaleName)
  7733. {
  7734. foreach (DataTable dataTable in this.pictureDataTables)
  7735. {
  7736. if (dataTable.TableName.Equals(item))
  7737. {
  7738. this.pictureDataTables.Remove(dataTable);
  7739. break;
  7740. }
  7741. }
  7742. }
  7743. foreach (string tag in detaleName)
  7744. {
  7745. for (int i = 0; i < bitDic.Count; i++)
  7746. {
  7747. foreach (var item in bitDic)
  7748. {
  7749. string keyDe = item.Key.Substring(0, item.Key.IndexOf("|"));
  7750. if (tag.Equals(keyDe))
  7751. {
  7752. bitDic.Remove(item.Key);
  7753. break;
  7754. }
  7755. }
  7756. }
  7757. foreach (ExportProjectModel model in this.tempDataModel)
  7758. {
  7759. if (model.tagName.Equals(tag))
  7760. {
  7761. this.tempDataModel.Remove(model);
  7762. break;
  7763. }
  7764. }
  7765. }
  7766. if (this.listView2.Items.Count > 0)
  7767. {
  7768. if(selectIndex == 0)
  7769. this.listView2.Items[0].Selected = true;
  7770. else
  7771. this.listView2.Items[selectIndex - 1].Selected = true;
  7772. RefreshDataGridView4();
  7773. }
  7774. else
  7775. {
  7776. this.dataGridView4.Rows.Clear();
  7777. }
  7778. }
  7779. }
  7780. else
  7781. {
  7782. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheanalysisresulttodelete.text")+"!");
  7783. }
  7784. }
  7785. else
  7786. {
  7787. MessageBox.Show(PdnResources.GetString("Menu.Nodataintheanalysisresults.text")+"!");
  7788. }
  7789. }
  7790. /// <summary>
  7791. /// 刷新分析结果数据
  7792. /// </summary>
  7793. private void RefreshDataGridView4()
  7794. {
  7795. if (!this.allShow)
  7796. {
  7797. if (this.listView2.SelectedItems.Count > 0)
  7798. {
  7799. if (this.listView2.SelectedItems[0].Tag.ToString().Equals("3"))
  7800. {
  7801. this.dataGridView4.Columns[7].Visible = false;
  7802. this.dataGridView4.Columns[8].Visible = false;
  7803. }
  7804. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("4"))
  7805. {
  7806. this.dataGridView4.Columns[7].Visible = true;
  7807. this.dataGridView4.Columns[8].Visible = false;
  7808. }
  7809. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("5"))
  7810. {
  7811. this.dataGridView4.Columns[7].Visible = true;
  7812. this.dataGridView4.Columns[8].Visible = true;
  7813. }
  7814. List<int> dataTableIndex = new List<int>();
  7815. for (int i = 0; i < this.pictureDataTables.Count; i++)
  7816. {
  7817. foreach (ListViewItem item in this.listView2.SelectedItems)
  7818. {
  7819. if (this.pictureDataTables[i].TableName.Equals(item.Name))
  7820. dataTableIndex.Add(i);
  7821. }
  7822. }
  7823. this.dataGridView4.Rows.Clear();
  7824. foreach (var item in dataTableIndex)
  7825. {
  7826. if (this.pictureDataTables[item].Rows.Count > 0)
  7827. {
  7828. for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
  7829. {
  7830. DataGridViewRow dgvr = new DataGridViewRow();
  7831. dgvr.Tag = this.pictureDataTables[item].TableName;
  7832. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7833. {
  7834. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7835. }
  7836. for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
  7837. {
  7838. if (c > 3 && !this.pictureDataTables[item].Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(this.pictureDataTables[item].Rows[r][c].ToString()))
  7839. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c])
  7840. , Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7841. else
  7842. dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
  7843. }
  7844. this.dataGridView4.Rows.Add(dgvr);
  7845. }
  7846. }
  7847. }
  7848. }
  7849. }
  7850. else
  7851. {
  7852. this.dataGridView4.Rows.Clear();
  7853. DataTable dataTable = new DataTable();
  7854. for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
  7855. {
  7856. dataTable = this.pictureDataTables[i];
  7857. for (int r = 0; r < dataTable.Rows.Count; r++)
  7858. {
  7859. DataGridViewRow dgvr = new DataGridViewRow();
  7860. dgvr.Tag = dataTable.TableName;
  7861. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7862. {
  7863. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7864. }
  7865. for (int c = 0; c < dataTable.Columns.Count; c++)
  7866. {
  7867. if (c > 3 && !dataTable.Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(dataTable.Rows[r][c].ToString()))
  7868. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c])
  7869. , Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7870. else
  7871. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  7872. }
  7873. this.dataGridView4.Rows.Add(dgvr);
  7874. }
  7875. }
  7876. }
  7877. }
  7878. /// <summary>
  7879. /// 生成报告
  7880. /// </summary>
  7881. /// <param name="sender"></param>
  7882. /// <param name="e"></param>
  7883. private void button13_Click(object sender, EventArgs e)
  7884. {
  7885. if (this.checkBox2.Checked)
  7886. {
  7887. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.RecombinationRate");
  7888. if (recombinationRateSetDialog.hasModule)
  7889. {
  7890. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  7891. recombinationRateSetDialog.ShowDialog();
  7892. }
  7893. else
  7894. {
  7895. recombinationRateSetDialog = null;
  7896. }
  7897. }
  7898. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  7899. {
  7900. //获取word书签与excel单元格的关系,以字典方式存储
  7901. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  7902. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  7903. if (mic_module_infos != null && mic_module_infos.Count > 0)
  7904. {
  7905. foreach (mic_module_infos info in mic_module_infos)
  7906. {
  7907. tagInfos.Add(info.tag_name, info.cell_position);
  7908. }
  7909. }
  7910. List<List<string>> analysisContent = new List<List<string>>();
  7911. if (this.linesNumber == 3)
  7912. {
  7913. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  7914. {
  7915. List<string> content1 = new List<string>();
  7916. if(i == 0)
  7917. {
  7918. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  7919. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  7920. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  7921. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  7922. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  7923. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  7924. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  7925. content1.Add(this.dataGridView4.Columns[9].HeaderText);
  7926. analysisContent.Add(content1);
  7927. }
  7928. content1 = new List<string>();
  7929. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  7930. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  7931. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  7932. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  7933. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  7934. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  7935. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  7936. content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
  7937. analysisContent.Add(content1);
  7938. }
  7939. }
  7940. else if (this.linesNumber == 4)
  7941. {
  7942. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  7943. {
  7944. List<string> content1 = new List<string>();
  7945. if (i == 0)
  7946. {
  7947. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  7948. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  7949. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  7950. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  7951. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  7952. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  7953. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  7954. content1.Add(this.dataGridView4.Columns[7].HeaderText);
  7955. content1.Add(this.dataGridView4.Columns[9].HeaderText);
  7956. analysisContent.Add(content1);
  7957. }
  7958. content1 = new List<string>();
  7959. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  7960. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  7961. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  7962. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  7963. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  7964. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  7965. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  7966. content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString());
  7967. content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
  7968. analysisContent.Add(content1);
  7969. }
  7970. }
  7971. else if (this.linesNumber == 5)
  7972. {
  7973. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  7974. {
  7975. List<string> content1 = new List<string>();
  7976. if (i == 0)
  7977. {
  7978. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  7979. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  7980. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  7981. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  7982. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  7983. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  7984. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  7985. content1.Add(this.dataGridView4.Columns[7].HeaderText);
  7986. content1.Add(this.dataGridView4.Columns[8].HeaderText);
  7987. content1.Add(this.dataGridView4.Columns[9].HeaderText);
  7988. analysisContent.Add(content1);
  7989. }
  7990. content1 = new List<string>();
  7991. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  7992. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  7993. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  7994. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  7995. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  7996. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  7997. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  7998. content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString());
  7999. content1.Add(this.dataGridView4.Rows[i].Cells[8].Value.ToString());
  8000. content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
  8001. analysisContent.Add(content1);
  8002. }
  8003. }
  8004. bitList = new List<Bitmap>();
  8005. if (this.allShow)
  8006. {
  8007. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  8008. {
  8009. bitList.Add(kv.Value[0]);
  8010. bitList.Add(kv.Value[1]);
  8011. }
  8012. }
  8013. else
  8014. {
  8015. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  8016. {
  8017. foreach (DataGridViewRow itemRow in this.dataGridView4.Rows)
  8018. {
  8019. foreach (ListViewItem item in this.listView2.SelectedItems)
  8020. {
  8021. if (bitDic.ContainsKey(item.Name + "|" + itemRow.Cells[1].Value.ToString()) && itemRow.Tag.Equals(item.Name))
  8022. {
  8023. bitList.Add(bitDic[item.Name + "|" + itemRow.Cells[1].Value.ToString()][0]);
  8024. bitList.Add(bitDic[item.Name + "|" + itemRow.Cells[1].Value.ToString()][1]);
  8025. }
  8026. }
  8027. }
  8028. }
  8029. }
  8030. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  8031. }
  8032. else
  8033. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  8034. }
  8035. private void listView2_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
  8036. {
  8037. if(!this.allShow)
  8038. {
  8039. if (this.listView2.SelectedItems.Count == 0)
  8040. this.dataGridView4.Rows.Clear();
  8041. }
  8042. }
  8043. /// <summary>
  8044. /// 不可点击空白区域
  8045. /// </summary>
  8046. /// <param name="sender"></param>
  8047. /// <param name="e"></param>
  8048. private void listView1_MouseUp(object sender, MouseEventArgs e)
  8049. {
  8050. if (e.Button == MouseButtons.Left)
  8051. {
  8052. if (listView1.SelectedItems.Count > 0)
  8053. {
  8054. }
  8055. else if (listView1.SelectedItems.Count <= 0)//点击空白区
  8056. {
  8057. if (this.listView1.FocusedItem != null)
  8058. {
  8059. ListViewItem item = this.listView1.GetItemAt(e.X, e.Y);
  8060. if (item == null)
  8061. {
  8062. this.listView1.FocusedItem.Selected = true;
  8063. }
  8064. }
  8065. }
  8066. }
  8067. }
  8068. /// <summary>
  8069. /// 导出项目
  8070. /// </summary>
  8071. /// <param name="sender"></param>
  8072. /// <param name="e"></param>
  8073. private void button17_Click(object sender, EventArgs e)
  8074. {
  8075. try
  8076. {
  8077. if (this.analyzeSettingModel == null)
  8078. {
  8079. MessageBox.Show(PdnResources.GetString("Menu.Settheexporteitemfirst.Text"));
  8080. return;
  8081. }
  8082. //获取项目工程内的文件夹路径
  8083. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.NonferrousMetal.RecombinationRate.Text", this.analyzeSettingModel.savePath);
  8084. if (item != null)
  8085. {
  8086. //向文件夹内保存图片和报告
  8087. if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  8088. {
  8089. //获取word书签与excel单元格的关系,以字典方式存储
  8090. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  8091. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  8092. if (mic_module_infos != null && mic_module_infos.Count > 0)
  8093. {
  8094. foreach (mic_module_infos info in mic_module_infos)
  8095. {
  8096. tagInfos.Add(info.tag_name, info.cell_position);
  8097. }
  8098. }
  8099. //分析结果
  8100. List<List<string>> analysisContent = new List<List<string>>();
  8101. if (this.linesNumber == 3)
  8102. {
  8103. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  8104. {
  8105. List<string> content1 = new List<string>();
  8106. if (i == 0)
  8107. {
  8108. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  8109. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  8110. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  8111. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  8112. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  8113. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  8114. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  8115. content1.Add(this.dataGridView4.Columns[9].HeaderText);
  8116. analysisContent.Add(content1);
  8117. }
  8118. content1 = new List<string>();
  8119. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  8120. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  8121. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  8122. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  8123. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  8124. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  8125. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  8126. content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
  8127. analysisContent.Add(content1);
  8128. }
  8129. }
  8130. else if (this.linesNumber == 4)
  8131. {
  8132. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  8133. {
  8134. List<string> content1 = new List<string>();
  8135. if (i == 0)
  8136. {
  8137. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  8138. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  8139. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  8140. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  8141. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  8142. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  8143. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  8144. content1.Add(this.dataGridView4.Columns[7].HeaderText);
  8145. content1.Add(this.dataGridView4.Columns[9].HeaderText);
  8146. analysisContent.Add(content1);
  8147. }
  8148. content1 = new List<string>();
  8149. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  8150. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  8151. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  8152. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  8153. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  8154. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  8155. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  8156. content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString());
  8157. content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
  8158. analysisContent.Add(content1);
  8159. }
  8160. }
  8161. else if (this.linesNumber == 5)
  8162. {
  8163. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  8164. {
  8165. List<string> content1 = new List<string>();
  8166. if (i == 0)
  8167. {
  8168. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  8169. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  8170. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  8171. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  8172. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  8173. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  8174. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  8175. content1.Add(this.dataGridView4.Columns[7].HeaderText);
  8176. content1.Add(this.dataGridView4.Columns[8].HeaderText);
  8177. content1.Add(this.dataGridView4.Columns[9].HeaderText);
  8178. analysisContent.Add(content1);
  8179. }
  8180. content1 = new List<string>();
  8181. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  8182. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  8183. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  8184. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  8185. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  8186. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  8187. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  8188. content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString());
  8189. content1.Add(this.dataGridView4.Rows[i].Cells[8].Value.ToString());
  8190. content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
  8191. analysisContent.Add(content1);
  8192. }
  8193. }
  8194. //图片
  8195. bitList = new List<Bitmap>();
  8196. if (this.allShow)
  8197. {
  8198. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  8199. {
  8200. bitList.Add(kv.Value[0]);
  8201. bitList.Add(kv.Value[1]);
  8202. }
  8203. }
  8204. else
  8205. {
  8206. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  8207. {
  8208. foreach (DataGridViewRow itemRow in this.dataGridView4.Rows)
  8209. {
  8210. foreach (ListViewItem itemL2 in this.listView2.SelectedItems)
  8211. {
  8212. if (bitDic.ContainsKey(itemL2.Name + "|" + itemRow.Cells[1].Value.ToString()))
  8213. {
  8214. bitList.Add(bitDic[itemL2.Name + "|" + itemRow.Cells[1].Value.ToString()][0]);
  8215. bitList.Add(bitDic[itemL2.Name + "|" + itemRow.Cells[1].Value.ToString()][1]);
  8216. }
  8217. }
  8218. }
  8219. }
  8220. }
  8221. //中间数据
  8222. if (!this.allShow)
  8223. {
  8224. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  8225. {
  8226. List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
  8227. foreach (ListViewItem rowItem in this.listView2.SelectedItems)
  8228. {
  8229. foreach (ExportProjectModel model in this.tempDataModel)
  8230. {
  8231. if (model.tagName.Equals(rowItem.Name))
  8232. {
  8233. ExportProjectModel tempModel = new ExportProjectModel();
  8234. tempModel.tagName = model.tagName;
  8235. tempModel.picName = model.picName;
  8236. tempModel.dataList = model.dataList;
  8237. exportModel.Add(tempModel);
  8238. break;
  8239. }
  8240. }
  8241. }
  8242. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);
  8243. }
  8244. }
  8245. else
  8246. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, item.path, item.code);
  8247. }
  8248. else
  8249. {
  8250. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  8251. return;
  8252. }
  8253. //保存项目信息到数据库
  8254. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  8255. }
  8256. }
  8257. catch (Exception)
  8258. {
  8259. }
  8260. }
  8261. #region 参数保存及提取
  8262. /// <summary>
  8263. /// 保存参数的key,value和type
  8264. /// </summary>
  8265. /// <param name="param_key"></param>
  8266. /// <param name="param_value"></param>
  8267. /// <param name="param_type"></param>
  8268. private void saveParamValue(string param_key, string param_value, int param_type)
  8269. {
  8270. bool foundItem = false;
  8271. foreach (var item in this.analysisModel.ListParam)
  8272. {
  8273. if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
  8274. {
  8275. item.param_value = param_value;
  8276. item.setValue();
  8277. foundItem = true;
  8278. break;
  8279. }
  8280. }
  8281. if (!foundItem)
  8282. {
  8283. GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
  8284. analysisItem.menuId = this.menuId;
  8285. analysisItem.param_key = param_key;
  8286. analysisItem.param_type = param_type;
  8287. analysisItem.param_value = param_value;
  8288. analysisItem.setValue();
  8289. this.analysisModel.ListParam.Add(analysisItem);
  8290. }
  8291. }
  8292. /// <summary>
  8293. /// 保存界面中的参数到model
  8294. /// </summary>
  8295. private void saveDialogParamValues()
  8296. {
  8297. saveParamValue(ParamKey_ShowData, checkBox1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//显示数据
  8298. saveParamValue(ParamKey_Report, checkBox2.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//报告设置
  8299. saveParamValue(ParamKey_DecimalPlace, numericUpDown1 != null ? numericUpDown1.Value.ToString() : "", (int)Base.Dtryt.Decimal);//保留小数位数
  8300. }
  8301. /// <summary>
  8302. /// 获取保存的参数
  8303. /// </summary>
  8304. private void GetListParamModel()
  8305. {
  8306. if (this.analysisModel != null)
  8307. {
  8308. for (int i = 0; i < this.analysisModel.ListParam.Count; i++)
  8309. {
  8310. switch (this.analysisModel.ListParam[i].param_key)
  8311. {
  8312. case ParamKey_ShowData:
  8313. checkBox1.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  8314. break;
  8315. case ParamKey_Report:
  8316. checkBox2.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  8317. break;
  8318. case ParamKey_DecimalPlace:
  8319. numericUpDown1.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
  8320. break;
  8321. }
  8322. }
  8323. }
  8324. }
  8325. /// <summary>
  8326. /// 关闭窗体时保存参数
  8327. /// </summary>
  8328. /// <param name="sender"></param>
  8329. /// <param name="e"></param>
  8330. private void RecombinationRateDialog_FormClosing(object sender, FormClosingEventArgs e)
  8331. {
  8332. #region [开启脚本录制]
  8333. if (appWorkspace.startScriptRecording)
  8334. {
  8335. getScriptRecording();
  8336. }
  8337. #endregion
  8338. this.saveDialogParamValues();
  8339. //xml保存路径
  8340. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  8341. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  8342. foreach (var analysisItem in this.analysisModel.ListParam)
  8343. {
  8344. bool foundItem = false;
  8345. foreach (var item in analysisModelXml.ListParam)
  8346. {
  8347. if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
  8348. {
  8349. item.param_value = analysisItem.param_value;
  8350. foundItem = true;
  8351. break;
  8352. }
  8353. }
  8354. if (!foundItem)
  8355. analysisModelXml.ListParam.Add(analysisItem.cloneModel());
  8356. }
  8357. //按路径和名称保存xml文件
  8358. string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
  8359. //保存xml
  8360. FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
  8361. }
  8362. #endregion
  8363. #region [脚本相关]
  8364. private void getValue(string key, object value)
  8365. {
  8366. switch (key)
  8367. {
  8368. case "parameter1":
  8369. checkBox1.Checked = Convert.ToBoolean(value);
  8370. break;
  8371. case "OpenWhileExportReport":
  8372. checkBox2.Checked = Convert.ToBoolean(value);
  8373. break;
  8374. case "CalculatorDecimalDigits":
  8375. numericUpDown1.Value = Convert.ToDecimal(value);
  8376. break;
  8377. }
  8378. }
  8379. #endregion
  8380. #region [脚本录制]
  8381. private void getScriptRecording()
  8382. {
  8383. string className = InvariantData.path_Action + ".Action" + menuId;
  8384. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  8385. List<Args> args = param.Lists;
  8386. foreach (var item in args)
  8387. {
  8388. item.value = setScriptRecording(item.key);
  8389. }
  8390. appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
  8391. }
  8392. private object setScriptRecording(string key)
  8393. {
  8394. object value = null;
  8395. switch (key)
  8396. {
  8397. case "parameter1":
  8398. value = checkBox1.Checked;
  8399. break;
  8400. case "OpenWhileExportReport":
  8401. value = checkBox2.Checked;
  8402. break;
  8403. case "CalculatorDecimalDigits":
  8404. value = numericUpDown1.Value;
  8405. break;
  8406. }
  8407. return value;
  8408. }
  8409. #endregion
  8410. }
  8411. }