RecombinationRateDialog.cs 573 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531
  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. /// 图像面板
  213. /// </summary>
  214. private DocumentWorkspaceWindow documentWorkspace;
  215. private Dictionary<int, DocumentItem> documentItems;
  216. /// <summary>
  217. /// 公共按钮
  218. /// </summary>
  219. private CommonControlButtons commonControlButtons;
  220. private Button button15;
  221. /// <summary>
  222. /// 保存用于生成报告的图片
  223. /// </summary>
  224. private List<Bitmap> bitList;
  225. /// <summary>
  226. /// 储存点击保存结果后的所有原图与分析图
  227. /// </summary>
  228. private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
  229. private Dictionary<string, List<Bitmap>> bitDic1 = new Dictionary<string, List<Bitmap>>();
  230. private int changeCount;
  231. /// <summary>
  232. /// 工件类型
  233. /// </summary>
  234. private const string constTypeA = "a";
  235. private const string constTypeB = "b";
  236. private const string constTypeC = "c";
  237. private const string constTypeD = "d";
  238. private const string constTypeE = "e";
  239. /// <summary>
  240. /// 单位
  241. /// </summary>
  242. private double unitLength;
  243. /// <summary>
  244. /// 中间数据
  245. /// </summary>
  246. private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
  247. /// <summary>
  248. /// 第一条线的各点截距
  249. /// </summary>
  250. private List<List<decimal>> lengthL1 = new List<List<decimal>>();
  251. /// <summary>
  252. /// 第二条线的各点截距
  253. /// </summary>
  254. private List<List<decimal>> lengthL2 = new List<List<decimal>>();
  255. /// <summary>
  256. /// 第三条线的各点截距
  257. /// </summary>
  258. private List<List<decimal>> lengthL3 = new List<List<decimal>>();
  259. /// <summary>
  260. /// 第四条线的各点截距
  261. /// </summary>
  262. private List<List<decimal>> lengthL4 = new List<List<decimal>>();
  263. /// <summary>
  264. /// 第五条线的各点截距
  265. /// </summary>
  266. private List<List<decimal>> lengthL5 = new List<List<decimal>>();
  267. private Button button16;
  268. private NumericUpDown numericUpDown1;
  269. private ListView listView2;
  270. private DataGridView dataGridView3;
  271. private Button button17;
  272. private DataGridViewTextBoxColumn Column1;
  273. private DataGridViewTextBoxColumn Column2;
  274. private DataGridViewTextBoxColumn Column3;
  275. private DataGridViewTextBoxColumn Column4;
  276. private DataGridViewTextBoxColumn Column5;
  277. private DataGridViewTextBoxColumn Column6;
  278. private DataGridViewTextBoxColumn Column7;
  279. private DataGridViewTextBoxColumn Column8;
  280. private DataGridViewTextBoxColumn Column9;
  281. private DataGridViewTextBoxColumn Column10;
  282. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
  283. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
  284. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
  285. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
  286. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
  287. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
  288. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
  289. private DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;
  290. private DataGridViewTextBoxColumn pointName;
  291. private DataGridViewTextBoxColumn pointDeviation;
  292. private DataGridViewTextBoxColumn pointL1;
  293. private DataGridViewTextBoxColumn pointL2;
  294. private DataGridViewTextBoxColumn pointL3;
  295. private DataGridViewTextBoxColumn pointL4;
  296. private DataGridViewTextBoxColumn pointL5;
  297. private DataGridViewTextBoxColumn pointAverage;
  298. private DataGridViewTextBoxColumn nname;
  299. private DataGridViewTextBoxColumn explain;
  300. private DataGridViewTextBoxColumn operation;
  301. private DataGridViewTextBoxColumn Column11;
  302. private WorkpieceMaintenanceModel workpieceMaintenanceModel = new WorkpieceMaintenanceModel();
  303. private int defaultIndex = -1;
  304. private int menuId;
  305. private string menuName;
  306. /// <summary>
  307. /// 是否脚本运行
  308. /// </summary>
  309. private Boolean initScriptValues = false;
  310. // <summary>
  311. /// 保存窗口参数
  312. /// </summary>
  313. private GrainSizeAnalysisModel analysisModel;
  314. private const string ParamKey_ShowData = "showData";//显示数据
  315. private const string ParamKey_Report = "report";//报告设置
  316. private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数
  317. public RecombinationRateDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem)
  318. {
  319. this.menuId = menuItem.MenuId;
  320. this.menuName = menuItem.Text;
  321. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  322. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  323. this.analysisModel = analysisModelXml.cloneListParamModel(this.menuId);
  324. foreach (var item in this.analysisModel.ListParam)
  325. item.setValue();
  326. InitializeComponent();
  327. InitializeLanguageText();
  328. this.button3.Visible = true;
  329. this.button15.Visible = false;
  330. this.button11.Visible = true;
  331. this.button16.Visible = false;
  332. this.appWorkspace = appWorkspace;
  333. //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength);
  334. //
  335. //初始化图像控件
  336. //
  337. this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
  338. this.documentWorkspace.Dock = DockStyle.Fill;
  339. this.documentWorkspace.HookMouseEvents();
  340. this.documentWorkspace.AuxiliaryLineEnabled = false;
  341. this.documentWorkspace.Visible = false;
  342. this.groupBox7.Controls.Add(documentWorkspace);
  343. //
  344. //初始化操作按钮
  345. //
  346. this.commonControlButtons = new CommonControlButtons();
  347. this.commonControlButtons.Dock = DockStyle.Top;
  348. this.commonControlButtons.Height = 30;
  349. this.commonControlButtons.HideZoomToWindowAndActualSize();
  350. this.commonControlButtons.Visible = false;
  351. this.groupBox7.Controls.Add(commonControlButtons);
  352. /// 测量点操作限制
  353. this.button6.Enabled = this.pointDrawkb;
  354. this.button7.Enabled = this.pointDrawkb;
  355. this.button8.Enabled = this.pointDrawkb;
  356. //初始化头
  357. this.listView2.View = View.Details;
  358. ColumnHeader header0 = new ColumnHeader();
  359. header0.Text = "";
  360. header0.Width = 180;
  361. this.listView2.Columns.Add(header0);
  362. documentWorkspace.panel.MouseDown += OnMouseDown;
  363. documentWorkspace.panel.Paint += Panel_Paint;
  364. documentWorkspace.panel.MouseMove += onMouseMove;
  365. documentWorkspace.panel.MouseUp += onMouseUp;
  366. //如果是脚本执行,将参数带入
  367. if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
  368. {
  369. this.initScriptValues = true;//ScriptAutomatic
  370. //Boolean initScriptValues = true;
  371. ////在这里反射出对应功能的参数类
  372. string className = InvariantData.path_Action + ".Action" + menuId;
  373. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  374. foreach (Args arg in param.Lists)
  375. {
  376. Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
  377. if (param1.value != null)
  378. arg.Value = param1.value;
  379. getValue(arg.key, arg.Value);
  380. }
  381. appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
  382. }
  383. else
  384. {//读取上次关闭窗口时保存的参数
  385. GetListParamModel();
  386. }
  387. InitPicList();
  388. RefreshCombobox();
  389. RefreshPanel();
  390. InitCommonButtonEvent();
  391. //SetStyle(ControlStyles.UserPaint, true);
  392. //SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
  393. //SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
  394. SetAnalyzeModelFromXml("Template.Manager.item3.RecombinationRate");
  395. foreach (DataGridViewColumn item in this.dataGridView1.Columns)
  396. {
  397. item.SortMode = DataGridViewColumnSortMode.NotSortable;
  398. }
  399. for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
  400. {
  401. this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  402. }
  403. for (int i = 0; i < this.dataGridView2.Columns.Count; i++)
  404. {
  405. this.dataGridView2.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  406. }
  407. for (int i = 0; i < this.dataGridView3.Columns.Count; i++)
  408. {
  409. this.dataGridView3.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  410. }
  411. for (int i = 0; i < this.dataGridView4.Columns.Count; i++)
  412. {
  413. this.dataGridView4.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
  414. }
  415. }
  416. private void InitCommonButtonEvent()
  417. {
  418. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  419. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  420. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  421. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  422. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  423. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  424. }
  425. private void zoomInButton_Click(object sender, EventArgs e)
  426. {
  427. this.documentWorkspace.ZoomIn();
  428. }
  429. private void zoomOutButton_Click(object sender, EventArgs e)
  430. {
  431. this.documentWorkspace.ZoomOut();
  432. }
  433. private void zoomToWindowButton_Click(object sender, EventArgs e)
  434. {
  435. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  436. }
  437. private void actualSizeButton_Click(object sender, EventArgs e)
  438. {
  439. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  440. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  441. }
  442. private void pointerButton_Click(object sender, EventArgs e)
  443. {
  444. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
  445. }
  446. private void mobileModeButton_Click(object sender, EventArgs e)
  447. {
  448. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  449. }
  450. private void ShowImgEvent(object sender, EventArgs e)
  451. {
  452. listView1.Focus();
  453. if (this.defaultIndex != -1)
  454. {
  455. this.listView1.Items[defaultIndex].Focused = true;
  456. this.listView1.Items[defaultIndex].Selected = true;
  457. }
  458. }
  459. /// <summary>
  460. /// 初始化图片列表数据
  461. /// </summary>
  462. public void InitPicList()
  463. {
  464. this.documentItems = new Dictionary<int, DocumentItem>();
  465. // 构造工作结构
  466. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  467. {
  468. //Bitmap bitmap = this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.CreateAliasedBitmap();
  469. GraphicsList graphicsList = new GraphicsList();
  470. for (int j = 0; j < this.appWorkspace.DocumentWorkspaces[i].GraphicsList.Count; j++)
  471. {
  472. graphicsList.Add(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[j]);
  473. }
  474. List<PhaseModel> phaseModels = new List<PhaseModel>();
  475. //二值化相关
  476. PhaseModel analysisModel = this.appWorkspace.DocumentWorkspaces[i].AnalysisPhaseModel;
  477. if (analysisModel == null)
  478. {
  479. }
  480. else
  481. phaseModels.Add(analysisModel);
  482. this.documentItems.Add(i, new DocumentItem(this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.CreatedAliasedMat().Clone(), graphicsList, phaseModels));
  483. }
  484. //初始化图片列表
  485. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  486. {
  487. this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  488. this.listView1.Items.Add("", i);
  489. this.listView1.Items[i].ImageIndex = i;
  490. this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  491. this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  492. if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
  493. {
  494. defaultIndex = i;
  495. }
  496. }
  497. this.Shown += ShowImgEvent;
  498. }
  499. internal class DocumentItem
  500. {
  501. public Mat imageMat;
  502. public GraphicsList graphicsList;
  503. public List<PhaseModel> phaseModels;
  504. public AnalysisResult analysisResult;
  505. public DocumentItem(Mat imageMat, GraphicsList graphicsList, List<PhaseModel> phaseModels)
  506. {
  507. this.imageMat = imageMat;
  508. this.graphicsList = graphicsList;
  509. this.phaseModels = phaseModels;
  510. }
  511. }
  512. #region 初始化
  513. private void InitializeLanguageText()
  514. {
  515. this.button1.Text = PdnResources.GetString("Menu.Setting.Text");
  516. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  517. this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
  518. this.checkBox2.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  519. this.checkBox1.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.Displaydataontheimage.text");
  520. this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  521. this.groupBox3.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.artifactselect.text");
  522. this.button15.Text = PdnResources.GetString("Menu.Stopmeasure.text");
  523. this.button4.Text = PdnResources.GetString("Menu.Setting.Text");
  524. this.button3.Text = PdnResources.GetString("Menu.Startmeasuring.text");
  525. this.groupBox4.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Samplemaintenance.text");
  526. this.nname.HeaderText = PdnResources.GetString("Menu.name.text");
  527. this.operation.HeaderText = PdnResources.GetString("Menu.operation.text");
  528. this.Column11.HeaderText = PdnResources.GetString("Menu.operation.text");
  529. this.button5.Text = PdnResources.GetString("CommonAction.Save");
  530. this.label2.Text = PdnResources.GetString("Menu.instruction.text") + ":";
  531. this.label1.Text = PdnResources.GetString("Menu.samplename.text") + ":";
  532. this.groupBox5.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Measuringpointrecord.text");
  533. this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.name.text");
  534. this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.Targetvalue/deviation.text");
  535. this.dataGridViewTextBoxColumn8.HeaderText = PdnResources.GetString("Menu.Image.Average.Text") + "%";
  536. this.pointName.HeaderText = PdnResources.GetString("Menu.name.text");
  537. this.pointDeviation.HeaderText = PdnResources.GetString("Menu.Targetvalue/deviation.text");
  538. this.pointAverage.HeaderText = PdnResources.GetString("Menu.Image.Average.Text") + "%";
  539. this.button8.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Selectcompoundnode.text");
  540. this.button7.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Deletecompoundnode.text");
  541. this.button6.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Addcompoundnode.text");
  542. this.groupBox6.Text = PdnResources.GetString("Menu.othersettings.text");
  543. this.button10.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Measurinsetting.text");
  544. this.button9.Text = PdnResources.GetString("Menu.Auxiliarylinesettings.text");
  545. this.groupBox7.Text = PdnResources.GetString("Menu.Preview.text");
  546. this.groupBox8.Text = PdnResources.GetString("Menu.Analysisresult.text");
  547. this.button17.Text = PdnResources.GetString("Menu.Exportproject.text");
  548. this.button16.Text = PdnResources.GetString("Menu.Cancelshowall.text");
  549. this.label5.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
  550. this.button14.Text = PdnResources.GetString("Menu.Exportresults.text");
  551. this.button13.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  552. this.Column1.HeaderText = PdnResources.GetString("Menu.picture.Text");
  553. this.Column2.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.sample.text");
  554. this.Column3.HeaderText = PdnResources.GetString("Menu.name.text");
  555. this.Column4.HeaderText = PdnResources.GetString("Menu.Targetvalue/deviation.text");
  556. this.Column10.HeaderText = PdnResources.GetString("Menu.Image.Average.Text") + "%";
  557. this.button12.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  558. this.button11.Text = PdnResources.GetString("Menu.Showall.text");
  559. this.Text = PdnResources.GetString("Menu.DedicatedAnalysis.NonferrousMetal.RecombinationRate.Text");
  560. this.explain.HeaderText = PdnResources.GetString("Menu.instruction.text");
  561. }
  562. private void InitializeComponent()
  563. {
  564. this.components = new System.ComponentModel.Container();
  565. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
  566. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
  567. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
  568. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
  569. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
  570. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
  571. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
  572. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
  573. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
  574. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
  575. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
  576. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
  577. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
  578. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
  579. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
  580. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
  581. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
  582. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
  583. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
  584. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
  585. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
  586. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
  587. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();
  588. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle();
  589. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle();
  590. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle();
  591. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();
  592. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle();
  593. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle();
  594. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle();
  595. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle();
  596. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle();
  597. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle();
  598. System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle();
  599. this.button1 = new System.Windows.Forms.Button();
  600. this.groupBox1 = new System.Windows.Forms.GroupBox();
  601. this.button2 = new System.Windows.Forms.Button();
  602. this.checkBox2 = new System.Windows.Forms.CheckBox();
  603. this.checkBox1 = new System.Windows.Forms.CheckBox();
  604. this.groupBox2 = new System.Windows.Forms.GroupBox();
  605. this.listView1 = new System.Windows.Forms.ListView();
  606. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  607. this.groupBox3 = new System.Windows.Forms.GroupBox();
  608. this.button15 = new System.Windows.Forms.Button();
  609. this.button4 = new System.Windows.Forms.Button();
  610. this.button3 = new System.Windows.Forms.Button();
  611. this.comboBox1 = new System.Windows.Forms.ComboBox();
  612. this.groupBox4 = new System.Windows.Forms.GroupBox();
  613. this.dataGridView1 = new System.Windows.Forms.DataGridView();
  614. this.nname = new System.Windows.Forms.DataGridViewTextBoxColumn();
  615. this.explain = new System.Windows.Forms.DataGridViewTextBoxColumn();
  616. this.operation = new System.Windows.Forms.DataGridViewTextBoxColumn();
  617. this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  618. this.button5 = new System.Windows.Forms.Button();
  619. this.textBox2 = new System.Windows.Forms.TextBox();
  620. this.textBox1 = new System.Windows.Forms.TextBox();
  621. this.label2 = new System.Windows.Forms.Label();
  622. this.label1 = new System.Windows.Forms.Label();
  623. this.groupBox5 = new System.Windows.Forms.GroupBox();
  624. this.dataGridView3 = new System.Windows.Forms.DataGridView();
  625. this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  626. this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  627. this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  628. this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  629. this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  630. this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  631. this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  632. this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  633. this.dataGridView2 = new System.Windows.Forms.DataGridView();
  634. this.pointName = new System.Windows.Forms.DataGridViewTextBoxColumn();
  635. this.pointDeviation = new System.Windows.Forms.DataGridViewTextBoxColumn();
  636. this.pointL1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  637. this.pointL2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  638. this.pointL3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  639. this.pointL4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  640. this.pointL5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  641. this.pointAverage = new System.Windows.Forms.DataGridViewTextBoxColumn();
  642. this.button8 = new System.Windows.Forms.Button();
  643. this.button7 = new System.Windows.Forms.Button();
  644. this.button6 = new System.Windows.Forms.Button();
  645. this.groupBox6 = new System.Windows.Forms.GroupBox();
  646. this.button10 = new System.Windows.Forms.Button();
  647. this.button9 = new System.Windows.Forms.Button();
  648. this.groupBox7 = new System.Windows.Forms.GroupBox();
  649. this.groupBox8 = new System.Windows.Forms.GroupBox();
  650. this.button17 = new System.Windows.Forms.Button();
  651. this.listView2 = new System.Windows.Forms.ListView();
  652. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  653. this.button16 = new System.Windows.Forms.Button();
  654. this.label5 = new System.Windows.Forms.Label();
  655. this.button14 = new System.Windows.Forms.Button();
  656. this.button13 = new System.Windows.Forms.Button();
  657. this.dataGridView4 = new System.Windows.Forms.DataGridView();
  658. this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  659. this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  660. this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  661. this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  662. this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  663. this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  664. this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  665. this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  666. this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  667. this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  668. this.button12 = new System.Windows.Forms.Button();
  669. this.button11 = new System.Windows.Forms.Button();
  670. this.groupBox1.SuspendLayout();
  671. this.groupBox2.SuspendLayout();
  672. this.groupBox3.SuspendLayout();
  673. this.groupBox4.SuspendLayout();
  674. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
  675. this.groupBox5.SuspendLayout();
  676. ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit();
  677. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
  678. this.groupBox6.SuspendLayout();
  679. this.groupBox8.SuspendLayout();
  680. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  681. ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).BeginInit();
  682. this.SuspendLayout();
  683. //
  684. // button1
  685. //
  686. this.button1.BackColor = System.Drawing.SystemColors.Control;
  687. this.button1.Location = new System.Drawing.Point(15, 14);
  688. this.button1.Name = "button1";
  689. this.button1.Size = new System.Drawing.Size(84, 30);
  690. this.button1.TabIndex = 0;
  691. this.button1.UseVisualStyleBackColor = false;
  692. this.button1.Click += new System.EventHandler(this.button1_Click);
  693. //
  694. // groupBox1
  695. //
  696. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  697. | System.Windows.Forms.AnchorStyles.Right)));
  698. this.groupBox1.Controls.Add(this.button2);
  699. this.groupBox1.Controls.Add(this.checkBox2);
  700. this.groupBox1.Controls.Add(this.checkBox1);
  701. this.groupBox1.Controls.Add(this.button1);
  702. this.groupBox1.Location = new System.Drawing.Point(14, 3);
  703. this.groupBox1.Name = "groupBox1";
  704. this.groupBox1.Size = new System.Drawing.Size(1081, 50);
  705. this.groupBox1.TabIndex = 1;
  706. this.groupBox1.TabStop = false;
  707. //
  708. // button2
  709. //
  710. this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  711. this.button2.BackColor = System.Drawing.SystemColors.Control;
  712. this.button2.Location = new System.Drawing.Point(985, 14);
  713. this.button2.Name = "button2";
  714. this.button2.Size = new System.Drawing.Size(84, 30);
  715. this.button2.TabIndex = 3;
  716. this.button2.UseVisualStyleBackColor = false;
  717. this.button2.Click += new System.EventHandler(this.button2_Click);
  718. //
  719. // checkBox2
  720. //
  721. this.checkBox2.AutoSize = true;
  722. this.checkBox2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
  723. this.checkBox2.Location = new System.Drawing.Point(288, 25);
  724. this.checkBox2.Name = "checkBox2";
  725. this.checkBox2.Size = new System.Drawing.Size(15, 14);
  726. this.checkBox2.TabIndex = 2;
  727. this.checkBox2.UseVisualStyleBackColor = true;
  728. //
  729. // checkBox1
  730. //
  731. this.checkBox1.AutoSize = true;
  732. this.checkBox1.Location = new System.Drawing.Point(114, 25);
  733. this.checkBox1.MaximumSize = new System.Drawing.Size(200, 200);
  734. this.checkBox1.Name = "checkBox1";
  735. this.checkBox1.Size = new System.Drawing.Size(15, 14);
  736. this.checkBox1.TabIndex = 1;
  737. this.checkBox1.UseVisualStyleBackColor = true;
  738. this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
  739. //
  740. // groupBox2
  741. //
  742. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  743. | System.Windows.Forms.AnchorStyles.Left)));
  744. this.groupBox2.Controls.Add(this.listView1);
  745. this.groupBox2.Location = new System.Drawing.Point(14, 59);
  746. this.groupBox2.Name = "groupBox2";
  747. this.groupBox2.Size = new System.Drawing.Size(135, 497);
  748. this.groupBox2.TabIndex = 2;
  749. this.groupBox2.TabStop = false;
  750. //
  751. // listView1
  752. //
  753. this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  754. | System.Windows.Forms.AnchorStyles.Left)
  755. | System.Windows.Forms.AnchorStyles.Right)));
  756. this.listView1.HideSelection = false;
  757. this.listView1.LargeImageList = this.imageList1;
  758. this.listView1.Location = new System.Drawing.Point(5, 17);
  759. this.listView1.MultiSelect = false;
  760. this.listView1.Name = "listView1";
  761. this.listView1.Size = new System.Drawing.Size(124, 474);
  762. this.listView1.TabIndex = 0;
  763. this.listView1.UseCompatibleStateImageBehavior = false;
  764. this.listView1.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView1_ItemSelectionChanged);
  765. this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
  766. this.listView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDown);
  767. this.listView1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseUp);
  768. //
  769. // imageList1
  770. //
  771. this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  772. this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
  773. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  774. //
  775. // groupBox3
  776. //
  777. this.groupBox3.Controls.Add(this.button15);
  778. this.groupBox3.Controls.Add(this.button4);
  779. this.groupBox3.Controls.Add(this.button3);
  780. this.groupBox3.Controls.Add(this.comboBox1);
  781. this.groupBox3.Location = new System.Drawing.Point(153, 59);
  782. this.groupBox3.Name = "groupBox3";
  783. this.groupBox3.Size = new System.Drawing.Size(356, 51);
  784. this.groupBox3.TabIndex = 4;
  785. this.groupBox3.TabStop = false;
  786. //
  787. // button15
  788. //
  789. this.button15.BackColor = System.Drawing.SystemColors.Control;
  790. this.button15.Location = new System.Drawing.Point(195, 15);
  791. this.button15.Name = "button15";
  792. this.button15.Size = new System.Drawing.Size(106, 26);
  793. this.button15.TabIndex = 6;
  794. this.button15.UseVisualStyleBackColor = false;
  795. this.button15.Click += new System.EventHandler(this.button15_Click);
  796. //
  797. // button4
  798. //
  799. this.button4.BackColor = System.Drawing.SystemColors.Control;
  800. this.button4.Location = new System.Drawing.Point(302, 15);
  801. this.button4.Name = "button4";
  802. this.button4.Size = new System.Drawing.Size(53, 26);
  803. this.button4.TabIndex = 5;
  804. this.button4.UseVisualStyleBackColor = false;
  805. this.button4.Click += new System.EventHandler(this.button4_Click);
  806. //
  807. // button3
  808. //
  809. this.button3.BackColor = System.Drawing.SystemColors.Control;
  810. this.button3.Location = new System.Drawing.Point(195, 15);
  811. this.button3.Name = "button3";
  812. this.button3.Size = new System.Drawing.Size(106, 26);
  813. this.button3.TabIndex = 4;
  814. this.button3.UseVisualStyleBackColor = false;
  815. this.button3.Click += new System.EventHandler(this.button3_Click);
  816. //
  817. // comboBox1
  818. //
  819. this.comboBox1.FormattingEnabled = true;
  820. this.comboBox1.Location = new System.Drawing.Point(16, 17);
  821. this.comboBox1.Name = "comboBox1";
  822. this.comboBox1.Size = new System.Drawing.Size(173, 20);
  823. this.comboBox1.TabIndex = 0;
  824. //
  825. // groupBox4
  826. //
  827. this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  828. | System.Windows.Forms.AnchorStyles.Left)));
  829. this.groupBox4.Controls.Add(this.dataGridView1);
  830. this.groupBox4.Controls.Add(this.button5);
  831. this.groupBox4.Controls.Add(this.textBox2);
  832. this.groupBox4.Controls.Add(this.textBox1);
  833. this.groupBox4.Controls.Add(this.label2);
  834. this.groupBox4.Controls.Add(this.label1);
  835. this.groupBox4.Location = new System.Drawing.Point(153, 116);
  836. this.groupBox4.Name = "groupBox4";
  837. this.groupBox4.Size = new System.Drawing.Size(356, 168);
  838. this.groupBox4.TabIndex = 5;
  839. this.groupBox4.TabStop = false;
  840. //
  841. // dataGridView1
  842. //
  843. this.dataGridView1.AllowUserToAddRows = false;
  844. this.dataGridView1.AllowUserToResizeColumns = false;
  845. this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  846. | System.Windows.Forms.AnchorStyles.Left)));
  847. this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  848. dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  849. dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
  850. dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F);
  851. dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
  852. dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  853. dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  854. dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  855. this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
  856. this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  857. this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  858. this.nname,
  859. this.explain,
  860. this.operation,
  861. this.Column11});
  862. this.dataGridView1.Location = new System.Drawing.Point(6, 46);
  863. this.dataGridView1.MultiSelect = false;
  864. this.dataGridView1.Name = "dataGridView1";
  865. this.dataGridView1.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;
  866. this.dataGridView1.RowHeadersVisible = false;
  867. this.dataGridView1.RowTemplate.Height = 23;
  868. this.dataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
  869. this.dataGridView1.Size = new System.Drawing.Size(340, 116);
  870. this.dataGridView1.TabIndex = 7;
  871. this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick);
  872. this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvData_CellContentClick);
  873. this.dataGridView1.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_CellMouseClick);
  874. this.dataGridView1.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridView1_CellValidating);
  875. this.dataGridView1.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellValueChanged);
  876. this.dataGridView1.RowLeave += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_RowLeave);
  877. this.dataGridView1.SelectionChanged += new System.EventHandler(this.dataGridView1_SelectionChanged);
  878. //
  879. // nname
  880. //
  881. dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  882. this.nname.DefaultCellStyle = dataGridViewCellStyle2;
  883. this.nname.FillWeight = 103.5533F;
  884. this.nname.HeaderText = "nname";
  885. this.nname.Name = "nname";
  886. this.nname.Width = 80;
  887. //
  888. // explain
  889. //
  890. dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
  891. this.explain.DefaultCellStyle = dataGridViewCellStyle3;
  892. this.explain.FillWeight = 109.3963F;
  893. this.explain.HeaderText = "explain";
  894. this.explain.Name = "explain";
  895. this.explain.Width = 157;
  896. //
  897. // operation
  898. //
  899. dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  900. this.operation.DefaultCellStyle = dataGridViewCellStyle4;
  901. this.operation.FillWeight = 87.05037F;
  902. this.operation.HeaderText = "operation";
  903. this.operation.Name = "operation";
  904. this.operation.Width = 50;
  905. //
  906. // Column11
  907. //
  908. dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  909. this.Column11.DefaultCellStyle = dataGridViewCellStyle5;
  910. this.Column11.HeaderText = "Column11";
  911. this.Column11.Name = "Column11";
  912. this.Column11.Width = 50;
  913. //
  914. // button5
  915. //
  916. this.button5.BackColor = System.Drawing.SystemColors.Control;
  917. this.button5.Location = new System.Drawing.Point(304, 19);
  918. this.button5.Name = "button5";
  919. this.button5.Size = new System.Drawing.Size(42, 22);
  920. this.button5.TabIndex = 6;
  921. this.button5.UseVisualStyleBackColor = false;
  922. this.button5.Click += new System.EventHandler(this.button5_Click);
  923. //
  924. // textBox2
  925. //
  926. this.textBox2.Location = new System.Drawing.Point(166, 19);
  927. this.textBox2.Name = "textBox2";
  928. this.textBox2.Size = new System.Drawing.Size(135, 21);
  929. this.textBox2.TabIndex = 3;
  930. //
  931. // textBox1
  932. //
  933. this.textBox1.Location = new System.Drawing.Point(65, 19);
  934. this.textBox1.Name = "textBox1";
  935. this.textBox1.Size = new System.Drawing.Size(60, 21);
  936. this.textBox1.TabIndex = 2;
  937. //
  938. // label2
  939. //
  940. this.label2.AutoSize = true;
  941. this.label2.Location = new System.Drawing.Point(127, 24);
  942. this.label2.Name = "label2";
  943. this.label2.Size = new System.Drawing.Size(0, 12);
  944. this.label2.TabIndex = 1;
  945. //
  946. // label1
  947. //
  948. this.label1.AutoSize = true;
  949. this.label1.Location = new System.Drawing.Point(4, 24);
  950. this.label1.Name = "label1";
  951. this.label1.Size = new System.Drawing.Size(0, 12);
  952. this.label1.TabIndex = 0;
  953. //
  954. // groupBox5
  955. //
  956. this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  957. this.groupBox5.Controls.Add(this.dataGridView3);
  958. this.groupBox5.Controls.Add(this.dataGridView2);
  959. this.groupBox5.Controls.Add(this.button8);
  960. this.groupBox5.Controls.Add(this.button7);
  961. this.groupBox5.Controls.Add(this.button6);
  962. this.groupBox5.Location = new System.Drawing.Point(153, 290);
  963. this.groupBox5.Name = "groupBox5";
  964. this.groupBox5.Size = new System.Drawing.Size(356, 201);
  965. this.groupBox5.TabIndex = 6;
  966. this.groupBox5.TabStop = false;
  967. //
  968. // dataGridView3
  969. //
  970. this.dataGridView3.AllowUserToAddRows = false;
  971. this.dataGridView3.AllowUserToResizeColumns = false;
  972. this.dataGridView3.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  973. dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  974. dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control;
  975. dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 9F);
  976. dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText;
  977. dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  978. dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  979. dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  980. this.dataGridView3.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6;
  981. this.dataGridView3.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  982. this.dataGridView3.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  983. this.dataGridViewTextBoxColumn1,
  984. this.dataGridViewTextBoxColumn2,
  985. this.dataGridViewTextBoxColumn3,
  986. this.dataGridViewTextBoxColumn4,
  987. this.dataGridViewTextBoxColumn5,
  988. this.dataGridViewTextBoxColumn6,
  989. this.dataGridViewTextBoxColumn7,
  990. this.dataGridViewTextBoxColumn8});
  991. this.dataGridView3.Location = new System.Drawing.Point(6, 52);
  992. this.dataGridView3.Name = "dataGridView3";
  993. this.dataGridView3.ReadOnly = true;
  994. this.dataGridView3.RowHeadersVisible = false;
  995. this.dataGridView3.RowTemplate.Height = 23;
  996. this.dataGridView3.Size = new System.Drawing.Size(340, 143);
  997. this.dataGridView3.TabIndex = 10;
  998. this.dataGridView3.Visible = false;
  999. this.dataGridView3.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView3_CellValueChanged);
  1000. //
  1001. // dataGridViewTextBoxColumn1
  1002. //
  1003. dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1004. this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle7;
  1005. this.dataGridViewTextBoxColumn1.FillWeight = 199.6873F;
  1006. this.dataGridViewTextBoxColumn1.HeaderText = "dataGridViewTextBoxColumn1";
  1007. this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
  1008. this.dataGridViewTextBoxColumn1.ReadOnly = true;
  1009. this.dataGridViewTextBoxColumn1.Width = 84;
  1010. //
  1011. // dataGridViewTextBoxColumn2
  1012. //
  1013. dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1014. this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle8;
  1015. this.dataGridViewTextBoxColumn2.FillWeight = 154.1869F;
  1016. this.dataGridViewTextBoxColumn2.HeaderText = "dataGridViewTextBoxColumn2";
  1017. this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
  1018. this.dataGridViewTextBoxColumn2.ReadOnly = true;
  1019. this.dataGridViewTextBoxColumn2.Width = 150;
  1020. //
  1021. // dataGridViewTextBoxColumn3
  1022. //
  1023. dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1024. this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle9;
  1025. this.dataGridViewTextBoxColumn3.FillWeight = 68.40062F;
  1026. this.dataGridViewTextBoxColumn3.HeaderText = "L1%";
  1027. this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
  1028. this.dataGridViewTextBoxColumn3.ReadOnly = true;
  1029. this.dataGridViewTextBoxColumn3.Width = 29;
  1030. //
  1031. // dataGridViewTextBoxColumn4
  1032. //
  1033. dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1034. this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle10;
  1035. this.dataGridViewTextBoxColumn4.FillWeight = 70.44655F;
  1036. this.dataGridViewTextBoxColumn4.HeaderText = "L2%";
  1037. this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
  1038. this.dataGridViewTextBoxColumn4.ReadOnly = true;
  1039. this.dataGridViewTextBoxColumn4.Width = 30;
  1040. //
  1041. // dataGridViewTextBoxColumn5
  1042. //
  1043. dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1044. this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle11;
  1045. this.dataGridViewTextBoxColumn5.FillWeight = 72.72363F;
  1046. this.dataGridViewTextBoxColumn5.HeaderText = "L3%";
  1047. this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
  1048. this.dataGridViewTextBoxColumn5.ReadOnly = true;
  1049. this.dataGridViewTextBoxColumn5.Width = 30;
  1050. //
  1051. // dataGridViewTextBoxColumn6
  1052. //
  1053. dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1054. this.dataGridViewTextBoxColumn6.DefaultCellStyle = dataGridViewCellStyle12;
  1055. this.dataGridViewTextBoxColumn6.FillWeight = 75.25803F;
  1056. this.dataGridViewTextBoxColumn6.HeaderText = "L4%";
  1057. this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
  1058. this.dataGridViewTextBoxColumn6.ReadOnly = true;
  1059. this.dataGridViewTextBoxColumn6.Width = 32;
  1060. //
  1061. // dataGridViewTextBoxColumn7
  1062. //
  1063. dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1064. this.dataGridViewTextBoxColumn7.DefaultCellStyle = dataGridViewCellStyle13;
  1065. this.dataGridViewTextBoxColumn7.FillWeight = 78.07879F;
  1066. this.dataGridViewTextBoxColumn7.HeaderText = "L5%";
  1067. this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
  1068. this.dataGridViewTextBoxColumn7.ReadOnly = true;
  1069. this.dataGridViewTextBoxColumn7.Width = 33;
  1070. //
  1071. // dataGridViewTextBoxColumn8
  1072. //
  1073. dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1074. this.dataGridViewTextBoxColumn8.DefaultCellStyle = dataGridViewCellStyle14;
  1075. this.dataGridViewTextBoxColumn8.FillWeight = 81.21828F;
  1076. this.dataGridViewTextBoxColumn8.HeaderText = "dataGridViewTextBoxColumn8";
  1077. this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
  1078. this.dataGridViewTextBoxColumn8.ReadOnly = true;
  1079. this.dataGridViewTextBoxColumn8.Width = 150;
  1080. //
  1081. // dataGridView2
  1082. //
  1083. this.dataGridView2.AllowUserToAddRows = false;
  1084. this.dataGridView2.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  1085. dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1086. dataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Control;
  1087. dataGridViewCellStyle15.Font = new System.Drawing.Font("宋体", 9F);
  1088. dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText;
  1089. dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  1090. dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  1091. dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  1092. this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle15;
  1093. this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  1094. this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  1095. this.pointName,
  1096. this.pointDeviation,
  1097. this.pointL1,
  1098. this.pointL2,
  1099. this.pointL3,
  1100. this.pointL4,
  1101. this.pointL5,
  1102. this.pointAverage});
  1103. this.dataGridView2.Location = new System.Drawing.Point(6, 52);
  1104. this.dataGridView2.Name = "dataGridView2";
  1105. this.dataGridView2.ReadOnly = true;
  1106. this.dataGridView2.RowHeadersVisible = false;
  1107. this.dataGridView2.RowTemplate.Height = 23;
  1108. this.dataGridView2.Size = new System.Drawing.Size(340, 143);
  1109. this.dataGridView2.TabIndex = 9;
  1110. //
  1111. // pointName
  1112. //
  1113. dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1114. this.pointName.DefaultCellStyle = dataGridViewCellStyle16;
  1115. this.pointName.HeaderText = "pointName";
  1116. this.pointName.Name = "pointName";
  1117. this.pointName.ReadOnly = true;
  1118. this.pointName.Width = 42;
  1119. //
  1120. // pointDeviation
  1121. //
  1122. dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1123. this.pointDeviation.DefaultCellStyle = dataGridViewCellStyle17;
  1124. this.pointDeviation.HeaderText = "pointDeviation";
  1125. this.pointDeviation.Name = "pointDeviation";
  1126. this.pointDeviation.ReadOnly = true;
  1127. this.pointDeviation.Width = 150;
  1128. //
  1129. // pointL1
  1130. //
  1131. dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1132. this.pointL1.DefaultCellStyle = dataGridViewCellStyle18;
  1133. this.pointL1.HeaderText = "L1%";
  1134. this.pointL1.Name = "pointL1";
  1135. this.pointL1.ReadOnly = true;
  1136. this.pointL1.Width = 42;
  1137. //
  1138. // pointL2
  1139. //
  1140. dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1141. this.pointL2.DefaultCellStyle = dataGridViewCellStyle19;
  1142. this.pointL2.HeaderText = "L2%";
  1143. this.pointL2.Name = "pointL2";
  1144. this.pointL2.ReadOnly = true;
  1145. this.pointL2.Width = 43;
  1146. //
  1147. // pointL3
  1148. //
  1149. dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1150. this.pointL3.DefaultCellStyle = dataGridViewCellStyle20;
  1151. this.pointL3.HeaderText = "L3%";
  1152. this.pointL3.Name = "pointL3";
  1153. this.pointL3.ReadOnly = true;
  1154. this.pointL3.Width = 42;
  1155. //
  1156. // pointL4
  1157. //
  1158. dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1159. this.pointL4.DefaultCellStyle = dataGridViewCellStyle21;
  1160. this.pointL4.HeaderText = "L4%";
  1161. this.pointL4.Name = "pointL4";
  1162. this.pointL4.ReadOnly = true;
  1163. this.pointL4.Width = 42;
  1164. //
  1165. // pointL5
  1166. //
  1167. dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1168. this.pointL5.DefaultCellStyle = dataGridViewCellStyle22;
  1169. this.pointL5.HeaderText = "L5%";
  1170. this.pointL5.Name = "pointL5";
  1171. this.pointL5.ReadOnly = true;
  1172. this.pointL5.Width = 42;
  1173. //
  1174. // pointAverage
  1175. //
  1176. dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1177. this.pointAverage.DefaultCellStyle = dataGridViewCellStyle23;
  1178. this.pointAverage.HeaderText = "pointAverage";
  1179. this.pointAverage.Name = "pointAverage";
  1180. this.pointAverage.ReadOnly = true;
  1181. this.pointAverage.Width = 70;
  1182. //
  1183. // button8
  1184. //
  1185. this.button8.BackColor = System.Drawing.SystemColors.Control;
  1186. this.button8.Location = new System.Drawing.Point(246, 20);
  1187. this.button8.Name = "button8";
  1188. this.button8.Size = new System.Drawing.Size(99, 26);
  1189. this.button8.TabIndex = 8;
  1190. this.button8.UseVisualStyleBackColor = false;
  1191. this.button8.Click += new System.EventHandler(this.button8_Click);
  1192. this.button8.LostFocus += new System.EventHandler(this.button8_LostFocus);
  1193. //
  1194. // button7
  1195. //
  1196. this.button7.BackColor = System.Drawing.SystemColors.Control;
  1197. this.button7.Location = new System.Drawing.Point(127, 20);
  1198. this.button7.Name = "button7";
  1199. this.button7.Size = new System.Drawing.Size(113, 26);
  1200. this.button7.TabIndex = 7;
  1201. this.button7.UseVisualStyleBackColor = false;
  1202. this.button7.Click += new System.EventHandler(this.button7_Click);
  1203. this.button7.LostFocus += new System.EventHandler(this.button7_LostFocus);
  1204. //
  1205. // button6
  1206. //
  1207. this.button6.BackColor = System.Drawing.SystemColors.Control;
  1208. this.button6.Location = new System.Drawing.Point(9, 20);
  1209. this.button6.Name = "button6";
  1210. this.button6.Size = new System.Drawing.Size(112, 26);
  1211. this.button6.TabIndex = 6;
  1212. this.button6.UseVisualStyleBackColor = false;
  1213. this.button6.Click += new System.EventHandler(this.button6_Click);
  1214. this.button6.LostFocus += new System.EventHandler(this.button6_LostFocus);
  1215. //
  1216. // groupBox6
  1217. //
  1218. this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  1219. this.groupBox6.Controls.Add(this.button10);
  1220. this.groupBox6.Controls.Add(this.button9);
  1221. this.groupBox6.Location = new System.Drawing.Point(153, 497);
  1222. this.groupBox6.Name = "groupBox6";
  1223. this.groupBox6.Size = new System.Drawing.Size(356, 59);
  1224. this.groupBox6.TabIndex = 7;
  1225. this.groupBox6.TabStop = false;
  1226. //
  1227. // button10
  1228. //
  1229. this.button10.BackColor = System.Drawing.SystemColors.Control;
  1230. this.button10.Location = new System.Drawing.Point(182, 24);
  1231. this.button10.Name = "button10";
  1232. this.button10.Size = new System.Drawing.Size(138, 26);
  1233. this.button10.TabIndex = 11;
  1234. this.button10.UseVisualStyleBackColor = false;
  1235. this.button10.Click += new System.EventHandler(this.button10_Click);
  1236. //
  1237. // button9
  1238. //
  1239. this.button9.BackColor = System.Drawing.SystemColors.Control;
  1240. this.button9.Location = new System.Drawing.Point(16, 23);
  1241. this.button9.Name = "button9";
  1242. this.button9.Size = new System.Drawing.Size(148, 26);
  1243. this.button9.TabIndex = 10;
  1244. this.button9.UseVisualStyleBackColor = false;
  1245. this.button9.Click += new System.EventHandler(this.button9_Click);
  1246. //
  1247. // groupBox7
  1248. //
  1249. this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  1250. | System.Windows.Forms.AnchorStyles.Left)
  1251. | System.Windows.Forms.AnchorStyles.Right)));
  1252. this.groupBox7.Location = new System.Drawing.Point(515, 60);
  1253. this.groupBox7.Name = "groupBox7";
  1254. this.groupBox7.Size = new System.Drawing.Size(580, 496);
  1255. this.groupBox7.TabIndex = 8;
  1256. this.groupBox7.TabStop = false;
  1257. //
  1258. // groupBox8
  1259. //
  1260. this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  1261. | System.Windows.Forms.AnchorStyles.Right)));
  1262. this.groupBox8.Controls.Add(this.button17);
  1263. this.groupBox8.Controls.Add(this.listView2);
  1264. this.groupBox8.Controls.Add(this.numericUpDown1);
  1265. this.groupBox8.Controls.Add(this.button16);
  1266. this.groupBox8.Controls.Add(this.label5);
  1267. this.groupBox8.Controls.Add(this.button14);
  1268. this.groupBox8.Controls.Add(this.button13);
  1269. this.groupBox8.Controls.Add(this.dataGridView4);
  1270. this.groupBox8.Controls.Add(this.button12);
  1271. this.groupBox8.Controls.Add(this.button11);
  1272. this.groupBox8.Location = new System.Drawing.Point(14, 562);
  1273. this.groupBox8.Name = "groupBox8";
  1274. this.groupBox8.Size = new System.Drawing.Size(1081, 204);
  1275. this.groupBox8.TabIndex = 9;
  1276. this.groupBox8.TabStop = false;
  1277. //
  1278. // button17
  1279. //
  1280. this.button17.Anchor = System.Windows.Forms.AnchorStyles.Right;
  1281. this.button17.BackColor = System.Drawing.SystemColors.Control;
  1282. this.button17.Location = new System.Drawing.Point(941, 102);
  1283. this.button17.Name = "button17";
  1284. this.button17.Size = new System.Drawing.Size(128, 26);
  1285. this.button17.TabIndex = 23;
  1286. this.button17.UseVisualStyleBackColor = false;
  1287. this.button17.Click += new System.EventHandler(this.button17_Click);
  1288. //
  1289. // listView2
  1290. //
  1291. this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
  1292. this.listView2.FullRowSelect = true;
  1293. this.listView2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
  1294. this.listView2.HideSelection = false;
  1295. this.listView2.Location = new System.Drawing.Point(16, 56);
  1296. this.listView2.Name = "listView2";
  1297. this.listView2.Size = new System.Drawing.Size(181, 140);
  1298. this.listView2.TabIndex = 22;
  1299. this.listView2.UseCompatibleStateImageBehavior = false;
  1300. this.listView2.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView2_ItemSelectionChanged);
  1301. this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged);
  1302. //
  1303. // numericUpDown1
  1304. //
  1305. this.numericUpDown1.Anchor = System.Windows.Forms.AnchorStyles.Right;
  1306. this.numericUpDown1.Location = new System.Drawing.Point(997, 163);
  1307. this.numericUpDown1.Maximum = new decimal(new int[] {
  1308. 10,
  1309. 0,
  1310. 0,
  1311. 0});
  1312. this.numericUpDown1.Name = "numericUpDown1";
  1313. this.numericUpDown1.Size = new System.Drawing.Size(56, 21);
  1314. this.numericUpDown1.TabIndex = 21;
  1315. this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
  1316. //
  1317. // button16
  1318. //
  1319. this.button16.BackColor = System.Drawing.SystemColors.Control;
  1320. this.button16.Location = new System.Drawing.Point(16, 20);
  1321. this.button16.Name = "button16";
  1322. this.button16.Size = new System.Drawing.Size(93, 26);
  1323. this.button16.TabIndex = 20;
  1324. this.button16.UseVisualStyleBackColor = false;
  1325. this.button16.Click += new System.EventHandler(this.button16_Click);
  1326. //
  1327. // label5
  1328. //
  1329. this.label5.Anchor = System.Windows.Forms.AnchorStyles.Right;
  1330. this.label5.AutoSize = true;
  1331. this.label5.Location = new System.Drawing.Point(958, 169);
  1332. this.label5.Name = "label5";
  1333. this.label5.Size = new System.Drawing.Size(0, 12);
  1334. this.label5.TabIndex = 18;
  1335. //
  1336. // button14
  1337. //
  1338. this.button14.Anchor = System.Windows.Forms.AnchorStyles.Right;
  1339. this.button14.BackColor = System.Drawing.SystemColors.Control;
  1340. this.button14.Location = new System.Drawing.Point(941, 68);
  1341. this.button14.Name = "button14";
  1342. this.button14.Size = new System.Drawing.Size(128, 26);
  1343. this.button14.TabIndex = 16;
  1344. this.button14.UseVisualStyleBackColor = false;
  1345. this.button14.Click += new System.EventHandler(this.button14_Click);
  1346. //
  1347. // button13
  1348. //
  1349. this.button13.Anchor = System.Windows.Forms.AnchorStyles.Right;
  1350. this.button13.BackColor = System.Drawing.SystemColors.Control;
  1351. this.button13.Location = new System.Drawing.Point(941, 34);
  1352. this.button13.Name = "button13";
  1353. this.button13.Size = new System.Drawing.Size(128, 26);
  1354. this.button13.TabIndex = 12;
  1355. this.button13.UseVisualStyleBackColor = false;
  1356. this.button13.Click += new System.EventHandler(this.button13_Click);
  1357. //
  1358. // dataGridView4
  1359. //
  1360. this.dataGridView4.AllowUserToAddRows = false;
  1361. this.dataGridView4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  1362. | System.Windows.Forms.AnchorStyles.Right)));
  1363. this.dataGridView4.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  1364. this.dataGridView4.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
  1365. dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1366. dataGridViewCellStyle24.BackColor = System.Drawing.SystemColors.Control;
  1367. dataGridViewCellStyle24.Font = new System.Drawing.Font("宋体", 9F);
  1368. dataGridViewCellStyle24.ForeColor = System.Drawing.SystemColors.WindowText;
  1369. dataGridViewCellStyle24.SelectionBackColor = System.Drawing.SystemColors.Highlight;
  1370. dataGridViewCellStyle24.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
  1371. dataGridViewCellStyle24.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
  1372. this.dataGridView4.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle24;
  1373. this.dataGridView4.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
  1374. this.dataGridView4.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  1375. this.Column1,
  1376. this.Column2,
  1377. this.Column3,
  1378. this.Column4,
  1379. this.Column5,
  1380. this.Column6,
  1381. this.Column7,
  1382. this.Column8,
  1383. this.Column9,
  1384. this.Column10});
  1385. this.dataGridView4.Location = new System.Drawing.Point(228, 20);
  1386. this.dataGridView4.Name = "dataGridView4";
  1387. this.dataGridView4.RowHeadersVisible = false;
  1388. this.dataGridView4.RowTemplate.Height = 23;
  1389. this.dataGridView4.Size = new System.Drawing.Size(693, 176);
  1390. this.dataGridView4.TabIndex = 15;
  1391. //
  1392. // Column1
  1393. //
  1394. dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1395. this.Column1.DefaultCellStyle = dataGridViewCellStyle25;
  1396. this.Column1.FillWeight = 91.37055F;
  1397. this.Column1.HeaderText = "Column1";
  1398. this.Column1.Name = "Column1";
  1399. //
  1400. // Column2
  1401. //
  1402. dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1403. this.Column2.DefaultCellStyle = dataGridViewCellStyle26;
  1404. this.Column2.FillWeight = 91.37055F;
  1405. this.Column2.HeaderText = "Column2";
  1406. this.Column2.Name = "Column2";
  1407. //
  1408. // Column3
  1409. //
  1410. dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1411. this.Column3.DefaultCellStyle = dataGridViewCellStyle27;
  1412. this.Column3.FillWeight = 91.37055F;
  1413. this.Column3.HeaderText = "Column3";
  1414. this.Column3.Name = "Column3";
  1415. //
  1416. // Column4
  1417. //
  1418. dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1419. this.Column4.DefaultCellStyle = dataGridViewCellStyle28;
  1420. this.Column4.FillWeight = 177.665F;
  1421. this.Column4.HeaderText = "Column4";
  1422. this.Column4.Name = "Column4";
  1423. //
  1424. // Column5
  1425. //
  1426. dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1427. this.Column5.DefaultCellStyle = dataGridViewCellStyle29;
  1428. this.Column5.FillWeight = 91.37055F;
  1429. this.Column5.HeaderText = "L1%";
  1430. this.Column5.Name = "Column5";
  1431. //
  1432. // Column6
  1433. //
  1434. dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1435. this.Column6.DefaultCellStyle = dataGridViewCellStyle30;
  1436. this.Column6.FillWeight = 91.37055F;
  1437. this.Column6.HeaderText = "L2%";
  1438. this.Column6.Name = "Column6";
  1439. //
  1440. // Column7
  1441. //
  1442. dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1443. this.Column7.DefaultCellStyle = dataGridViewCellStyle31;
  1444. this.Column7.FillWeight = 91.37055F;
  1445. this.Column7.HeaderText = "L3%";
  1446. this.Column7.Name = "Column7";
  1447. //
  1448. // Column8
  1449. //
  1450. dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1451. this.Column8.DefaultCellStyle = dataGridViewCellStyle32;
  1452. this.Column8.FillWeight = 91.37055F;
  1453. this.Column8.HeaderText = "L4%";
  1454. this.Column8.Name = "Column8";
  1455. //
  1456. // Column9
  1457. //
  1458. dataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1459. this.Column9.DefaultCellStyle = dataGridViewCellStyle33;
  1460. this.Column9.FillWeight = 91.37055F;
  1461. this.Column9.HeaderText = "L5%";
  1462. this.Column9.Name = "Column9";
  1463. //
  1464. // Column10
  1465. //
  1466. dataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
  1467. this.Column10.DefaultCellStyle = dataGridViewCellStyle34;
  1468. this.Column10.FillWeight = 91.37055F;
  1469. this.Column10.HeaderText = "Column10";
  1470. this.Column10.Name = "Column10";
  1471. //
  1472. // button12
  1473. //
  1474. this.button12.BackColor = System.Drawing.SystemColors.Control;
  1475. this.button12.Location = new System.Drawing.Point(145, 20);
  1476. this.button12.Name = "button12";
  1477. this.button12.Size = new System.Drawing.Size(52, 26);
  1478. this.button12.TabIndex = 13;
  1479. this.button12.UseVisualStyleBackColor = false;
  1480. this.button12.Click += new System.EventHandler(this.button12_Click);
  1481. //
  1482. // button11
  1483. //
  1484. this.button11.BackColor = System.Drawing.SystemColors.Control;
  1485. this.button11.Location = new System.Drawing.Point(15, 20);
  1486. this.button11.Name = "button11";
  1487. this.button11.Size = new System.Drawing.Size(63, 26);
  1488. this.button11.TabIndex = 12;
  1489. this.button11.UseVisualStyleBackColor = false;
  1490. this.button11.Click += new System.EventHandler(this.button11_Click);
  1491. //
  1492. // RecombinationRateDialog
  1493. //
  1494. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  1495. this.BackColor = System.Drawing.SystemColors.Control;
  1496. this.ClientSize = new System.Drawing.Size(1107, 770);
  1497. this.Controls.Add(this.groupBox8);
  1498. this.Controls.Add(this.groupBox7);
  1499. this.Controls.Add(this.groupBox6);
  1500. this.Controls.Add(this.groupBox5);
  1501. this.Controls.Add(this.groupBox4);
  1502. this.Controls.Add(this.groupBox3);
  1503. this.Controls.Add(this.groupBox2);
  1504. this.Controls.Add(this.groupBox1);
  1505. this.Font = new System.Drawing.Font("宋体", 9F);
  1506. this.Name = "RecombinationRateDialog";
  1507. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RecombinationRateDialog_FormClosing);
  1508. this.Controls.SetChildIndex(this.groupBox1, 0);
  1509. this.Controls.SetChildIndex(this.groupBox2, 0);
  1510. this.Controls.SetChildIndex(this.groupBox3, 0);
  1511. this.Controls.SetChildIndex(this.groupBox4, 0);
  1512. this.Controls.SetChildIndex(this.groupBox5, 0);
  1513. this.Controls.SetChildIndex(this.groupBox6, 0);
  1514. this.Controls.SetChildIndex(this.groupBox7, 0);
  1515. this.Controls.SetChildIndex(this.groupBox8, 0);
  1516. this.groupBox1.ResumeLayout(false);
  1517. this.groupBox1.PerformLayout();
  1518. this.groupBox2.ResumeLayout(false);
  1519. this.groupBox3.ResumeLayout(false);
  1520. this.groupBox4.ResumeLayout(false);
  1521. this.groupBox4.PerformLayout();
  1522. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  1523. this.groupBox5.ResumeLayout(false);
  1524. ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit();
  1525. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
  1526. this.groupBox6.ResumeLayout(false);
  1527. this.groupBox8.ResumeLayout(false);
  1528. this.groupBox8.PerformLayout();
  1529. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  1530. ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).EndInit();
  1531. this.ResumeLayout(false);
  1532. }
  1533. #endregion
  1534. /// <summary>
  1535. /// 刷新工件下拉
  1536. /// </summary>
  1537. public void RefreshCombobox()
  1538. {
  1539. WorkpieceMaintenanceModel workpieceMaintenanceModel = XmlSerializeHelper.DESerializer<WorkpieceMaintenanceModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkpieceMaintenanceModel.xml", FileMode.Open));
  1540. ArrayList arrayList = new ArrayList();
  1541. foreach (var item in workpieceMaintenanceModel.Workpieces)
  1542. {
  1543. arrayList.Add(item.Name);
  1544. }
  1545. this.comboBox1.DataSource = null;
  1546. this.comboBox1.DataSource = arrayList;
  1547. if(arrayList.Count > 0)
  1548. {
  1549. if (string.IsNullOrEmpty(this.selectItemValue))
  1550. this.comboBox1.SelectedIndex = 0;
  1551. else
  1552. this.comboBox1.SelectedItem = this.selectItemValue;
  1553. }
  1554. }
  1555. private void listView1_MouseDown(object sender, MouseEventArgs e)
  1556. {
  1557. this.changeCount = 0;
  1558. }
  1559. private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
  1560. {
  1561. bool change = false;
  1562. if (this.changeCount == 0)
  1563. {
  1564. if (this.dataGridView2.Rows.Count > 0)
  1565. {
  1566. if(this.saveSuccess)
  1567. {
  1568. DialogResult dt = MessageBox.Show(PdnResources.GetString("Menu.Whethertosavetherrentpicture.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  1569. if (dt == DialogResult.Yes)
  1570. {
  1571. string imgName = this.appWorkspace.DocumentWorkspaces[e.ItemIndex].GetFriendlyName();
  1572. string tag = this.imageList1.Images.Keys[e.ItemIndex];
  1573. DataTable dataTable1 = new DataTable();
  1574. bool replace = false;
  1575. int add = 0;
  1576. foreach (ListViewItem item in this.listView2.Items)
  1577. {
  1578. if (item.Name.Equals(tag))
  1579. {
  1580. add++;
  1581. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Themeasurementdertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1582. if (dr == DialogResult.OK)
  1583. {
  1584. replace = true;
  1585. this.listView2.Items.Remove(item);
  1586. }
  1587. break;
  1588. }
  1589. }
  1590. if (replace || this.listView2.Items.Count == 0 || add == 0)
  1591. {
  1592. this.dataGridView4.Rows.Clear();
  1593. if (this.linesNumber == 3)
  1594. {
  1595. this.dataGridView4.Columns[7].Visible = false;
  1596. this.dataGridView4.Columns[8].Visible = false;
  1597. }
  1598. else if (this.linesNumber == 4)
  1599. {
  1600. this.dataGridView4.Columns[7].Visible = true;
  1601. this.dataGridView4.Columns[8].Visible = false;
  1602. }
  1603. else if (this.linesNumber == 5)
  1604. {
  1605. this.dataGridView4.Columns[7].Visible = true;
  1606. this.dataGridView4.Columns[8].Visible = true;
  1607. }
  1608. ListViewItem listViewItem = new ListViewItem();
  1609. listViewItem.Name = tag;
  1610. listViewItem.SubItems[0].Text = imgName;
  1611. listViewItem.Tag = "" + this.linesNumber;
  1612. if (this.listView2.Items.Count == 0)
  1613. this.listView2.Items.Add(listViewItem);
  1614. else
  1615. this.listView2.Items.Insert(0, listViewItem);
  1616. dataTable1.TableName = tag;
  1617. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  1618. {
  1619. dataTable1.Columns.Add(c.HeaderText);
  1620. }
  1621. foreach (DataTable dataTable in this.pointDataTables)
  1622. {
  1623. for (int r = 0; r < dataTable.Rows.Count; r++)
  1624. {
  1625. DataGridViewRow dgvr = new DataGridViewRow();
  1626. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  1627. {
  1628. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  1629. }
  1630. for (int c = 0; c < dataTable.Columns.Count; c++)
  1631. {
  1632. dgvr.Cells[0].Value = imgName;
  1633. dgvr.Cells[1].Value = dataTable.TableName;
  1634. if (c > 1 && !dataTable.Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")))
  1635. {
  1636. if (this.linesNumber == 3)
  1637. {
  1638. if (c + 2 != 7 && c + 2 != 8)
  1639. dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  1640. else
  1641. dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString();
  1642. }
  1643. else if (this.linesNumber == 4)
  1644. {
  1645. if (c + 2 != 8)
  1646. dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  1647. else
  1648. dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString();
  1649. }
  1650. else if (this.linesNumber == 5)
  1651. {
  1652. dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  1653. }
  1654. }
  1655. else
  1656. dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString();
  1657. }
  1658. this.dataGridView4.Rows.Add(dgvr);
  1659. DataRow dataRow = dataTable1.NewRow();
  1660. for (int c = 0; c < dataTable.Columns.Count + 2; c++)
  1661. {
  1662. if (c == 0)
  1663. dataRow[this.dataGridView4.Columns[c].HeaderText] = imgName;
  1664. else if (c == 1)
  1665. dataRow[this.dataGridView4.Columns[c].HeaderText] = dataTable.TableName;
  1666. else
  1667. dataRow[this.dataGridView4.Columns[c].HeaderText] = dataTable.Rows[r][c - 2].ToString();
  1668. }
  1669. dataTable1.Rows.Add(dataRow);
  1670. }
  1671. }
  1672. foreach (DataTable dataTable2 in pictureDataTables)
  1673. {
  1674. if (dataTable2.TableName.Equals(dataTable1.TableName))
  1675. {
  1676. pictureDataTables.Remove(dataTable2);
  1677. break;
  1678. }
  1679. }
  1680. this.pictureDataTables.Add(dataTable1);
  1681. if (this.allShow)
  1682. AllShow();
  1683. this.bitDic.Clear();
  1684. foreach (var item in this.bitDic1)
  1685. {
  1686. this.bitDic.Add(item.Key, item.Value);
  1687. }
  1688. this.listView2.Items[0].Selected = true;
  1689. }
  1690. }
  1691. }
  1692. }
  1693. }
  1694. else
  1695. {
  1696. if (change)
  1697. SelectedIndexChanged();
  1698. }
  1699. this.changeCount++;
  1700. }
  1701. private void listView1_SelectedIndexChanged(object sender, EventArgs e)
  1702. {
  1703. SelectedIndexChanged();
  1704. }
  1705. private void SelectedIndexChanged()
  1706. {
  1707. if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
  1708. {
  1709. this.unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
  1710. /// <summary>
  1711. /// 选中图片的bitmap
  1712. Mat imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
  1713. Document document = Document.FromImageMat(imageMat.Clone());
  1714. this.documentWorkspace.Document = document;
  1715. this.documentWorkspace.Visible = true;
  1716. this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList;
  1717. //this.documentWorkspace.phaseModels = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].phaseModels;
  1718. this.documentWorkspace.Document = Document.FromImageMat(this.documentItems[this.listView1.FocusedItem.Index].imageMat);
  1719. this.documentWorkspace.Visible = true;
  1720. this.documentWorkspace.ActiveTool = DrawToolType.InclusionNoEffect;
  1721. this.documentWorkspace.PhaseModels.Clear();
  1722. this.documentWorkspace.PhaseModels.AddRange(this.documentItems[this.listView1.FocusedItem.Index].phaseModels);
  1723. // 选择了图片
  1724. this.selectPicture = true;
  1725. this.commonControlButtons.Visible = true;
  1726. this.dataGridView1.Rows.Clear();
  1727. this.dataGridView2.Rows.Clear();
  1728. this.dataGridView3.Rows.Clear();
  1729. this.pointDataTables.Clear();
  1730. this.pointRectangleFs.Clear();
  1731. this.textBox1.Clear();
  1732. this.textBox2.Clear();
  1733. //this.checkBox1.Checked = false;
  1734. //this.checkBox2.Checked = false;
  1735. this.button11.Visible = true;
  1736. this.button16.Visible = false;
  1737. pointCountA1.Clear();
  1738. pointCountA2.Clear();
  1739. pointCountA3.Clear();
  1740. pointCountB1.Clear();
  1741. pointCountB2.Clear();
  1742. pointCountB3.Clear();
  1743. pointCountB4.Clear();
  1744. pointCountC1.Clear();
  1745. pointCountC2.Clear();
  1746. pointCountC3.Clear();
  1747. pointCountC4.Clear();
  1748. pointCountC5.Clear();
  1749. this.lengthL1.Clear();
  1750. this.lengthL2.Clear();
  1751. this.lengthL3.Clear();
  1752. this.lengthL4.Clear();
  1753. this.lengthL5.Clear();
  1754. this.pointDrawkb = false;
  1755. RefreshPanel();
  1756. InitMeasurePoints();
  1757. this.documentWorkspace.Refresh();
  1758. //this.documentWorkspace.Refresh();
  1759. //this.applyButtonImpl(sender, e);
  1760. }
  1761. }
  1762. /// <summary>
  1763. /// 初始化测量数据
  1764. /// </summary>
  1765. private bool InitMeasureData()
  1766. {
  1767. bool retu = true;
  1768. this.pointDrawkb = false;
  1769. if (this.listView2.Items.Count > 0)
  1770. {
  1771. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Whethertoclearallanalysisresults.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1772. if (dr == DialogResult.OK)
  1773. {
  1774. this.dataGridView1.Rows.Clear();
  1775. this.dataGridView2.Rows.Clear();
  1776. this.dataGridView3.Rows.Clear();
  1777. this.pointDataTables.Clear();
  1778. this.pointRectangleFs.Clear();
  1779. this.textBox1.Clear();
  1780. this.textBox2.Clear();
  1781. this.comboBox1.Enabled = true;
  1782. //this.checkBox1.Checked = false;
  1783. //this.checkBox2.Checked = false;
  1784. this.button3.Visible = true;
  1785. this.button15.Visible = false;
  1786. this.button11.Visible = true;
  1787. this.button16.Visible = false;
  1788. pointCountA1.Clear();
  1789. pointCountA2.Clear();
  1790. pointCountA3.Clear();
  1791. pointCountB1.Clear();
  1792. pointCountB2.Clear();
  1793. pointCountB3.Clear();
  1794. pointCountB4.Clear();
  1795. pointCountC1.Clear();
  1796. pointCountC2.Clear();
  1797. pointCountC3.Clear();
  1798. pointCountC4.Clear();
  1799. pointCountC5.Clear();
  1800. this.dataGridView4.Rows.Clear();
  1801. this.pictureDataTables.Clear();
  1802. this.listView2.Items.Clear();
  1803. this.lengthL1.Clear();
  1804. this.lengthL2.Clear();
  1805. this.lengthL3.Clear();
  1806. this.lengthL4.Clear();
  1807. this.lengthL5.Clear();
  1808. }
  1809. else
  1810. {
  1811. retu = false;
  1812. }
  1813. }
  1814. else
  1815. {
  1816. this.dataGridView1.Rows.Clear();
  1817. this.dataGridView2.Rows.Clear();
  1818. this.dataGridView3.Rows.Clear();
  1819. this.pointDataTables.Clear();
  1820. this.pointRectangleFs.Clear();
  1821. this.textBox1.Clear();
  1822. this.textBox2.Clear();
  1823. this.comboBox1.Enabled = true;
  1824. //this.checkBox1.Checked = false;
  1825. //this.checkBox2.Checked = false;
  1826. this.button3.Visible = true;
  1827. this.button15.Visible = false;
  1828. this.button11.Visible = true;
  1829. this.button16.Visible = false;
  1830. pointCountA1.Clear();
  1831. pointCountA2.Clear();
  1832. pointCountA3.Clear();
  1833. pointCountB1.Clear();
  1834. pointCountB2.Clear();
  1835. pointCountB3.Clear();
  1836. pointCountB4.Clear();
  1837. pointCountC1.Clear();
  1838. pointCountC2.Clear();
  1839. pointCountC3.Clear();
  1840. pointCountC4.Clear();
  1841. pointCountC5.Clear();
  1842. this.lengthL1.Clear();
  1843. this.lengthL2.Clear();
  1844. this.lengthL3.Clear();
  1845. this.lengthL4.Clear();
  1846. this.lengthL5.Clear();
  1847. }
  1848. this.documentWorkspace.Refresh();
  1849. return retu;
  1850. }
  1851. /// <summary>
  1852. /// 初始化测量点
  1853. /// </summary>
  1854. public void InitMeasurePoints()
  1855. {
  1856. this.pointDrawkb = true;
  1857. for (int i = 0; i < pointRectangleFs.Count; i++)
  1858. {
  1859. pointRectangleFs[i].Clear();
  1860. }
  1861. for (int i = 0; i < pointCountA1.Count; i++)
  1862. {
  1863. pointCountA1[i] = 0;
  1864. }
  1865. for (int i = 0; i < pointCountA2.Count; i++)
  1866. {
  1867. pointCountA2[i] = 0;
  1868. }
  1869. for (int i = 0; i < pointCountA3.Count; i++)
  1870. {
  1871. pointCountA3[i] = 0;
  1872. }
  1873. for (int i = 0; i < pointCountB1.Count; i++)
  1874. {
  1875. pointCountB1[i] = 0;
  1876. }
  1877. for (int i = 0; i < pointCountB2.Count; i++)
  1878. {
  1879. pointCountB2[i] = 0;
  1880. }
  1881. for (int i = 0; i < pointCountB3.Count; i++)
  1882. {
  1883. pointCountB3[i] = 0;
  1884. }
  1885. for (int i = 0; i < pointCountB4.Count; i++)
  1886. {
  1887. pointCountB4[i] = 0;
  1888. }
  1889. for (int i = 0; i < pointCountC1.Count; i++)
  1890. {
  1891. pointCountC1[i] = 0;
  1892. }
  1893. for (int i = 0; i < pointCountC2.Count; i++)
  1894. {
  1895. pointCountC2[i] = 0;
  1896. }
  1897. for (int i = 0; i < pointCountC3.Count; i++)
  1898. {
  1899. pointCountC3[i] = 0;
  1900. }
  1901. for (int i = 0; i < pointCountC4.Count; i++)
  1902. {
  1903. pointCountC4[i] = 0;
  1904. }
  1905. for (int i = 0; i < pointCountC5.Count; i++)
  1906. {
  1907. pointCountC5[i] = 0;
  1908. }
  1909. this.documentWorkspace.Refresh();
  1910. }
  1911. /// <summary>
  1912. /// 设置按钮
  1913. /// </summary>
  1914. /// <param name="sender"></param>
  1915. /// <param name="e"></param>
  1916. private void button1_Click(object sender, EventArgs e)
  1917. {
  1918. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.RecombinationRate");
  1919. if (recombinationRateSetDialog.hasModule)
  1920. {
  1921. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  1922. recombinationRateSetDialog.ShowDialog();
  1923. }
  1924. else
  1925. {
  1926. recombinationRateSetDialog = null;
  1927. }
  1928. }
  1929. /// <summary>
  1930. /// 工件维护设置按钮
  1931. /// </summary>
  1932. /// <param name="sender"></param>
  1933. /// <param name="e"></param>
  1934. private void button4_Click(object sender, EventArgs e)
  1935. {
  1936. WorkpieceMaintenance workpieceMaintenance = new WorkpieceMaintenance();
  1937. workpieceMaintenance.StartPosition = FormStartPosition.CenterScreen;
  1938. workpieceMaintenance.ShowDialog(this);
  1939. }
  1940. /// <summary>
  1941. /// 开始测量按钮
  1942. /// </summary>
  1943. /// <param name="sender"></param>
  1944. /// <param name="e"></param>
  1945. private void button3_Click(object sender, EventArgs e)
  1946. {
  1947. if (this.selectPicture)
  1948. {
  1949. bool retu = InitMeasureData();
  1950. if (this.comboBox1.SelectedIndex >= 0)
  1951. {
  1952. if(retu)
  1953. {
  1954. GetDataFromXML();
  1955. this.button4.Enabled = false;
  1956. this.lineChange = false;
  1957. this.comboBox1.Enabled = false;
  1958. this.button3.Visible = false;
  1959. this.button15.Visible = true;
  1960. this.button15.Focus();
  1961. }
  1962. }
  1963. else
  1964. {
  1965. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectaworkpiece.text")+"!");
  1966. }
  1967. }
  1968. else
  1969. {
  1970. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectimage.Text")+"!");
  1971. }
  1972. }
  1973. /// <summary>
  1974. /// 停止测量
  1975. /// </summary>
  1976. /// <param name="sender"></param>
  1977. /// <param name="e"></param>
  1978. private void button15_Click(object sender, EventArgs e)
  1979. {
  1980. this.button4.Enabled = true;
  1981. this.pointDrawkb = false;
  1982. this.lineChange = true;
  1983. this.comboBox1.Enabled = true;
  1984. this.button3.Visible = true;
  1985. this.button15.Visible = false;
  1986. this.button3.Focus();
  1987. this.documentWorkspace.Refresh();
  1988. }
  1989. /// <summary>
  1990. /// 单元格点击
  1991. /// </summary>
  1992. /// <param name="sender"></param>
  1993. /// <param name="e"></param>
  1994. private void dgvData_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
  1995. {
  1996. if (e.RowIndex > -1)
  1997. {
  1998. if (this.dataGridView1.Columns[e.ColumnIndex].Index == 2)
  1999. {
  2000. mouseX = e.X;
  2001. mouseY = e.Y;
  2002. }
  2003. }
  2004. }
  2005. /// <summary>
  2006. /// 单元格点击内容
  2007. /// </summary>
  2008. /// <param name="sender"></param>
  2009. /// <param name="e"></param>
  2010. private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e)
  2011. {
  2012. if (e.RowIndex > -1)
  2013. {
  2014. switch (this.dataGridView1.Columns[e.ColumnIndex].Index)
  2015. {
  2016. case 2:
  2017. Rectangle rc = this.dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false);//单元格区域的矩形
  2018. if (0 < mouseX && mouseX < rc.Width / 2)
  2019. {
  2020. }
  2021. else if (rc.Width / 2 < mouseX && mouseX < rc.Width)
  2022. {
  2023. }
  2024. break;
  2025. }
  2026. }
  2027. }
  2028. /// <summary>
  2029. /// 编辑结束后
  2030. /// </summary>
  2031. /// <param name="sender"></param>
  2032. /// <param name="e"></param>
  2033. private void dataGridView1_RowLeave(object sender, DataGridViewCellEventArgs e)
  2034. {
  2035. this.dataGridView1.Rows[e.RowIndex].ReadOnly = true;
  2036. this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.SelectionBackColor = SystemColors.MenuHighlight;
  2037. }
  2038. /// <summary>
  2039. /// 样品保存
  2040. /// </summary>
  2041. /// <param name="sender"></param>
  2042. /// <param name="e"></param>
  2043. private void button5_Click(object sender, EventArgs e)
  2044. {
  2045. if (this.button3.Visible)
  2046. MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!");
  2047. else
  2048. {
  2049. if (string.IsNullOrEmpty(this.textBox1.Text))
  2050. {
  2051. MessageBox.Show(PdnResources.GetString("Menu.Pleaseenterthesamplename.text")+"!");
  2052. this.textBox1.Focus();
  2053. }
  2054. else
  2055. {
  2056. bool canAdd = true;
  2057. for (int i = 0; i < dataGridView1.Rows.Count; i++)
  2058. {
  2059. if (this.textBox1.Text.Equals(dataGridView1.Rows[i].Cells[0].Value))
  2060. {
  2061. MessageBox.Show(PdnResources.GetString("Menu.Namealreadyexists.text")+"!");
  2062. this.textBox1.Focus();
  2063. canAdd = false;
  2064. }
  2065. }
  2066. if (canAdd)
  2067. {
  2068. this.pointDrawkb = true;
  2069. DataTable dataTable = new DataTable();
  2070. DataGridViewRow row = new DataGridViewRow();
  2071. DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
  2072. string name = this.textBox1.Text;
  2073. textboxcell.Value = this.textBox1.Text;
  2074. dataTable.TableName = this.textBox1.Text;
  2075. this.pointDataTables.Add(dataTable);
  2076. row.Cells.Add(textboxcell);
  2077. textboxcell = new DataGridViewTextBoxCell();
  2078. textboxcell.Value = this.textBox2.Text;
  2079. row.Cells.Add(textboxcell);
  2080. DataGridViewButtonCell dataGridViewButtonCell = new DataGridViewButtonCell();
  2081. dataGridViewButtonCell.Value = PdnResources.GetString("Menu.Edit.Text");
  2082. row.Cells.Add(dataGridViewButtonCell);
  2083. dataGridViewButtonCell = new DataGridViewButtonCell();
  2084. dataGridViewButtonCell.Value = PdnResources.GetString("Menu.Edit.Delete.Text");
  2085. row.Cells.Add(dataGridViewButtonCell);
  2086. row.ReadOnly = true;
  2087. this.dataGridView1.Rows.Add(row);
  2088. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;
  2089. InitializeMeasurementPpointList(this.textBox1.Text);
  2090. this.textBox1.Clear();
  2091. this.textBox2.Clear();
  2092. //this.pointCountA1 = 0;
  2093. //this.pointCountA2 = 0;
  2094. //this.pointCountA3 = 0;
  2095. //this.pointCountB1 = 0;
  2096. //this.pointCountB2 = 0;
  2097. //this.pointCountB3 = 0;
  2098. //this.pointCountB4 = 0;
  2099. //this.pointCountC1 = 0;
  2100. //this.pointCountC2 = 0;
  2101. //this.pointCountC3 = 0;
  2102. //this.pointCountC4 = 0;
  2103. //this.pointCountC5 = 0;
  2104. //this.rectangleFs.Clear();
  2105. if (this.dataGridView1.DisplayedRowCount(false) != this.dataGridView1.RowCount)
  2106. this.dataGridView1.Columns[1].Width = 142;
  2107. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + name;
  2108. pointRectangleFs.Add(new List<RectangleF>());
  2109. pointCountA1.Add(0);
  2110. pointCountA2.Add(0);
  2111. pointCountA3.Add(0);
  2112. pointCountB1.Add(0);
  2113. pointCountB2.Add(0);
  2114. pointCountB3.Add(0);
  2115. pointCountB4.Add(0);
  2116. pointCountC1.Add(0);
  2117. pointCountC2.Add(0);
  2118. pointCountC3.Add(0);
  2119. pointCountC4.Add(0);
  2120. pointCountC5.Add(0);
  2121. if(this.linesNumber == 3)
  2122. {
  2123. this.lengthL1.Add(new List<decimal>());
  2124. this.lengthL2.Add(new List<decimal>());
  2125. this.lengthL3.Add(new List<decimal>());
  2126. }
  2127. else if (this.linesNumber == 4)
  2128. {
  2129. this.lengthL1.Add(new List<decimal>());
  2130. this.lengthL2.Add(new List<decimal>());
  2131. this.lengthL3.Add(new List<decimal>());
  2132. this.lengthL4.Add(new List<decimal>());
  2133. }
  2134. else if (this.linesNumber == 5)
  2135. {
  2136. this.lengthL1.Add(new List<decimal>());
  2137. this.lengthL2.Add(new List<decimal>());
  2138. this.lengthL3.Add(new List<decimal>());
  2139. this.lengthL4.Add(new List<decimal>());
  2140. this.lengthL5.Add(new List<decimal>());
  2141. }
  2142. //保存处理后的图片
  2143. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  2144. List<Bitmap> tempBit = new List<Bitmap>();
  2145. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  2146. originalBit.Tag = pantographRatio;
  2147. tempBit.Add(originalBit);
  2148. Graphics graphics;
  2149. Bitmap newBit;
  2150. Bitmap processedBit;
  2151. if (this.documentItems[this.listView1.FocusedItem.Index].phaseModels.Count != 0
  2152. && this.documentItems[this.listView1.FocusedItem.Index].phaseModels[0].mat != null)
  2153. {
  2154. processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
  2155. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2156. graphics = Graphics.FromImage(newBit);
  2157. graphics.DrawImage(processedBit, new PointF(0, 0));
  2158. Draw(graphics);
  2159. newBit.Tag = pantographRatio;
  2160. tempBit.Add(newBit);
  2161. }
  2162. else
  2163. {
  2164. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2165. graphics = Graphics.FromImage(newBit);
  2166. Draw(graphics);
  2167. newBit.Tag = pantographRatio;
  2168. tempBit.Add(newBit);
  2169. }
  2170. if (bitDic1.ContainsKey(tag))
  2171. bitDic1[tag] = tempBit;
  2172. else
  2173. bitDic1.Add(tag, tempBit);
  2174. this.saveSuccess = true;
  2175. this.documentWorkspace.Refresh();
  2176. }
  2177. }
  2178. }
  2179. }
  2180. /// <summary>
  2181. /// 单元格点击
  2182. /// </summary>
  2183. /// <param name="sender"></param>
  2184. /// <param name="e"></param>
  2185. private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
  2186. {
  2187. dataGridView1.Rows[e.RowIndex].Selected = true;
  2188. if (e.RowIndex < 0)
  2189. return;
  2190. if (e.ColumnIndex < 0)
  2191. return;
  2192. if (PdnResources.GetString("Menu.Edit.Delete.Text").Equals(this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value))
  2193. {
  2194. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethesample?.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  2195. if (dr == DialogResult.OK)
  2196. {
  2197. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
  2198. if (bitDic1.ContainsKey(tag))
  2199. bitDic1.Remove(tag);
  2200. if(this.linesNumber == 3)
  2201. {
  2202. this.lengthL1.RemoveAt(e.RowIndex);
  2203. this.lengthL2.RemoveAt(e.RowIndex);
  2204. this.lengthL3.RemoveAt(e.RowIndex);
  2205. }
  2206. else if (this.linesNumber == 4)
  2207. {
  2208. this.lengthL1.RemoveAt(e.RowIndex);
  2209. this.lengthL2.RemoveAt(e.RowIndex);
  2210. this.lengthL3.RemoveAt(e.RowIndex);
  2211. this.lengthL4.RemoveAt(e.RowIndex);
  2212. }
  2213. else if (this.linesNumber == 5)
  2214. {
  2215. this.lengthL1.RemoveAt(e.RowIndex);
  2216. this.lengthL2.RemoveAt(e.RowIndex);
  2217. this.lengthL3.RemoveAt(e.RowIndex);
  2218. this.lengthL4.RemoveAt(e.RowIndex);
  2219. this.lengthL5.RemoveAt(e.RowIndex);
  2220. }
  2221. if (this.dataGridView1.Rows.Count > 0)
  2222. {
  2223. this.pointRectangleFs.RemoveAt(e.RowIndex);
  2224. this.pointCountA1.RemoveAt(e.RowIndex);
  2225. this.pointCountA2.RemoveAt(e.RowIndex);
  2226. this.pointCountA3.RemoveAt(e.RowIndex);
  2227. this.pointCountB1.RemoveAt(e.RowIndex);
  2228. this.pointCountB2.RemoveAt(e.RowIndex);
  2229. this.pointCountB3.RemoveAt(e.RowIndex);
  2230. this.pointCountB4.RemoveAt(e.RowIndex);
  2231. this.pointCountC1.RemoveAt(e.RowIndex);
  2232. this.pointCountC2.RemoveAt(e.RowIndex);
  2233. this.pointCountC3.RemoveAt(e.RowIndex);
  2234. this.pointCountC4.RemoveAt(e.RowIndex);
  2235. this.pointCountC5.RemoveAt(e.RowIndex);
  2236. }
  2237. int deleteIndex = 0;
  2238. foreach (var dataTable in this.pointDataTables)
  2239. {
  2240. if (this.pointDataTables[deleteIndex].TableName.Equals(this.dataGridView1.Rows[e.RowIndex].Cells[0].Value))
  2241. {
  2242. this.pointDataTables.RemoveAt(deleteIndex);
  2243. break;
  2244. }
  2245. deleteIndex++;
  2246. }
  2247. //if (e.RowIndex == this.dataGridView1.Rows.Count - 1)
  2248. //{
  2249. // this.pointCountA1 = 0;
  2250. // this.pointCountA2 = 0;
  2251. // this.pointCountA3 = 0;
  2252. // this.pointCountB1 = 0;
  2253. // this.pointCountB2 = 0;
  2254. // this.pointCountB3 = 0;
  2255. // this.pointCountB4 = 0;
  2256. // this.pointCountC1 = 0;
  2257. // this.pointCountC2 = 0;
  2258. // this.pointCountC3 = 0;
  2259. // this.pointCountC4 = 0;
  2260. // this.pointCountC5 = 0;
  2261. // this.rectangleFs.Clear();
  2262. //}
  2263. this.dataGridView1.Rows.RemoveAt(e.RowIndex);
  2264. if (this.dataGridView1.Rows.Count > 0)
  2265. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;
  2266. else
  2267. {
  2268. //this.pointCountA1 = 0;
  2269. //this.pointCountA2 = 0;
  2270. //this.pointCountA3 = 0;
  2271. //this.pointCountB1 = 0;
  2272. //this.pointCountB2 = 0;
  2273. //this.pointCountB3 = 0;
  2274. //this.pointCountB4 = 0;
  2275. //this.pointCountC1 = 0;
  2276. //this.pointCountC2 = 0;
  2277. //this.pointCountC3 = 0;
  2278. //this.pointCountC4 = 0;
  2279. //this.pointCountC5 = 0;
  2280. //this.rectangleFs.Clear();
  2281. this.pointDrawkb = false;
  2282. this.dataGridView2.Rows.Clear();
  2283. this.dataGridView3.Rows.Clear();
  2284. }
  2285. if (this.dataGridView1.DisplayedRowCount(false) == this.dataGridView1.RowCount)
  2286. this.dataGridView1.Columns[1].Width = 157;
  2287. this.saveSuccess = true;
  2288. this.documentWorkspace.Refresh();
  2289. }
  2290. }
  2291. else if (PdnResources.GetString("Menu.Edit.Text").Equals(this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value))
  2292. {
  2293. MessageBox.Show(PdnResources.GetString("Menu.Thecurrentlinecanbeedited.text")+"!");
  2294. //this.dataGridView1.ClearSelection();
  2295. this.dataGridView1.Rows[e.RowIndex].ReadOnly = false;
  2296. this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.SelectionBackColor = Color.GreenYellow;
  2297. }
  2298. }
  2299. /// <summary>
  2300. /// 添加样品成功时初
  2301. /// 始化测量点列表
  2302. /// </summary>
  2303. private void InitializeMeasurementPpointList(string sampleName)
  2304. {
  2305. int dataTableIndex = 0;
  2306. for (int i = 0; i < this.pointDataTables.Count; i++)
  2307. {
  2308. if (this.pointDataTables[i].TableName.Equals(sampleName))
  2309. dataTableIndex = i;
  2310. }
  2311. // 配置文件中取得测量点列表值
  2312. if (workpieceMaintenanceModel.Workpieces != null && this.comboBox1.DataSource != null)
  2313. {
  2314. this.dataGridView2.Rows.Clear();
  2315. this.dataGridView3.Rows.Clear();
  2316. for (int i = 0; i < workpieceMaintenanceModel.Workpieces.Count; i++)
  2317. {
  2318. // 选中的工件
  2319. if (workpieceMaintenanceModel.Workpieces[i].Name.Equals(this.comboBox1.SelectedValue))
  2320. {
  2321. // 工件A
  2322. if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeA))
  2323. {
  2324. DataGridViewRow dgvr = new DataGridViewRow();
  2325. DataGridViewRow dgvr1 = new DataGridViewRow();
  2326. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2327. {
  2328. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2329. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2330. }
  2331. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2332. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2333. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2334. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2335. this.dataGridView2.Rows.Add(dgvr);
  2336. this.dataGridView3.Rows.Add(dgvr1);
  2337. }
  2338. // 工件B
  2339. else if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeB))
  2340. {
  2341. DataGridViewRow dgvr = new DataGridViewRow();
  2342. DataGridViewRow dgvr1 = new DataGridViewRow();
  2343. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2344. {
  2345. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2346. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2347. }
  2348. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2349. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2350. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2351. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2352. this.dataGridView2.Rows.Add(dgvr);
  2353. this.dataGridView3.Rows.Add(dgvr1);
  2354. dgvr = new DataGridViewRow();
  2355. dgvr1 = new DataGridViewRow();
  2356. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2357. {
  2358. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2359. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2360. }
  2361. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2362. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2363. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2364. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2365. this.dataGridView2.Rows.Add(dgvr);
  2366. this.dataGridView3.Rows.Add(dgvr1);
  2367. }
  2368. // 工件C
  2369. else if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeC))
  2370. {
  2371. DataGridViewRow dgvr = new DataGridViewRow();
  2372. DataGridViewRow dgvr1 = new DataGridViewRow();
  2373. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2374. {
  2375. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2376. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2377. }
  2378. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2379. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2380. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2381. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2382. this.dataGridView2.Rows.Add(dgvr);
  2383. this.dataGridView3.Rows.Add(dgvr1);
  2384. dgvr = new DataGridViewRow();
  2385. dgvr1 = new DataGridViewRow();
  2386. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2387. {
  2388. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2389. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2390. }
  2391. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2392. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2393. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2394. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2395. this.dataGridView2.Rows.Add(dgvr);
  2396. this.dataGridView3.Rows.Add(dgvr1);
  2397. dgvr = new DataGridViewRow();
  2398. dgvr1 = new DataGridViewRow();
  2399. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2400. {
  2401. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2402. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2403. }
  2404. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameC;
  2405. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueC + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorC;
  2406. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameC;
  2407. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueC + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorC;
  2408. this.dataGridView2.Rows.Add(dgvr);
  2409. this.dataGridView3.Rows.Add(dgvr1);
  2410. }
  2411. // 工件D
  2412. else if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeD))
  2413. {
  2414. DataGridViewRow dgvr = new DataGridViewRow();
  2415. DataGridViewRow dgvr1 = new DataGridViewRow();
  2416. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2417. {
  2418. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2419. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2420. }
  2421. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2422. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2423. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2424. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2425. this.dataGridView2.Rows.Add(dgvr);
  2426. this.dataGridView3.Rows.Add(dgvr1);
  2427. dgvr = new DataGridViewRow();
  2428. dgvr1 = new DataGridViewRow();
  2429. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2430. {
  2431. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2432. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2433. }
  2434. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2435. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2436. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2437. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2438. this.dataGridView2.Rows.Add(dgvr);
  2439. this.dataGridView3.Rows.Add(dgvr1);
  2440. dgvr = new DataGridViewRow();
  2441. dgvr1 = new DataGridViewRow();
  2442. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2443. {
  2444. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2445. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2446. }
  2447. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameC;
  2448. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueC + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorC;
  2449. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameC;
  2450. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueC + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorC;
  2451. this.dataGridView2.Rows.Add(dgvr);
  2452. this.dataGridView3.Rows.Add(dgvr1);
  2453. dgvr = new DataGridViewRow();
  2454. dgvr1 = new DataGridViewRow();
  2455. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2456. {
  2457. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2458. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2459. }
  2460. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameD;
  2461. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueD + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorD;
  2462. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameD;
  2463. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueD + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorD;
  2464. this.dataGridView2.Rows.Add(dgvr);
  2465. this.dataGridView3.Rows.Add(dgvr1);
  2466. }
  2467. // 工件E
  2468. else if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeE))
  2469. {
  2470. DataGridViewRow dgvr = new DataGridViewRow();
  2471. DataGridViewRow dgvr1 = new DataGridViewRow();
  2472. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2473. {
  2474. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2475. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2476. }
  2477. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2478. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2479. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA;
  2480. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA;
  2481. this.dataGridView2.Rows.Add(dgvr);
  2482. this.dataGridView3.Rows.Add(dgvr1);
  2483. dgvr = new DataGridViewRow();
  2484. dgvr1 = new DataGridViewRow();
  2485. foreach (DataGridViewColumn c in this.dataGridView2.Columns)
  2486. {
  2487. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2488. dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  2489. }
  2490. dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2491. dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2492. dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB;
  2493. dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB;
  2494. this.dataGridView2.Rows.Add(dgvr);
  2495. this.dataGridView3.Rows.Add(dgvr1);
  2496. }
  2497. foreach (DataGridViewColumn c in this.dataGridView3.Columns)
  2498. {
  2499. this.pointDataTables[dataTableIndex].Columns.Add(c.Name);
  2500. }
  2501. for (int r = 0; r < this.dataGridView3.Rows.Count; r++)
  2502. {
  2503. DataRow dataRow = this.pointDataTables[dataTableIndex].NewRow();
  2504. for (int c = 0; c < this.dataGridView3.Rows[r].Cells.Count; c++)
  2505. {
  2506. dataRow[this.dataGridView3.Columns[c].Name] = this.dataGridView3.Rows[r].Cells[c].Value;
  2507. }
  2508. this.pointDataTables[dataTableIndex].Rows.Add(dataRow);
  2509. }
  2510. }
  2511. }
  2512. }
  2513. }
  2514. /// <summary>
  2515. /// 画布绘制
  2516. /// </summary>
  2517. /// <param name="sender"></param>
  2518. /// <param name="e"></param>
  2519. private void Panel_Paint(object sender, PaintEventArgs e)
  2520. {
  2521. if (this.documentWorkspace.CompositionSurface != null)
  2522. {
  2523. //
  2524. // 以下是计算绘制图片的位置和大小并绘制图片
  2525. //
  2526. Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
  2527. int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
  2528. int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
  2529. int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
  2530. int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
  2531. //
  2532. // 以下是绘制网格、标注、测量、视场等开始
  2533. //
  2534. e.Graphics.TranslateTransform(x, y);
  2535. e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
  2536. Draw(e.Graphics);
  2537. if (this.listView1.SelectedItems.Count > 0 && this.dataGridView1.SelectedCells.Count > 0)
  2538. {
  2539. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value.ToString();
  2540. //保存处理后的图片
  2541. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  2542. List<Bitmap> tempBit = new List<Bitmap>();
  2543. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  2544. originalBit.Tag = pantographRatio;
  2545. tempBit.Add(originalBit);
  2546. Graphics graphics;
  2547. Bitmap newBit;
  2548. Bitmap processedBit;
  2549. if (this.documentItems[this.listView1.FocusedItem.Index].phaseModels.Count != 0
  2550. && this.documentItems[this.listView1.FocusedItem.Index].phaseModels[0].mat != null)
  2551. {
  2552. processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
  2553. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2554. graphics = Graphics.FromImage(newBit);
  2555. graphics.DrawImage(processedBit, new PointF(0, 0));
  2556. Draw(graphics);
  2557. newBit.Tag = pantographRatio;
  2558. tempBit.Add(newBit);
  2559. }
  2560. else
  2561. {
  2562. newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2563. graphics = Graphics.FromImage(newBit);
  2564. Draw(graphics);
  2565. newBit.Tag = pantographRatio;
  2566. tempBit.Add(newBit);
  2567. }
  2568. Draw(graphics);
  2569. newBit.Tag = pantographRatio;
  2570. tempBit.Add(newBit);
  2571. if (bitDic1.ContainsKey(tag))
  2572. bitDic1[tag] = tempBit;
  2573. }
  2574. e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
  2575. e.Graphics.TranslateTransform(-x, -y);
  2576. }
  2577. }
  2578. /// <summary>
  2579. /// 获取辅助线和测量点样式
  2580. /// </summary>
  2581. public void RefreshPanel()
  2582. {
  2583. // 辅助线样式
  2584. CompoundRatioStyleModel compoundRatioStyleModelGuideStyle = XmlSerializeHelper.DESerializer<CompoundRatioStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GuideStyle.xml", FileMode.Open));
  2585. if (compoundRatioStyleModelGuideStyle.guideStyle != null)
  2586. {
  2587. this.lineFont = compoundRatioStyleModelGuideStyle.guideStyle.font;
  2588. this.lineFontSize = compoundRatioStyleModelGuideStyle.guideStyle.fontSize;
  2589. this.lineColor = compoundRatioStyleModelGuideStyle.guideStyle.lineColor;
  2590. this.linesNumber = compoundRatioStyleModelGuideStyle.guideStyle.linesNumber;
  2591. this.lineWidth = compoundRatioStyleModelGuideStyle.guideStyle.lineWidth;
  2592. if(unitLength != 0)
  2593. this.lineSpacing = (float)(compoundRatioStyleModelGuideStyle.guideStyle.spacing / unitLength);
  2594. if (this.linesNumber == 3)
  2595. {
  2596. this.dataGridView2.Columns[5].Visible = false;
  2597. this.dataGridView2.Columns[6].Visible = false;
  2598. this.dataGridView3.Columns[5].Visible = false;
  2599. this.dataGridView3.Columns[6].Visible = false;
  2600. }
  2601. else if(this.linesNumber == 4)
  2602. {
  2603. this.dataGridView2.Columns[5].Visible = true;
  2604. this.dataGridView2.Columns[6].Visible = false;
  2605. this.dataGridView3.Columns[5].Visible = true;
  2606. this.dataGridView3.Columns[6].Visible = false;
  2607. }
  2608. else if (this.linesNumber == 5)
  2609. {
  2610. this.dataGridView2.Columns[5].Visible = true;
  2611. this.dataGridView2.Columns[6].Visible = true;
  2612. this.dataGridView3.Columns[5].Visible = true;
  2613. this.dataGridView3.Columns[6].Visible = true;
  2614. }
  2615. }
  2616. // 测量点样式
  2617. CompoundRatioStyleModel compoundRatioStyleModelSurvePointStyle = XmlSerializeHelper.DESerializer<CompoundRatioStyleModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\SurvePointStyle.xml", FileMode.Open));
  2618. if (compoundRatioStyleModelSurvePointStyle.survePointStyle != null)
  2619. {
  2620. this.pointFont = compoundRatioStyleModelSurvePointStyle.survePointStyle.font;
  2621. this.pointFontSize = compoundRatioStyleModelSurvePointStyle.survePointStyle.fontSize;
  2622. this.pointColor = compoundRatioStyleModelSurvePointStyle.survePointStyle.pointColor;
  2623. this.pointDiameter = (float)(compoundRatioStyleModelSurvePointStyle.survePointStyle.pointDiameter / unitLength);
  2624. this.pointMarkerSymbol = compoundRatioStyleModelSurvePointStyle.survePointStyle.pointMarkerSymbol;
  2625. this.pointStyle = compoundRatioStyleModelSurvePointStyle.survePointStyle.pointStyle;
  2626. this.pointWidth = compoundRatioStyleModelSurvePointStyle.survePointStyle.pointWidth;
  2627. }
  2628. this.documentWorkspace.Refresh();
  2629. }
  2630. /// <summary>
  2631. /// 绘制
  2632. /// </summary>
  2633. private void Draw(Graphics graphics)
  2634. {
  2635. // 抗锯齿
  2636. graphics.SmoothingMode = SmoothingMode.AntiAlias;
  2637. // 以下为绘制样式
  2638. Pen linePen = new Pen(Color.FromArgb(this.lineColor), this.lineWidth);
  2639. Pen pointPen = new Pen(Color.FromArgb(this.pointColor), this.pointWidth);
  2640. Font pointFont = new Font(this.pointFont, this.pointFontSize);
  2641. Font lineFont = new Font(this.lineFont, this.lineFontSize);
  2642. SolidBrush brush = new SolidBrush(Color.FromArgb(this.pointColor));
  2643. /// 测量点操作限制
  2644. if(this.dataGridView1.SelectedRows.Count > 0)
  2645. {
  2646. this.button6.Enabled = this.pointDrawkb;
  2647. this.button7.Enabled = this.pointDrawkb;
  2648. this.button8.Enabled = this.pointDrawkb;
  2649. }
  2650. #region 绘制辅助线
  2651. // 线条数为三
  2652. if (this.linesNumber == 3)
  2653. {
  2654. // 绘制辅助线
  2655. 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));
  2656. graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2, this.documentWorkspace.CompositionSurface.Height));
  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. }
  2659. // 线条数为四
  2660. else if (this.linesNumber == 4)
  2661. {
  2662. // 绘制辅助线
  2663. 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));
  2664. 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));
  2665. 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));
  2666. 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));
  2667. }
  2668. // 线条数为五
  2669. else if (this.linesNumber == 5)
  2670. {
  2671. // 绘制辅助线
  2672. 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));
  2673. 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));
  2674. graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2, 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 + 2 * this.lineSpacing, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing, this.documentWorkspace.CompositionSurface.Height));
  2677. }
  2678. #endregion
  2679. if (this.dataGridView1.SelectedCells.Count == 0
  2680. || this.pointRectangleFs.Count == 0
  2681. || this.dataGridView1.SelectedCells[0].RowIndex >= this.pointRectangleFs.Count)
  2682. return;
  2683. RectangleF rectangleF = new RectangleF();
  2684. #region 线条数为三时的定义
  2685. List<RectangleF> threeLine1RectangleFs = new List<RectangleF>();
  2686. List<RectangleF> threeLine2RectangleFs = new List<RectangleF>();
  2687. List<RectangleF> threeLine3RectangleFs = new List<RectangleF>();
  2688. int threeLine1PointCount = 0;
  2689. int threeLine2PointCount = 0;
  2690. int threeLine3PointCount = 0;
  2691. #endregion
  2692. #region 线条数为四时的定义
  2693. List<RectangleF> fourLine1RectangleFs = new List<RectangleF>();
  2694. List<RectangleF> fourLine2RectangleFs = new List<RectangleF>();
  2695. List<RectangleF> fourLine3RectangleFs = new List<RectangleF>();
  2696. List<RectangleF> fourLine4RectangleFs = new List<RectangleF>();
  2697. int fourLine1PointCount = 0;
  2698. int fourLine2PointCount = 0;
  2699. int fourLine3PointCount = 0;
  2700. int fourLine4PointCount = 0;
  2701. #endregion
  2702. #region 线条数为五时的定义
  2703. List<RectangleF> fiveLine1RectangleFs = new List<RectangleF>();
  2704. List<RectangleF> fiveLine2RectangleFs = new List<RectangleF>();
  2705. List<RectangleF> fiveLine3RectangleFs = new List<RectangleF>();
  2706. List<RectangleF> fiveLine4RectangleFs = new List<RectangleF>();
  2707. List<RectangleF> fiveLine5RectangleFs = new List<RectangleF>();
  2708. int fiveLine1PointCount = 0;
  2709. int fiveLine2PointCount = 0;
  2710. int fiveLine3PointCount = 0;
  2711. int fiveLine4PointCount = 0;
  2712. int fiveLine5PointCount = 0;
  2713. #endregion
  2714. #region 循环用于绘制测量点的矩形的集合
  2715. for (int i = 0; i < this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count; i++)
  2716. {
  2717. #region 更改样式时的自动绘制
  2718. rectangleF = this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i];
  2719. // 更新矩形的宽高与测量点直径保持一致
  2720. rectangleF.Width = this.pointDiameter;
  2721. rectangleF.Height = this.pointDiameter;
  2722. // 线条数为三
  2723. if (this.linesNumber == 3)
  2724. {
  2725. // 第一条线
  2726. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2)
  2727. {
  2728. threeLine1PointCount++;
  2729. if (this.type.Equals(constTypeA))
  2730. {
  2731. if (threeLine1PointCount <= 3)
  2732. threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2733. }
  2734. else if (this.type.Equals(constTypeB))
  2735. {
  2736. if (threeLine1PointCount <= 4)
  2737. threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2738. }
  2739. else if (this.type.Equals(constTypeC))
  2740. {
  2741. if (threeLine1PointCount <= 5)
  2742. threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2743. }
  2744. else if (this.type.Equals(constTypeD))
  2745. {
  2746. if (threeLine1PointCount <= 6)
  2747. threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2748. }
  2749. else if (this.type.Equals(constTypeE))
  2750. {
  2751. if (threeLine1PointCount <= 4)
  2752. threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2753. }
  2754. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.pointDiameter / 2;
  2755. }
  2756. // 第二条线
  2757. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2
  2758. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2)
  2759. {
  2760. threeLine2PointCount++;
  2761. if (this.type.Equals(constTypeA))
  2762. {
  2763. if (threeLine2PointCount <= 3)
  2764. threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2765. }
  2766. else if (this.type.Equals(constTypeB))
  2767. {
  2768. if (threeLine2PointCount <= 4)
  2769. threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2770. }
  2771. else if (this.type.Equals(constTypeC))
  2772. {
  2773. if (threeLine2PointCount <= 5)
  2774. threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2775. }
  2776. else if (this.type.Equals(constTypeD))
  2777. {
  2778. if (threeLine2PointCount <= 6)
  2779. threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2780. }
  2781. else if (this.type.Equals(constTypeE))
  2782. {
  2783. if (threeLine2PointCount <= 4)
  2784. threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2785. }
  2786. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.pointDiameter / 2;
  2787. }
  2788. // 第三条线
  2789. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.pointDiameter / 2)
  2790. {
  2791. threeLine3PointCount++;
  2792. if (this.type.Equals(constTypeA))
  2793. {
  2794. if (threeLine3PointCount <= 3)
  2795. threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2796. }
  2797. else if (this.type.Equals(constTypeB))
  2798. {
  2799. if (threeLine3PointCount <= 4)
  2800. threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2801. }
  2802. else if (this.type.Equals(constTypeC))
  2803. {
  2804. if (threeLine3PointCount <= 5)
  2805. threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2806. }
  2807. else if (this.type.Equals(constTypeD))
  2808. {
  2809. if (threeLine3PointCount <= 6)
  2810. threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2811. }
  2812. else if (this.type.Equals(constTypeE))
  2813. {
  2814. if (threeLine3PointCount <= 4)
  2815. threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2816. }
  2817. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.pointDiameter / 2;
  2818. }
  2819. }
  2820. // 线条数为四
  2821. else if (this.linesNumber == 4)
  2822. {
  2823. // 第一条线
  2824. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing)
  2825. {
  2826. fourLine1PointCount++;
  2827. if (this.type.Equals(constTypeA))
  2828. {
  2829. if (fourLine1PointCount <= 3)
  2830. fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2831. }
  2832. else if (this.type.Equals(constTypeB))
  2833. {
  2834. if (fourLine1PointCount <= 4)
  2835. fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2836. }
  2837. else if (this.type.Equals(constTypeC))
  2838. {
  2839. if (fourLine1PointCount <= 5)
  2840. fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2841. }
  2842. else if (this.type.Equals(constTypeD))
  2843. {
  2844. if (fourLine1PointCount <= 6)
  2845. fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2846. }
  2847. else if (this.type.Equals(constTypeE))
  2848. {
  2849. if (fourLine1PointCount <= 4)
  2850. fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2851. }
  2852. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2 - this.pointDiameter / 2;
  2853. }
  2854. // 第二条线
  2855. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2
  2856. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing)
  2857. {
  2858. fourLine2PointCount++;
  2859. if (this.type.Equals(constTypeA))
  2860. {
  2861. if (fourLine2PointCount <= 3)
  2862. fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2863. }
  2864. else if (this.type.Equals(constTypeB))
  2865. {
  2866. if (fourLine2PointCount <= 4)
  2867. fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2868. }
  2869. else if (this.type.Equals(constTypeC))
  2870. {
  2871. if (fourLine2PointCount <= 5)
  2872. fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2873. }
  2874. else if (this.type.Equals(constTypeD))
  2875. {
  2876. if (fourLine2PointCount <= 6)
  2877. fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2878. }
  2879. else if (this.type.Equals(constTypeE))
  2880. {
  2881. if (fourLine2PointCount <= 4)
  2882. fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2883. }
  2884. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 - this.pointDiameter / 2;
  2885. }
  2886. // 第三条线
  2887. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing
  2888. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2)
  2889. {
  2890. fourLine3PointCount++;
  2891. if (this.type.Equals(constTypeA))
  2892. {
  2893. if (fourLine3PointCount <= 3)
  2894. fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2895. }
  2896. else if (this.type.Equals(constTypeB))
  2897. {
  2898. if (fourLine3PointCount <= 4)
  2899. fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2900. }
  2901. else if (this.type.Equals(constTypeC))
  2902. {
  2903. if (fourLine3PointCount <= 5)
  2904. fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2905. }
  2906. else if (this.type.Equals(constTypeD))
  2907. {
  2908. if (fourLine3PointCount <= 6)
  2909. fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2910. }
  2911. else if (this.type.Equals(constTypeE))
  2912. {
  2913. if (fourLine3PointCount <= 4)
  2914. fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2915. }
  2916. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 - this.pointDiameter / 2;
  2917. }
  2918. // 第四条线
  2919. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing)
  2920. {
  2921. fourLine4PointCount++;
  2922. if (this.type.Equals(constTypeA))
  2923. {
  2924. if (fourLine4PointCount <= 3)
  2925. fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2926. }
  2927. else if (this.type.Equals(constTypeB))
  2928. {
  2929. if (fourLine4PointCount <= 4)
  2930. fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2931. }
  2932. else if (this.type.Equals(constTypeC))
  2933. {
  2934. if (fourLine4PointCount <= 5)
  2935. fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2936. }
  2937. else if (this.type.Equals(constTypeD))
  2938. {
  2939. if (fourLine4PointCount <= 6)
  2940. fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2941. }
  2942. else if (this.type.Equals(constTypeE))
  2943. {
  2944. if (fourLine4PointCount <= 4)
  2945. fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2946. }
  2947. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 - this.pointDiameter / 2;
  2948. }
  2949. }
  2950. // 线条数为五
  2951. else if(this.linesNumber == 5)
  2952. {
  2953. // 第一条线
  2954. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2)
  2955. {
  2956. fiveLine1PointCount++;
  2957. if (this.type.Equals(constTypeA))
  2958. {
  2959. if (fiveLine1PointCount <= 3)
  2960. fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2961. }
  2962. else if (this.type.Equals(constTypeB))
  2963. {
  2964. if (fiveLine1PointCount <= 4)
  2965. fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2966. }
  2967. else if (this.type.Equals(constTypeC))
  2968. {
  2969. if (fiveLine1PointCount <= 5)
  2970. fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2971. }
  2972. else if (this.type.Equals(constTypeD))
  2973. {
  2974. if (fiveLine1PointCount <= 6)
  2975. fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2976. }
  2977. else if (this.type.Equals(constTypeE))
  2978. {
  2979. if (fiveLine1PointCount <= 4)
  2980. fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2981. }
  2982. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing - this.pointDiameter / 2;
  2983. }
  2984. // 第二条线
  2985. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2
  2986. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2)
  2987. {
  2988. fiveLine2PointCount++;
  2989. if (this.type.Equals(constTypeA))
  2990. {
  2991. if (fiveLine2PointCount <= 3)
  2992. fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2993. }
  2994. else if (this.type.Equals(constTypeB))
  2995. {
  2996. if (fiveLine2PointCount <= 4)
  2997. fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  2998. }
  2999. else if (this.type.Equals(constTypeC))
  3000. {
  3001. if (fiveLine2PointCount <= 5)
  3002. fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3003. }
  3004. else if (this.type.Equals(constTypeD))
  3005. {
  3006. if (fiveLine2PointCount <= 6)
  3007. fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3008. }
  3009. else if (this.type.Equals(constTypeE))
  3010. {
  3011. if (fiveLine2PointCount <= 4)
  3012. fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3013. }
  3014. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.pointDiameter / 2;
  3015. }
  3016. // 第三条线
  3017. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2
  3018. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2)
  3019. {
  3020. fiveLine3PointCount++;
  3021. if (this.type.Equals(constTypeA))
  3022. {
  3023. if (fiveLine3PointCount <= 3)
  3024. fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3025. }
  3026. else if (this.type.Equals(constTypeB))
  3027. {
  3028. if (fiveLine3PointCount <= 4)
  3029. fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3030. }
  3031. else if (this.type.Equals(constTypeC))
  3032. {
  3033. if (fiveLine3PointCount <= 5)
  3034. fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3035. }
  3036. else if (this.type.Equals(constTypeD))
  3037. {
  3038. if (fiveLine3PointCount <= 6)
  3039. fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3040. }
  3041. else if (this.type.Equals(constTypeE))
  3042. {
  3043. if (fiveLine3PointCount <= 4)
  3044. fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3045. }
  3046. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.pointDiameter / 2;
  3047. }
  3048. // 第四条线
  3049. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2
  3050. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2)
  3051. {
  3052. fiveLine4PointCount++;
  3053. if (this.type.Equals(constTypeA))
  3054. {
  3055. if (fiveLine4PointCount <= 3)
  3056. fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3057. }
  3058. else if (this.type.Equals(constTypeB))
  3059. {
  3060. if (fiveLine4PointCount <= 4)
  3061. fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3062. }
  3063. else if (this.type.Equals(constTypeC))
  3064. {
  3065. if (fiveLine4PointCount <= 5)
  3066. fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3067. }
  3068. else if (this.type.Equals(constTypeD))
  3069. {
  3070. if (fiveLine4PointCount <= 6)
  3071. fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3072. }
  3073. else if (this.type.Equals(constTypeE))
  3074. {
  3075. if (fiveLine4PointCount <= 4)
  3076. fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3077. }
  3078. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.pointDiameter / 2;
  3079. }
  3080. // 第五条线
  3081. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2)
  3082. {
  3083. fiveLine5PointCount++;
  3084. if (this.type.Equals(constTypeA))
  3085. {
  3086. if (fiveLine5PointCount <= 3)
  3087. fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3088. }
  3089. else if (this.type.Equals(constTypeB))
  3090. {
  3091. if (fiveLine5PointCount <= 4)
  3092. fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3093. }
  3094. else if (this.type.Equals(constTypeC))
  3095. {
  3096. if (fiveLine5PointCount <= 5)
  3097. fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3098. }
  3099. else if (this.type.Equals(constTypeD))
  3100. {
  3101. if (fiveLine5PointCount <= 6)
  3102. fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3103. }
  3104. else if (this.type.Equals(constTypeE))
  3105. {
  3106. if (fiveLine5PointCount <= 4)
  3107. fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3108. }
  3109. rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing - this.pointDiameter / 2;
  3110. }
  3111. }
  3112. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i] = rectangleF;
  3113. #endregion
  3114. #region 绘制测量点
  3115. // 选中点
  3116. if (i == selected)
  3117. {
  3118. // 绘制选中边框
  3119. 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)));
  3120. }
  3121. // 点样式为空心
  3122. if (this.pointStyle == 0)
  3123. graphics.DrawEllipse(pointPen, this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3124. // 实心
  3125. else
  3126. graphics.FillEllipse(brush, this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]);
  3127. // 点标记
  3128. if(pointMarkerSymbol)
  3129. 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));
  3130. #endregion
  3131. }
  3132. #endregion
  3133. // 测量点间距
  3134. float a1 = 0, b1 = 0, c1 = 0, d1 = 0;
  3135. float a2 = 0, b2 = 0, c2 = 0, d2 = 0;
  3136. float a3 = 0, b3 = 0, c3 = 0, d3 = 0;
  3137. float a4 = 0, b4 = 0, c4 = 0, d4 = 0;
  3138. float a5 = 0, b5 = 0, c5 = 0, d5 = 0;
  3139. float w = 0;
  3140. // 初始化中间数据
  3141. if(lengthL1.Count > 0 && lengthL1.Count > this.dataGridView1.SelectedCells[0].RowIndex)
  3142. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex] = new List<decimal>();
  3143. if (lengthL2.Count > 0 && lengthL2.Count > this.dataGridView1.SelectedCells[0].RowIndex)
  3144. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex] = new List<decimal>();
  3145. if (lengthL3.Count > 0 && lengthL3.Count > this.dataGridView1.SelectedCells[0].RowIndex)
  3146. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex] = new List<decimal>();
  3147. if (lengthL4.Count > 0 && lengthL4.Count > this.dataGridView1.SelectedCells[0].RowIndex)
  3148. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex] = new List<decimal>();
  3149. if (lengthL5.Count > 0 && lengthL5.Count > this.dataGridView1.SelectedCells[0].RowIndex)
  3150. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex] = new List<decimal>();
  3151. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count > 0)
  3152. {
  3153. #region 是否在图像上显示数据
  3154. // 文本尺寸
  3155. SizeF sizeF;
  3156. #region 线条数为三时的辅助线文本绘制
  3157. if (this.linesNumber == 3)
  3158. {
  3159. if (this.type.Equals(constTypeA))
  3160. {
  3161. if (threeLine1RectangleFs.Count == 2)
  3162. {
  3163. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3164. }
  3165. else if (threeLine1RectangleFs.Count == 3)
  3166. {
  3167. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3168. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3169. }
  3170. if (threeLine2RectangleFs.Count == 2)
  3171. {
  3172. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3173. }
  3174. else if (threeLine2RectangleFs.Count == 3)
  3175. {
  3176. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3177. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3178. }
  3179. if (threeLine3RectangleFs.Count == 2)
  3180. {
  3181. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3182. }
  3183. else if (threeLine3RectangleFs.Count == 3)
  3184. {
  3185. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3186. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3187. }
  3188. if (threeLine1RectangleFs.Count > 1)
  3189. {
  3190. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3191. if (this.checkBox1.Checked)
  3192. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3193. lineFont, new SolidBrush(Color.Black),
  3194. new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2));
  3195. a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y);
  3196. }
  3197. if (threeLine2RectangleFs.Count > 1)
  3198. {
  3199. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3200. if (this.checkBox1.Checked)
  3201. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3202. lineFont, new SolidBrush(Color.Black),
  3203. new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2));
  3204. a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y);
  3205. }
  3206. if (threeLine3RectangleFs.Count > 1)
  3207. {
  3208. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3209. if (this.checkBox1.Checked)
  3210. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3211. lineFont, new SolidBrush(Color.Black),
  3212. new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2));
  3213. a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y);
  3214. }
  3215. }
  3216. else if (this.type.Equals(constTypeB))
  3217. {
  3218. if (threeLine1RectangleFs.Count == 2)
  3219. {
  3220. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3221. }
  3222. else if (threeLine1RectangleFs.Count == 3)
  3223. {
  3224. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3225. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3226. }
  3227. else if (threeLine1RectangleFs.Count == 4)
  3228. {
  3229. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3230. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3231. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength));
  3232. }
  3233. if (threeLine2RectangleFs.Count == 2)
  3234. {
  3235. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3236. }
  3237. else if (threeLine2RectangleFs.Count == 3)
  3238. {
  3239. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3240. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3241. }
  3242. else if (threeLine2RectangleFs.Count == 4)
  3243. {
  3244. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3245. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3246. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength));
  3247. }
  3248. if (threeLine3RectangleFs.Count == 2)
  3249. {
  3250. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3251. }
  3252. else if (threeLine2RectangleFs.Count == 3)
  3253. {
  3254. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3255. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3256. }
  3257. else if (threeLine3RectangleFs.Count == 4)
  3258. {
  3259. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3260. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3261. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength));
  3262. }
  3263. if (threeLine1RectangleFs.Count > 1)
  3264. {
  3265. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3266. if (this.checkBox1.Checked)
  3267. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3268. lineFont, new SolidBrush(Color.Black),
  3269. new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2));
  3270. a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y);
  3271. }
  3272. if (threeLine1RectangleFs.Count > 3)
  3273. {
  3274. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3275. if (this.checkBox1.Checked)
  3276. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3277. lineFont, new SolidBrush(Color.Black),
  3278. new PointF(threeLine1RectangleFs[2].X - sizeF.Width / 4, (threeLine1RectangleFs[2].Y + threeLine1RectangleFs[3].Y) / 2));
  3279. b1 = Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y);
  3280. }
  3281. if (threeLine2RectangleFs.Count > 1)
  3282. {
  3283. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3284. if (this.checkBox1.Checked)
  3285. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3286. lineFont, new SolidBrush(Color.Black),
  3287. new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2));
  3288. a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y);
  3289. }
  3290. if (threeLine2RectangleFs.Count > 3)
  3291. {
  3292. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3293. if (this.checkBox1.Checked)
  3294. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3295. lineFont, new SolidBrush(Color.Black),
  3296. new PointF(threeLine2RectangleFs[2].X - sizeF.Width / 4, (threeLine2RectangleFs[2].Y + threeLine2RectangleFs[3].Y) / 2));
  3297. b2 = Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y);
  3298. }
  3299. if (threeLine3RectangleFs.Count > 1)
  3300. {
  3301. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3302. if (this.checkBox1.Checked)
  3303. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3304. lineFont, new SolidBrush(Color.Black),
  3305. new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2));
  3306. a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y);
  3307. }
  3308. if (threeLine3RectangleFs.Count > 3)
  3309. {
  3310. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3311. if (this.checkBox1.Checked)
  3312. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3313. lineFont, new SolidBrush(Color.Black),
  3314. new PointF(threeLine3RectangleFs[2].X - sizeF.Width / 4, (threeLine3RectangleFs[2].Y + threeLine3RectangleFs[3].Y) / 2));
  3315. b3 = Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y);
  3316. }
  3317. }
  3318. else if (this.type.Equals(constTypeC))
  3319. {
  3320. if (threeLine1RectangleFs.Count == 2)
  3321. {
  3322. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3323. }
  3324. else if (threeLine1RectangleFs.Count == 3)
  3325. {
  3326. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3327. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3328. }
  3329. else if (threeLine1RectangleFs.Count == 4)
  3330. {
  3331. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3332. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3333. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength));
  3334. }
  3335. else if (threeLine1RectangleFs.Count == 5)
  3336. {
  3337. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3338. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3339. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength));
  3340. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength));
  3341. }
  3342. if (threeLine2RectangleFs.Count == 2)
  3343. {
  3344. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3345. }
  3346. else if (threeLine2RectangleFs.Count == 3)
  3347. {
  3348. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3349. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3350. }
  3351. else if (threeLine2RectangleFs.Count == 4)
  3352. {
  3353. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3354. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3355. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength));
  3356. }
  3357. else if (threeLine2RectangleFs.Count == 5)
  3358. {
  3359. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3360. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3361. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength));
  3362. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength));
  3363. }
  3364. if (threeLine3RectangleFs.Count == 2)
  3365. {
  3366. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3367. }
  3368. else if (threeLine2RectangleFs.Count == 3)
  3369. {
  3370. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3371. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3372. }
  3373. else if (threeLine2RectangleFs.Count == 4)
  3374. {
  3375. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3376. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3377. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength));
  3378. }
  3379. else if (threeLine3RectangleFs.Count == 5)
  3380. {
  3381. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3382. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3383. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength));
  3384. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength));
  3385. }
  3386. if (threeLine1RectangleFs.Count > 1)
  3387. {
  3388. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3389. if (this.checkBox1.Checked)
  3390. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3391. lineFont, new SolidBrush(Color.Black),
  3392. new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2));
  3393. a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y);
  3394. }
  3395. if (threeLine1RectangleFs.Count > 2)
  3396. {
  3397. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3398. if (this.checkBox1.Checked)
  3399. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3400. lineFont, new SolidBrush(Color.Black),
  3401. new PointF(threeLine1RectangleFs[1].X - sizeF.Width / 4, (threeLine1RectangleFs[1].Y + threeLine1RectangleFs[2].Y) / 2));
  3402. c1 = Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y);
  3403. }
  3404. if (threeLine1RectangleFs.Count > 4)
  3405. {
  3406. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3407. if (this.checkBox1.Checked)
  3408. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  3409. lineFont, new SolidBrush(Color.Black),
  3410. new PointF(threeLine1RectangleFs[3].X - sizeF.Width / 4, (threeLine1RectangleFs[3].Y + threeLine1RectangleFs[4].Y) / 2));
  3411. b1 = Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y);
  3412. }
  3413. if (threeLine2RectangleFs.Count > 1)
  3414. {
  3415. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3416. if (this.checkBox1.Checked)
  3417. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3418. lineFont, new SolidBrush(Color.Black),
  3419. new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2));
  3420. a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y);
  3421. }
  3422. if (threeLine2RectangleFs.Count > 2)
  3423. {
  3424. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3425. if (this.checkBox1.Checked)
  3426. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3427. lineFont, new SolidBrush(Color.Black),
  3428. new PointF(threeLine2RectangleFs[1].X - sizeF.Width / 4, (threeLine2RectangleFs[1].Y + threeLine2RectangleFs[2].Y) / 2));
  3429. c2 = Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y);
  3430. }
  3431. if (threeLine2RectangleFs.Count > 4)
  3432. {
  3433. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3434. if (this.checkBox1.Checked)
  3435. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  3436. lineFont, new SolidBrush(Color.Black),
  3437. new PointF(threeLine2RectangleFs[3].X - sizeF.Width / 4, (threeLine2RectangleFs[3].Y + threeLine2RectangleFs[4].Y) / 2));
  3438. b2 = Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y);
  3439. }
  3440. if (threeLine3RectangleFs.Count > 1)
  3441. {
  3442. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3443. if (this.checkBox1.Checked)
  3444. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3445. lineFont, new SolidBrush(Color.Black),
  3446. new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2));
  3447. a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y);
  3448. }
  3449. if (threeLine3RectangleFs.Count > 2)
  3450. {
  3451. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3452. if (this.checkBox1.Checked)
  3453. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3454. lineFont, new SolidBrush(Color.Black),
  3455. new PointF(threeLine3RectangleFs[1].X - sizeF.Width / 4, (threeLine3RectangleFs[1].Y + threeLine3RectangleFs[2].Y) / 2));
  3456. c3 = Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y);
  3457. }
  3458. if (threeLine3RectangleFs.Count > 4)
  3459. {
  3460. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3461. if (this.checkBox1.Checked)
  3462. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  3463. lineFont, new SolidBrush(Color.Black),
  3464. new PointF(threeLine3RectangleFs[3].X - sizeF.Width / 4, (threeLine3RectangleFs[3].Y + threeLine3RectangleFs[4].Y) / 2));
  3465. b3 = Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y);
  3466. }
  3467. }
  3468. else if (this.type.Equals(constTypeD))
  3469. {
  3470. if (threeLine1RectangleFs.Count == 2)
  3471. {
  3472. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3473. }
  3474. else if (threeLine1RectangleFs.Count == 3)
  3475. {
  3476. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3477. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3478. }
  3479. else if (threeLine1RectangleFs.Count == 4)
  3480. {
  3481. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3482. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3483. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength));
  3484. }
  3485. else if (threeLine1RectangleFs.Count == 5)
  3486. {
  3487. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3488. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3489. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength));
  3490. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength));
  3491. }
  3492. else if (threeLine1RectangleFs.Count == 5)
  3493. {
  3494. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3495. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3496. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength));
  3497. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength));
  3498. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[4].Y - threeLine1RectangleFs[5].Y) * this.unitLength));
  3499. }
  3500. if (threeLine2RectangleFs.Count == 2)
  3501. {
  3502. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3503. }
  3504. else if (threeLine2RectangleFs.Count == 3)
  3505. {
  3506. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3507. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3508. }
  3509. else if (threeLine2RectangleFs.Count == 4)
  3510. {
  3511. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3512. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3513. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength));
  3514. }
  3515. else if (threeLine2RectangleFs.Count == 5)
  3516. {
  3517. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3518. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3519. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength));
  3520. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength));
  3521. }
  3522. else if (threeLine2RectangleFs.Count == 5)
  3523. {
  3524. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3525. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3526. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength));
  3527. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength));
  3528. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[4].Y - threeLine2RectangleFs[5].Y) * this.unitLength));
  3529. }
  3530. if (threeLine3RectangleFs.Count == 2)
  3531. {
  3532. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3533. }
  3534. else if (threeLine3RectangleFs.Count == 3)
  3535. {
  3536. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3537. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3538. }
  3539. else if (threeLine3RectangleFs.Count == 4)
  3540. {
  3541. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3542. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3543. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength));
  3544. }
  3545. else if (threeLine3RectangleFs.Count == 5)
  3546. {
  3547. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3548. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3549. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength));
  3550. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength));
  3551. }
  3552. else if (threeLine3RectangleFs.Count == 5)
  3553. {
  3554. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3555. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3556. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength));
  3557. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength));
  3558. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[4].Y - threeLine3RectangleFs[5].Y) * this.unitLength));
  3559. }
  3560. if (threeLine1RectangleFs.Count > 1)
  3561. {
  3562. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3563. if (this.checkBox1.Checked)
  3564. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3565. lineFont, new SolidBrush(Color.Black),
  3566. new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2));
  3567. a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y);
  3568. }
  3569. if (threeLine1RectangleFs.Count > 2)
  3570. {
  3571. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3572. if (this.checkBox1.Checked)
  3573. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3574. lineFont, new SolidBrush(Color.Black),
  3575. new PointF(threeLine1RectangleFs[1].X - sizeF.Width / 4, (threeLine1RectangleFs[1].Y + threeLine1RectangleFs[2].Y) / 2));
  3576. c1 = Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y);
  3577. }
  3578. if (threeLine1RectangleFs.Count > 4)
  3579. {
  3580. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3581. if (this.checkBox1.Checked)
  3582. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  3583. lineFont, new SolidBrush(Color.Black),
  3584. new PointF(threeLine1RectangleFs[3].X - sizeF.Width / 4, (threeLine1RectangleFs[3].Y + threeLine1RectangleFs[4].Y) / 2));
  3585. d1 = Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y);
  3586. }
  3587. if (threeLine1RectangleFs.Count > 5)
  3588. {
  3589. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[4].Y - threeLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3590. if (this.checkBox1.Checked)
  3591. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[4].Y - threeLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  3592. lineFont, new SolidBrush(Color.Black),
  3593. new PointF(threeLine1RectangleFs[4].X - sizeF.Width / 4, (threeLine1RectangleFs[4].Y + threeLine1RectangleFs[5].Y) / 2));
  3594. b1 = Math.Abs(threeLine1RectangleFs[4].Y - threeLine1RectangleFs[5].Y);
  3595. }
  3596. if (threeLine2RectangleFs.Count > 1)
  3597. {
  3598. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3599. if (this.checkBox1.Checked)
  3600. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3601. lineFont, new SolidBrush(Color.Black),
  3602. new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2));
  3603. a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y);
  3604. }
  3605. if (threeLine2RectangleFs.Count > 2)
  3606. {
  3607. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3608. if (this.checkBox1.Checked)
  3609. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3610. lineFont, new SolidBrush(Color.Black),
  3611. new PointF(threeLine2RectangleFs[1].X - sizeF.Width / 4, (threeLine2RectangleFs[1].Y + threeLine2RectangleFs[2].Y) / 2));
  3612. c2 = Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y);
  3613. }
  3614. if (threeLine2RectangleFs.Count > 4)
  3615. {
  3616. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3617. if (this.checkBox1.Checked)
  3618. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  3619. lineFont, new SolidBrush(Color.Black),
  3620. new PointF(threeLine2RectangleFs[3].X - sizeF.Width / 4, (threeLine2RectangleFs[3].Y + threeLine2RectangleFs[4].Y) / 2));
  3621. d2 = Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y);
  3622. }
  3623. if (threeLine2RectangleFs.Count > 5)
  3624. {
  3625. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[4].Y - threeLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3626. if (this.checkBox1.Checked)
  3627. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[4].Y - threeLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  3628. lineFont, new SolidBrush(Color.Black),
  3629. new PointF(threeLine2RectangleFs[4].X - sizeF.Width / 4, (threeLine2RectangleFs[4].Y + threeLine2RectangleFs[5].Y) / 2));
  3630. b2 = Math.Abs(threeLine2RectangleFs[4].Y - threeLine2RectangleFs[5].Y);
  3631. }
  3632. if (threeLine3RectangleFs.Count > 1)
  3633. {
  3634. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3635. if (this.checkBox1.Checked)
  3636. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3637. lineFont, new SolidBrush(Color.Black),
  3638. new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2));
  3639. a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y);
  3640. }
  3641. if (threeLine3RectangleFs.Count > 2)
  3642. {
  3643. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3644. if (this.checkBox1.Checked)
  3645. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3646. lineFont, new SolidBrush(Color.Black),
  3647. new PointF(threeLine3RectangleFs[1].X - sizeF.Width / 4, (threeLine3RectangleFs[1].Y + threeLine3RectangleFs[2].Y) / 2));
  3648. c3 = Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y);
  3649. }
  3650. if (threeLine3RectangleFs.Count > 4)
  3651. {
  3652. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3653. if (this.checkBox1.Checked)
  3654. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  3655. lineFont, new SolidBrush(Color.Black),
  3656. new PointF(threeLine3RectangleFs[3].X - sizeF.Width / 4, (threeLine3RectangleFs[3].Y + threeLine3RectangleFs[4].Y) / 2));
  3657. d3 = Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y);
  3658. }
  3659. if (threeLine3RectangleFs.Count > 5)
  3660. {
  3661. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[4].Y - threeLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3662. if (this.checkBox1.Checked)
  3663. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[4].Y - threeLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  3664. lineFont, new SolidBrush(Color.Black),
  3665. new PointF(threeLine3RectangleFs[4].X - sizeF.Width / 4, (threeLine3RectangleFs[4].Y + threeLine3RectangleFs[5].Y) / 2));
  3666. b3 = Math.Abs(threeLine3RectangleFs[4].Y - threeLine3RectangleFs[5].Y);
  3667. }
  3668. }
  3669. else if (this.type.Equals(constTypeE))
  3670. {
  3671. if (threeLine1RectangleFs.Count == 2)
  3672. {
  3673. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3674. }
  3675. else if (threeLine1RectangleFs.Count == 3)
  3676. {
  3677. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength));
  3678. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength));
  3679. }
  3680. if (threeLine2RectangleFs.Count == 2)
  3681. {
  3682. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3683. }
  3684. else if (threeLine2RectangleFs.Count == 3)
  3685. {
  3686. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength));
  3687. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength));
  3688. }
  3689. if (threeLine3RectangleFs.Count == 2)
  3690. {
  3691. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3692. }
  3693. else if (threeLine3RectangleFs.Count == 3)
  3694. {
  3695. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength));
  3696. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength));
  3697. }
  3698. if (threeLine1RectangleFs.Count > 1)
  3699. {
  3700. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3701. if (this.checkBox1.Checked)
  3702. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3703. lineFont, new SolidBrush(Color.Black),
  3704. new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2));
  3705. a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y);
  3706. }
  3707. if (threeLine1RectangleFs.Count > 2)
  3708. {
  3709. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3710. if (this.checkBox1.Checked)
  3711. graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3712. lineFont, new SolidBrush(Color.Black),
  3713. new PointF(threeLine1RectangleFs[1].X - sizeF.Width / 4, (threeLine1RectangleFs[1].Y + threeLine1RectangleFs[2].Y) / 2));
  3714. c1 = Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y);
  3715. }
  3716. if (threeLine2RectangleFs.Count > 1)
  3717. {
  3718. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3719. if (this.checkBox1.Checked)
  3720. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3721. lineFont, new SolidBrush(Color.Black),
  3722. new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2));
  3723. a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y);
  3724. }
  3725. if (threeLine2RectangleFs.Count > 2)
  3726. {
  3727. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3728. if (this.checkBox1.Checked)
  3729. graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3730. lineFont, new SolidBrush(Color.Black),
  3731. new PointF(threeLine2RectangleFs[1].X - sizeF.Width / 4, (threeLine2RectangleFs[1].Y + threeLine2RectangleFs[2].Y) / 2));
  3732. c2 = Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y);
  3733. }
  3734. if (threeLine3RectangleFs.Count > 1)
  3735. {
  3736. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3737. if (this.checkBox1.Checked)
  3738. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3739. lineFont, new SolidBrush(Color.Black),
  3740. new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2));
  3741. a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y);
  3742. }
  3743. if (threeLine3RectangleFs.Count > 2)
  3744. {
  3745. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3746. if (this.checkBox1.Checked)
  3747. graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  3748. lineFont, new SolidBrush(Color.Black),
  3749. new PointF(threeLine3RectangleFs[1].X - sizeF.Width / 4, (threeLine3RectangleFs[1].Y + threeLine3RectangleFs[2].Y) / 2));
  3750. c3 = Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y);
  3751. }
  3752. }
  3753. }
  3754. #endregion
  3755. #region 线条数为四时的辅助线文本绘制
  3756. if (this.linesNumber == 4)
  3757. {
  3758. if (this.type.Equals(constTypeA))
  3759. {
  3760. if (fourLine1RectangleFs.Count == 2)
  3761. {
  3762. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3763. }
  3764. else if (fourLine1RectangleFs.Count == 3)
  3765. {
  3766. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3767. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  3768. }
  3769. if (fourLine2RectangleFs.Count == 2)
  3770. {
  3771. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3772. }
  3773. else if (fourLine2RectangleFs.Count == 3)
  3774. {
  3775. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3776. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  3777. }
  3778. if (fourLine3RectangleFs.Count == 2)
  3779. {
  3780. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  3781. }
  3782. else if (fourLine3RectangleFs.Count == 3)
  3783. {
  3784. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  3785. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  3786. }
  3787. if (fourLine4RectangleFs.Count == 2)
  3788. {
  3789. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  3790. }
  3791. else if (fourLine4RectangleFs.Count == 3)
  3792. {
  3793. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  3794. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  3795. }
  3796. if (fourLine1RectangleFs.Count > 1)
  3797. {
  3798. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3799. if (this.checkBox1.Checked)
  3800. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3801. lineFont, new SolidBrush(Color.Black),
  3802. new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2));
  3803. a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y);
  3804. }
  3805. if (fourLine2RectangleFs.Count > 1)
  3806. {
  3807. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3808. if (this.checkBox1.Checked)
  3809. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3810. lineFont, new SolidBrush(Color.Black),
  3811. new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2));
  3812. a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y);
  3813. }
  3814. if (fourLine3RectangleFs.Count > 1)
  3815. {
  3816. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3817. if (this.checkBox1.Checked)
  3818. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3819. lineFont, new SolidBrush(Color.Black),
  3820. new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2));
  3821. a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y);
  3822. }
  3823. if (fourLine4RectangleFs.Count > 1)
  3824. {
  3825. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3826. if (this.checkBox1.Checked)
  3827. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3828. lineFont, new SolidBrush(Color.Black),
  3829. new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2));
  3830. a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y);
  3831. }
  3832. }
  3833. else if (this.type.Equals(constTypeB))
  3834. {
  3835. if (fourLine1RectangleFs.Count == 2)
  3836. {
  3837. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3838. }
  3839. else if (fourLine1RectangleFs.Count == 3)
  3840. {
  3841. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3842. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  3843. }
  3844. else if (fourLine1RectangleFs.Count == 4)
  3845. {
  3846. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3847. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  3848. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength));
  3849. }
  3850. if (fourLine2RectangleFs.Count == 2)
  3851. {
  3852. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3853. }
  3854. else if (fourLine2RectangleFs.Count == 3)
  3855. {
  3856. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3857. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  3858. }
  3859. else if (fourLine2RectangleFs.Count == 4)
  3860. {
  3861. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3862. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  3863. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength));
  3864. }
  3865. if (fourLine3RectangleFs.Count == 2)
  3866. {
  3867. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  3868. }
  3869. else if (fourLine3RectangleFs.Count == 3)
  3870. {
  3871. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  3872. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  3873. }
  3874. else if (fourLine3RectangleFs.Count == 4)
  3875. {
  3876. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  3877. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  3878. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength));
  3879. }
  3880. if (fourLine4RectangleFs.Count == 2)
  3881. {
  3882. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  3883. }
  3884. else if (fourLine4RectangleFs.Count == 3)
  3885. {
  3886. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  3887. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  3888. }
  3889. else if (fourLine4RectangleFs.Count == 4)
  3890. {
  3891. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  3892. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  3893. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength));
  3894. }
  3895. if (fourLine1RectangleFs.Count > 1)
  3896. {
  3897. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3898. if (this.checkBox1.Checked)
  3899. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3900. lineFont, new SolidBrush(Color.Black),
  3901. new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2));
  3902. a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y);
  3903. }
  3904. if (fourLine1RectangleFs.Count > 3)
  3905. {
  3906. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3907. if (this.checkBox1.Checked)
  3908. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3909. lineFont, new SolidBrush(Color.Black),
  3910. new PointF(fourLine1RectangleFs[2].X - sizeF.Width / 4, (fourLine1RectangleFs[2].Y + fourLine1RectangleFs[3].Y) / 2));
  3911. b1 = Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y);
  3912. }
  3913. if (fourLine2RectangleFs.Count > 1)
  3914. {
  3915. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3916. if (this.checkBox1.Checked)
  3917. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3918. lineFont, new SolidBrush(Color.Black),
  3919. new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2));
  3920. a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y);
  3921. }
  3922. if (fourLine2RectangleFs.Count > 3)
  3923. {
  3924. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3925. if (this.checkBox1.Checked)
  3926. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3927. lineFont, new SolidBrush(Color.Black),
  3928. new PointF(fourLine2RectangleFs[2].X - sizeF.Width / 4, (fourLine2RectangleFs[2].Y + fourLine2RectangleFs[3].Y) / 2));
  3929. b2 = Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y);
  3930. }
  3931. if (fourLine3RectangleFs.Count > 1)
  3932. {
  3933. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3934. if (this.checkBox1.Checked)
  3935. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3936. lineFont, new SolidBrush(Color.Black),
  3937. new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2));
  3938. a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y);
  3939. }
  3940. if (fourLine3RectangleFs.Count > 3)
  3941. {
  3942. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3943. if (this.checkBox1.Checked)
  3944. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3945. lineFont, new SolidBrush(Color.Black),
  3946. new PointF(fourLine3RectangleFs[2].X - sizeF.Width / 4, (fourLine3RectangleFs[2].Y + fourLine3RectangleFs[3].Y) / 2));
  3947. b3 = Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y);
  3948. }
  3949. if (fourLine4RectangleFs.Count > 1)
  3950. {
  3951. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3952. if (this.checkBox1.Checked)
  3953. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  3954. lineFont, new SolidBrush(Color.Black),
  3955. new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2));
  3956. a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y);
  3957. }
  3958. if (fourLine4RectangleFs.Count > 3)
  3959. {
  3960. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  3961. if (this.checkBox1.Checked)
  3962. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  3963. lineFont, new SolidBrush(Color.Black),
  3964. new PointF(fourLine4RectangleFs[2].X - sizeF.Width / 4, (fourLine4RectangleFs[2].Y + fourLine4RectangleFs[3].Y) / 2));
  3965. b4 = Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y);
  3966. }
  3967. }
  3968. else if (this.type.Equals(constTypeC))
  3969. {
  3970. if (fourLine1RectangleFs.Count == 2)
  3971. {
  3972. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3973. }
  3974. else if (fourLine1RectangleFs.Count == 3)
  3975. {
  3976. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3977. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  3978. }
  3979. else if (fourLine1RectangleFs.Count == 4)
  3980. {
  3981. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3982. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  3983. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength));
  3984. }
  3985. else if (fourLine1RectangleFs.Count == 5)
  3986. {
  3987. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  3988. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  3989. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength));
  3990. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength));
  3991. }
  3992. if (fourLine2RectangleFs.Count == 2)
  3993. {
  3994. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3995. }
  3996. else if (fourLine1RectangleFs.Count == 3)
  3997. {
  3998. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  3999. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4000. }
  4001. else if (fourLine1RectangleFs.Count == 4)
  4002. {
  4003. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4004. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4005. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength));
  4006. }
  4007. else if (fourLine1RectangleFs.Count == 5)
  4008. {
  4009. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4010. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4011. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength));
  4012. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength));
  4013. }
  4014. if (fourLine3RectangleFs.Count == 2)
  4015. {
  4016. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4017. }
  4018. else if (fourLine3RectangleFs.Count == 3)
  4019. {
  4020. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4021. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4022. }
  4023. else if (fourLine3RectangleFs.Count == 4)
  4024. {
  4025. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4026. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4027. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength));
  4028. }
  4029. else if (fourLine3RectangleFs.Count == 5)
  4030. {
  4031. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4032. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4033. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength));
  4034. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength));
  4035. }
  4036. if (fourLine4RectangleFs.Count == 2)
  4037. {
  4038. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4039. }
  4040. else if (fourLine4RectangleFs.Count == 3)
  4041. {
  4042. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4043. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4044. }
  4045. else if (fourLine4RectangleFs.Count == 4)
  4046. {
  4047. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4048. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4049. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength));
  4050. }
  4051. else if (fourLine4RectangleFs.Count == 5)
  4052. {
  4053. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4054. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4055. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength));
  4056. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength));
  4057. }
  4058. if (fourLine1RectangleFs.Count > 1)
  4059. {
  4060. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4061. if (this.checkBox1.Checked)
  4062. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4063. lineFont, new SolidBrush(Color.Black),
  4064. new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2));
  4065. a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y);
  4066. }
  4067. if (fourLine1RectangleFs.Count > 2)
  4068. {
  4069. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4070. if (this.checkBox1.Checked)
  4071. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4072. lineFont, new SolidBrush(Color.Black),
  4073. new PointF(fourLine1RectangleFs[1].X - sizeF.Width / 4, (fourLine1RectangleFs[1].Y + fourLine1RectangleFs[2].Y) / 2));
  4074. c1 = Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y);
  4075. }
  4076. if (fourLine1RectangleFs.Count > 4)
  4077. {
  4078. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4079. if (this.checkBox1.Checked)
  4080. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4081. lineFont, new SolidBrush(Color.Black),
  4082. new PointF(fourLine1RectangleFs[3].X - sizeF.Width / 4, (fourLine1RectangleFs[3].Y + fourLine1RectangleFs[4].Y) / 2));
  4083. b1 = Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y);
  4084. }
  4085. if (fourLine2RectangleFs.Count > 1)
  4086. {
  4087. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4088. if (this.checkBox1.Checked)
  4089. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4090. lineFont, new SolidBrush(Color.Black),
  4091. new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2));
  4092. a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y);
  4093. }
  4094. if (fourLine2RectangleFs.Count > 2)
  4095. {
  4096. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4097. if (this.checkBox1.Checked)
  4098. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4099. lineFont, new SolidBrush(Color.Black),
  4100. new PointF(fourLine2RectangleFs[1].X - sizeF.Width / 4, (fourLine2RectangleFs[1].Y + fourLine2RectangleFs[2].Y) / 2));
  4101. c2 = Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y);
  4102. }
  4103. if (fourLine2RectangleFs.Count > 4)
  4104. {
  4105. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4106. if (this.checkBox1.Checked)
  4107. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4108. lineFont, new SolidBrush(Color.Black),
  4109. new PointF(fourLine2RectangleFs[3].X - sizeF.Width / 4, (fourLine2RectangleFs[3].Y + fourLine2RectangleFs[4].Y) / 2));
  4110. b2 = Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y);
  4111. }
  4112. if (fourLine3RectangleFs.Count > 1)
  4113. {
  4114. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4115. if (this.checkBox1.Checked)
  4116. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4117. lineFont, new SolidBrush(Color.Black),
  4118. new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2));
  4119. a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y);
  4120. }
  4121. if (fourLine3RectangleFs.Count > 2)
  4122. {
  4123. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4124. if (this.checkBox1.Checked)
  4125. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4126. lineFont, new SolidBrush(Color.Black),
  4127. new PointF(fourLine3RectangleFs[1].X - sizeF.Width / 4, (fourLine3RectangleFs[1].Y + fourLine3RectangleFs[2].Y) / 2));
  4128. c3 = Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y);
  4129. }
  4130. if (fourLine3RectangleFs.Count > 4)
  4131. {
  4132. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4133. if (this.checkBox1.Checked)
  4134. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4135. lineFont, new SolidBrush(Color.Black),
  4136. new PointF(fourLine3RectangleFs[3].X - sizeF.Width / 4, (fourLine3RectangleFs[3].Y + fourLine3RectangleFs[4].Y) / 2));
  4137. b3 = Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y);
  4138. }
  4139. if (fourLine4RectangleFs.Count > 1)
  4140. {
  4141. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4142. if (this.checkBox1.Checked)
  4143. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4144. lineFont, new SolidBrush(Color.Black),
  4145. new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2));
  4146. a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y);
  4147. }
  4148. if (fourLine4RectangleFs.Count > 2)
  4149. {
  4150. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4151. if (this.checkBox1.Checked)
  4152. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4153. lineFont, new SolidBrush(Color.Black),
  4154. new PointF(fourLine4RectangleFs[1].X - sizeF.Width / 4, (fourLine4RectangleFs[1].Y + fourLine4RectangleFs[2].Y) / 2));
  4155. c4 = Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y);
  4156. }
  4157. if (fourLine4RectangleFs.Count > 4)
  4158. {
  4159. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4160. if (this.checkBox1.Checked)
  4161. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4162. lineFont, new SolidBrush(Color.Black),
  4163. new PointF(fourLine4RectangleFs[3].X - sizeF.Width / 4, (fourLine4RectangleFs[3].Y + fourLine4RectangleFs[4].Y) / 2));
  4164. b4 = Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y);
  4165. }
  4166. }
  4167. else if (this.type.Equals(constTypeD))
  4168. {
  4169. if (fourLine1RectangleFs.Count == 2)
  4170. {
  4171. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4172. }
  4173. else if (fourLine1RectangleFs.Count == 3)
  4174. {
  4175. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4176. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  4177. }
  4178. else if (fourLine1RectangleFs.Count == 4)
  4179. {
  4180. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4181. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  4182. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength));
  4183. }
  4184. else if (fourLine1RectangleFs.Count == 5)
  4185. {
  4186. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4187. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  4188. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength));
  4189. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength));
  4190. }
  4191. else if (fourLine1RectangleFs.Count == 6)
  4192. {
  4193. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4194. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  4195. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength));
  4196. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength));
  4197. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[4].Y - fourLine1RectangleFs[5].Y) * this.unitLength));
  4198. }
  4199. if (fourLine2RectangleFs.Count == 2)
  4200. {
  4201. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4202. }
  4203. else if (fourLine2RectangleFs.Count == 3)
  4204. {
  4205. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4206. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4207. }
  4208. else if (fourLine2RectangleFs.Count == 4)
  4209. {
  4210. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4211. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4212. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength));
  4213. }
  4214. else if (fourLine2RectangleFs.Count == 5)
  4215. {
  4216. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4217. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4218. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength));
  4219. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength));
  4220. }
  4221. else if (fourLine2RectangleFs.Count == 6)
  4222. {
  4223. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4224. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4225. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength));
  4226. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength));
  4227. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[4].Y - fourLine2RectangleFs[5].Y) * this.unitLength));
  4228. }
  4229. if (fourLine3RectangleFs.Count == 2)
  4230. {
  4231. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4232. }
  4233. else if (fourLine3RectangleFs.Count == 3)
  4234. {
  4235. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4236. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4237. }
  4238. else if (fourLine3RectangleFs.Count == 4)
  4239. {
  4240. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4241. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4242. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength));
  4243. }
  4244. else if (fourLine3RectangleFs.Count == 5)
  4245. {
  4246. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4247. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4248. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength));
  4249. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength));
  4250. }
  4251. else if (fourLine3RectangleFs.Count == 6)
  4252. {
  4253. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4254. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4255. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength));
  4256. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength));
  4257. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[4].Y - fourLine3RectangleFs[5].Y) * this.unitLength));
  4258. }
  4259. if (fourLine4RectangleFs.Count == 2)
  4260. {
  4261. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4262. }
  4263. else if (fourLine4RectangleFs.Count == 3)
  4264. {
  4265. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4266. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4267. }
  4268. else if (fourLine4RectangleFs.Count == 4)
  4269. {
  4270. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4271. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4272. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength));
  4273. }
  4274. else if (fourLine4RectangleFs.Count == 5)
  4275. {
  4276. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4277. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4278. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength));
  4279. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength));
  4280. }
  4281. else if (fourLine4RectangleFs.Count == 6)
  4282. {
  4283. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4284. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4285. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength));
  4286. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength));
  4287. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[4].Y - fourLine4RectangleFs[5].Y) * this.unitLength));
  4288. }
  4289. if (fourLine1RectangleFs.Count > 1)
  4290. {
  4291. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4292. if (this.checkBox1.Checked)
  4293. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4294. lineFont, new SolidBrush(Color.Black),
  4295. new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2));
  4296. a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y);
  4297. }
  4298. if (fourLine1RectangleFs.Count > 2)
  4299. {
  4300. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4301. if (this.checkBox1.Checked)
  4302. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4303. lineFont, new SolidBrush(Color.Black),
  4304. new PointF(fourLine1RectangleFs[1].X - sizeF.Width / 4, (fourLine1RectangleFs[1].Y + fourLine1RectangleFs[2].Y) / 2));
  4305. c1 = Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y);
  4306. }
  4307. if (fourLine1RectangleFs.Count > 4)
  4308. {
  4309. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4310. if (this.checkBox1.Checked)
  4311. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4312. lineFont, new SolidBrush(Color.Black),
  4313. new PointF(fourLine1RectangleFs[3].X - sizeF.Width / 4, (fourLine1RectangleFs[3].Y + fourLine1RectangleFs[4].Y) / 2));
  4314. d1 = Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y);
  4315. }
  4316. if (fourLine1RectangleFs.Count > 5)
  4317. {
  4318. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[4].Y - fourLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4319. if (this.checkBox1.Checked)
  4320. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[4].Y - fourLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  4321. lineFont, new SolidBrush(Color.Black),
  4322. new PointF(fourLine1RectangleFs[4].X - sizeF.Width / 4, (fourLine1RectangleFs[4].Y + fourLine1RectangleFs[5].Y) / 2));
  4323. b1 = Math.Abs(fourLine1RectangleFs[4].Y - fourLine1RectangleFs[5].Y);
  4324. }
  4325. if (fourLine2RectangleFs.Count > 1)
  4326. {
  4327. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4328. if (this.checkBox1.Checked)
  4329. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4330. lineFont, new SolidBrush(Color.Black),
  4331. new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2));
  4332. a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y);
  4333. }
  4334. if (fourLine2RectangleFs.Count > 2)
  4335. {
  4336. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4337. if (this.checkBox1.Checked)
  4338. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4339. lineFont, new SolidBrush(Color.Black),
  4340. new PointF(fourLine2RectangleFs[1].X - sizeF.Width / 4, (fourLine2RectangleFs[1].Y + fourLine2RectangleFs[2].Y) / 2));
  4341. c2 = Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y);
  4342. }
  4343. if (fourLine2RectangleFs.Count > 4)
  4344. {
  4345. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4346. if (this.checkBox1.Checked)
  4347. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4348. lineFont, new SolidBrush(Color.Black),
  4349. new PointF(fourLine2RectangleFs[3].X - sizeF.Width / 4, (fourLine2RectangleFs[3].Y + fourLine2RectangleFs[4].Y) / 2));
  4350. d2 = Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y);
  4351. }
  4352. if (fourLine2RectangleFs.Count > 5)
  4353. {
  4354. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[4].Y - fourLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4355. if (this.checkBox1.Checked)
  4356. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[4].Y - fourLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  4357. lineFont, new SolidBrush(Color.Black),
  4358. new PointF(fourLine2RectangleFs[4].X - sizeF.Width / 4, (fourLine2RectangleFs[4].Y + fourLine2RectangleFs[5].Y) / 2));
  4359. b2 = Math.Abs(fourLine2RectangleFs[4].Y - fourLine2RectangleFs[5].Y);
  4360. }
  4361. if (fourLine3RectangleFs.Count > 1)
  4362. {
  4363. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4364. if (this.checkBox1.Checked)
  4365. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4366. lineFont, new SolidBrush(Color.Black),
  4367. new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2));
  4368. a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y);
  4369. }
  4370. if (fourLine3RectangleFs.Count > 2)
  4371. {
  4372. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4373. if (this.checkBox1.Checked)
  4374. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4375. lineFont, new SolidBrush(Color.Black),
  4376. new PointF(fourLine3RectangleFs[1].X - sizeF.Width / 4, (fourLine3RectangleFs[1].Y + fourLine3RectangleFs[2].Y) / 2));
  4377. c3 = Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y);
  4378. }
  4379. if (fourLine3RectangleFs.Count > 4)
  4380. {
  4381. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4382. if (this.checkBox1.Checked)
  4383. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4384. lineFont, new SolidBrush(Color.Black),
  4385. new PointF(fourLine3RectangleFs[3].X - sizeF.Width / 4, (fourLine3RectangleFs[3].Y + fourLine3RectangleFs[4].Y) / 2));
  4386. d3 = Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y);
  4387. }
  4388. if (fourLine3RectangleFs.Count > 5)
  4389. {
  4390. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[4].Y - fourLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4391. if (this.checkBox1.Checked)
  4392. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[4].Y - fourLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  4393. lineFont, new SolidBrush(Color.Black),
  4394. new PointF(fourLine3RectangleFs[4].X - sizeF.Width / 4, (fourLine3RectangleFs[4].Y + fourLine3RectangleFs[5].Y) / 2));
  4395. b3 = Math.Abs(fourLine3RectangleFs[4].Y - fourLine3RectangleFs[5].Y);
  4396. }
  4397. if (fourLine4RectangleFs.Count > 1)
  4398. {
  4399. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4400. if (this.checkBox1.Checked)
  4401. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4402. lineFont, new SolidBrush(Color.Black),
  4403. new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2));
  4404. a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y);
  4405. }
  4406. if (fourLine4RectangleFs.Count > 2)
  4407. {
  4408. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4409. if (this.checkBox1.Checked)
  4410. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4411. lineFont, new SolidBrush(Color.Black),
  4412. new PointF(fourLine4RectangleFs[1].X - sizeF.Width / 4, (fourLine4RectangleFs[1].Y + fourLine4RectangleFs[2].Y) / 2));
  4413. c4 = Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y);
  4414. }
  4415. if (fourLine4RectangleFs.Count > 4)
  4416. {
  4417. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4418. if (this.checkBox1.Checked)
  4419. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4420. lineFont, new SolidBrush(Color.Black),
  4421. new PointF(fourLine4RectangleFs[3].X - sizeF.Width / 4, (fourLine4RectangleFs[3].Y + fourLine4RectangleFs[4].Y) / 2));
  4422. d4 = Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y);
  4423. }
  4424. if (fourLine4RectangleFs.Count > 5)
  4425. {
  4426. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[4].Y - fourLine4RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4427. if (this.checkBox1.Checked)
  4428. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[4].Y - fourLine4RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  4429. lineFont, new SolidBrush(Color.Black),
  4430. new PointF(fourLine4RectangleFs[4].X - sizeF.Width / 4, (fourLine4RectangleFs[4].Y + fourLine4RectangleFs[5].Y) / 2));
  4431. b4 = Math.Abs(fourLine4RectangleFs[4].Y - fourLine4RectangleFs[5].Y);
  4432. }
  4433. }
  4434. else if (this.type.Equals(constTypeE))
  4435. {
  4436. if (fourLine1RectangleFs.Count == 2)
  4437. {
  4438. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4439. }
  4440. else if (fourLine1RectangleFs.Count == 3)
  4441. {
  4442. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength));
  4443. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength));
  4444. }
  4445. if (fourLine2RectangleFs.Count == 2)
  4446. {
  4447. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4448. }
  4449. else if (fourLine2RectangleFs.Count == 3)
  4450. {
  4451. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength));
  4452. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength));
  4453. }
  4454. if (fourLine3RectangleFs.Count == 2)
  4455. {
  4456. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4457. }
  4458. else if (fourLine3RectangleFs.Count == 3)
  4459. {
  4460. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength));
  4461. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength));
  4462. }
  4463. if (fourLine4RectangleFs.Count == 2)
  4464. {
  4465. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4466. }
  4467. else if (fourLine3RectangleFs.Count == 3)
  4468. {
  4469. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength));
  4470. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength));
  4471. }
  4472. if (fourLine1RectangleFs.Count > 1)
  4473. {
  4474. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4475. if (this.checkBox1.Checked)
  4476. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4477. lineFont, new SolidBrush(Color.Black),
  4478. new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2));
  4479. a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y);
  4480. }
  4481. if (fourLine1RectangleFs.Count > 2)
  4482. {
  4483. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4484. if (this.checkBox1.Checked)
  4485. graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4486. lineFont, new SolidBrush(Color.Black),
  4487. new PointF(fourLine1RectangleFs[1].X - sizeF.Width / 4, (fourLine1RectangleFs[1].Y + fourLine1RectangleFs[2].Y) / 2));
  4488. c1 = Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y);
  4489. }
  4490. if (fourLine2RectangleFs.Count > 1)
  4491. {
  4492. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4493. if (this.checkBox1.Checked)
  4494. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4495. lineFont, new SolidBrush(Color.Black),
  4496. new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2));
  4497. a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y);
  4498. }
  4499. if (fourLine2RectangleFs.Count > 2)
  4500. {
  4501. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4502. if (this.checkBox1.Checked)
  4503. graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4504. lineFont, new SolidBrush(Color.Black),
  4505. new PointF(fourLine2RectangleFs[1].X - sizeF.Width / 4, (fourLine2RectangleFs[1].Y + fourLine2RectangleFs[2].Y) / 2));
  4506. c2 = Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y);
  4507. }
  4508. if (fourLine3RectangleFs.Count > 1)
  4509. {
  4510. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4511. if (this.checkBox1.Checked)
  4512. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4513. lineFont, new SolidBrush(Color.Black),
  4514. new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2));
  4515. a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y);
  4516. }
  4517. if (fourLine3RectangleFs.Count > 2)
  4518. {
  4519. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4520. if (this.checkBox1.Checked)
  4521. graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4522. lineFont, new SolidBrush(Color.Black),
  4523. new PointF(fourLine3RectangleFs[1].X - sizeF.Width / 4, (fourLine3RectangleFs[1].Y + fourLine3RectangleFs[2].Y) / 2));
  4524. c3 = Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y);
  4525. }
  4526. if (fourLine4RectangleFs.Count > 1)
  4527. {
  4528. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4529. if (this.checkBox1.Checked)
  4530. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4531. lineFont, new SolidBrush(Color.Black),
  4532. new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2));
  4533. a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y);
  4534. }
  4535. if (fourLine4RectangleFs.Count > 2)
  4536. {
  4537. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4538. if (this.checkBox1.Checked)
  4539. graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4540. lineFont, new SolidBrush(Color.Black),
  4541. new PointF(fourLine4RectangleFs[1].X - sizeF.Width / 4, (fourLine4RectangleFs[1].Y + fourLine4RectangleFs[2].Y) / 2));
  4542. c4 = Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y);
  4543. }
  4544. }
  4545. }
  4546. #endregion
  4547. #region 线条数为五时的辅助线文本绘制
  4548. if (this.linesNumber == 5)
  4549. {
  4550. if (this.type.Equals(constTypeA))
  4551. {
  4552. if (fiveLine1RectangleFs.Count == 2)
  4553. {
  4554. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4555. }
  4556. else if (fiveLine1RectangleFs.Count == 3)
  4557. {
  4558. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4559. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  4560. }
  4561. if (fiveLine2RectangleFs.Count == 2)
  4562. {
  4563. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4564. }
  4565. else if (fiveLine2RectangleFs.Count == 3)
  4566. {
  4567. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4568. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  4569. }
  4570. if (fiveLine3RectangleFs.Count == 2)
  4571. {
  4572. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4573. }
  4574. else if (fiveLine3RectangleFs.Count == 3)
  4575. {
  4576. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4577. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  4578. }
  4579. if (fiveLine4RectangleFs.Count == 2)
  4580. {
  4581. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4582. }
  4583. else if (fiveLine4RectangleFs.Count == 3)
  4584. {
  4585. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4586. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  4587. }
  4588. if (fiveLine5RectangleFs.Count == 2)
  4589. {
  4590. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4591. }
  4592. else if (fiveLine5RectangleFs.Count == 3)
  4593. {
  4594. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4595. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  4596. }
  4597. if (fiveLine1RectangleFs.Count > 1)
  4598. {
  4599. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4600. if (this.checkBox1.Checked)
  4601. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4602. lineFont, new SolidBrush(Color.Black),
  4603. new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2));
  4604. a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y);
  4605. }
  4606. if (fiveLine2RectangleFs.Count > 1)
  4607. {
  4608. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4609. if (this.checkBox1.Checked)
  4610. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4611. lineFont, new SolidBrush(Color.Black),
  4612. new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2));
  4613. a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y);
  4614. }
  4615. if (fiveLine3RectangleFs.Count > 1)
  4616. {
  4617. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4618. if (this.checkBox1.Checked)
  4619. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4620. lineFont, new SolidBrush(Color.Black),
  4621. new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2));
  4622. a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y);
  4623. }
  4624. if (fiveLine4RectangleFs.Count > 1)
  4625. {
  4626. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4627. if (this.checkBox1.Checked)
  4628. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4629. lineFont, new SolidBrush(Color.Black),
  4630. new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2));
  4631. a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y);
  4632. }
  4633. if (fiveLine5RectangleFs.Count > 1)
  4634. {
  4635. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4636. if (this.checkBox1.Checked)
  4637. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4638. lineFont, new SolidBrush(Color.Black),
  4639. new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2));
  4640. a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y);
  4641. }
  4642. }
  4643. else if (this.type.Equals(constTypeB))
  4644. {
  4645. if (fiveLine1RectangleFs.Count == 2)
  4646. {
  4647. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4648. }
  4649. else if (fiveLine1RectangleFs.Count == 3)
  4650. {
  4651. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4652. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  4653. }
  4654. else if (fiveLine1RectangleFs.Count == 4)
  4655. {
  4656. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4657. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  4658. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength));
  4659. }
  4660. if (fiveLine2RectangleFs.Count == 2)
  4661. {
  4662. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4663. }
  4664. else if (fiveLine2RectangleFs.Count == 3)
  4665. {
  4666. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4667. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  4668. }
  4669. else if (fiveLine2RectangleFs.Count == 4)
  4670. {
  4671. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4672. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  4673. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength));
  4674. }
  4675. if (fiveLine3RectangleFs.Count == 2)
  4676. {
  4677. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4678. }
  4679. else if (fiveLine3RectangleFs.Count == 3)
  4680. {
  4681. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4682. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  4683. }
  4684. else if (fiveLine3RectangleFs.Count == 4)
  4685. {
  4686. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4687. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  4688. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength));
  4689. }
  4690. if (fiveLine4RectangleFs.Count == 2)
  4691. {
  4692. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4693. }
  4694. else if (fiveLine4RectangleFs.Count == 3)
  4695. {
  4696. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4697. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  4698. }
  4699. else if (fiveLine4RectangleFs.Count == 4)
  4700. {
  4701. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4702. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  4703. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength));
  4704. }
  4705. if (fiveLine5RectangleFs.Count == 2)
  4706. {
  4707. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4708. }
  4709. else if (fiveLine5RectangleFs.Count == 3)
  4710. {
  4711. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4712. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  4713. }
  4714. else if (fiveLine5RectangleFs.Count == 4)
  4715. {
  4716. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4717. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  4718. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength));
  4719. }
  4720. if (fiveLine1RectangleFs.Count > 1)
  4721. {
  4722. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4723. if (this.checkBox1.Checked)
  4724. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4725. lineFont, new SolidBrush(Color.Black),
  4726. new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2));
  4727. a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y);
  4728. }
  4729. if (fiveLine1RectangleFs.Count > 3)
  4730. {
  4731. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4732. if (this.checkBox1.Checked)
  4733. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  4734. lineFont, new SolidBrush(Color.Black),
  4735. new PointF(fiveLine1RectangleFs[2].X - sizeF.Width / 4, (fiveLine1RectangleFs[2].Y + fiveLine1RectangleFs[3].Y) / 2));
  4736. b1 = Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y);
  4737. }
  4738. if (fiveLine2RectangleFs.Count > 1)
  4739. {
  4740. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4741. if (this.checkBox1.Checked)
  4742. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4743. lineFont, new SolidBrush(Color.Black),
  4744. new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2));
  4745. a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y);
  4746. }
  4747. if (fiveLine2RectangleFs.Count > 3)
  4748. {
  4749. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4750. if (this.checkBox1.Checked)
  4751. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  4752. lineFont, new SolidBrush(Color.Black),
  4753. new PointF(fiveLine2RectangleFs[2].X - sizeF.Width / 4, (fiveLine2RectangleFs[2].Y + fiveLine2RectangleFs[3].Y) / 2));
  4754. b2 = Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y);
  4755. }
  4756. if (fiveLine3RectangleFs.Count > 1)
  4757. {
  4758. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4759. if (this.checkBox1.Checked)
  4760. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4761. lineFont, new SolidBrush(Color.Black),
  4762. new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2));
  4763. a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y);
  4764. }
  4765. if (fiveLine3RectangleFs.Count > 3)
  4766. {
  4767. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4768. if (this.checkBox1.Checked)
  4769. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  4770. lineFont, new SolidBrush(Color.Black),
  4771. new PointF(fiveLine3RectangleFs[2].X - sizeF.Width / 4, (fiveLine3RectangleFs[2].Y + fiveLine3RectangleFs[3].Y) / 2));
  4772. b3 = Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y);
  4773. }
  4774. if (fiveLine4RectangleFs.Count > 1)
  4775. {
  4776. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4777. if (this.checkBox1.Checked)
  4778. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4779. lineFont, new SolidBrush(Color.Black),
  4780. new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2));
  4781. a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y);
  4782. }
  4783. if (fiveLine4RectangleFs.Count > 3)
  4784. {
  4785. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4786. if (this.checkBox1.Checked)
  4787. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  4788. lineFont, new SolidBrush(Color.Black),
  4789. new PointF(fiveLine4RectangleFs[2].X - sizeF.Width / 4, (fiveLine4RectangleFs[2].Y + fiveLine4RectangleFs[3].Y) / 2));
  4790. b4 = Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y);
  4791. }
  4792. if (fiveLine5RectangleFs.Count > 1)
  4793. {
  4794. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4795. if (this.checkBox1.Checked)
  4796. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4797. lineFont, new SolidBrush(Color.Black),
  4798. new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2));
  4799. a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y);
  4800. }
  4801. if (fiveLine5RectangleFs.Count > 3)
  4802. {
  4803. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4804. if (this.checkBox1.Checked)
  4805. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm",
  4806. lineFont, new SolidBrush(Color.Black),
  4807. new PointF(fiveLine5RectangleFs[2].X - sizeF.Width / 4, (fiveLine5RectangleFs[2].Y + fiveLine5RectangleFs[3].Y) / 2));
  4808. b5 = Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y);
  4809. }
  4810. }
  4811. else if (this.type.Equals(constTypeC))
  4812. {
  4813. if (fiveLine1RectangleFs.Count == 2)
  4814. {
  4815. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4816. }
  4817. else if (fiveLine1RectangleFs.Count == 3)
  4818. {
  4819. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4820. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  4821. }
  4822. else if (fiveLine1RectangleFs.Count == 4)
  4823. {
  4824. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4825. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  4826. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength));
  4827. }
  4828. else if (fiveLine1RectangleFs.Count == 5)
  4829. {
  4830. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  4831. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  4832. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength));
  4833. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength));
  4834. }
  4835. if (fiveLine2RectangleFs.Count == 2)
  4836. {
  4837. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4838. }
  4839. else if (fiveLine2RectangleFs.Count == 3)
  4840. {
  4841. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4842. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  4843. }
  4844. else if (fiveLine2RectangleFs.Count == 4)
  4845. {
  4846. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4847. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  4848. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength));
  4849. }
  4850. else if (fiveLine2RectangleFs.Count == 5)
  4851. {
  4852. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  4853. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  4854. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength));
  4855. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength));
  4856. }
  4857. if (fiveLine3RectangleFs.Count == 2)
  4858. {
  4859. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4860. }
  4861. else if (fiveLine3RectangleFs.Count == 3)
  4862. {
  4863. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4864. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  4865. }
  4866. else if (fiveLine3RectangleFs.Count == 4)
  4867. {
  4868. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4869. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  4870. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength));
  4871. }
  4872. else if (fiveLine3RectangleFs.Count == 5)
  4873. {
  4874. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  4875. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  4876. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength));
  4877. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength));
  4878. }
  4879. if (fiveLine4RectangleFs.Count == 2)
  4880. {
  4881. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4882. }
  4883. else if (fiveLine4RectangleFs.Count == 3)
  4884. {
  4885. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4886. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  4887. }
  4888. else if (fiveLine4RectangleFs.Count == 4)
  4889. {
  4890. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4891. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  4892. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength));
  4893. }
  4894. else if (fiveLine4RectangleFs.Count == 5)
  4895. {
  4896. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  4897. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  4898. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength));
  4899. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength));
  4900. }
  4901. if (fiveLine5RectangleFs.Count == 2)
  4902. {
  4903. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4904. }
  4905. else if (fiveLine5RectangleFs.Count == 3)
  4906. {
  4907. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4908. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  4909. }
  4910. else if (fiveLine5RectangleFs.Count == 4)
  4911. {
  4912. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4913. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  4914. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength));
  4915. }
  4916. else if (fiveLine5RectangleFs.Count == 5)
  4917. {
  4918. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  4919. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  4920. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength));
  4921. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength));
  4922. }
  4923. if (fiveLine1RectangleFs.Count > 1)
  4924. {
  4925. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4926. if (this.checkBox1.Checked)
  4927. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4928. lineFont, new SolidBrush(Color.Black),
  4929. new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2));
  4930. a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y);
  4931. }
  4932. if (fiveLine1RectangleFs.Count > 2)
  4933. {
  4934. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4935. if (this.checkBox1.Checked)
  4936. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4937. lineFont, new SolidBrush(Color.Black),
  4938. new PointF(fiveLine1RectangleFs[1].X - sizeF.Width / 4, (fiveLine1RectangleFs[1].Y + fiveLine1RectangleFs[2].Y) / 2));
  4939. c1 = Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y);
  4940. }
  4941. if (fiveLine1RectangleFs.Count > 4)
  4942. {
  4943. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4944. if (this.checkBox1.Checked)
  4945. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4946. lineFont, new SolidBrush(Color.Black),
  4947. new PointF(fiveLine1RectangleFs[3].X - sizeF.Width / 4, (fiveLine1RectangleFs[3].Y + fiveLine1RectangleFs[4].Y) / 2));
  4948. b1 = Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y);
  4949. }
  4950. if (fiveLine2RectangleFs.Count > 1)
  4951. {
  4952. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4953. if (this.checkBox1.Checked)
  4954. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4955. lineFont, new SolidBrush(Color.Black),
  4956. new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2));
  4957. a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y);
  4958. }
  4959. if (fiveLine2RectangleFs.Count > 2)
  4960. {
  4961. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4962. if (this.checkBox1.Checked)
  4963. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4964. lineFont, new SolidBrush(Color.Black),
  4965. new PointF(fiveLine2RectangleFs[1].X - sizeF.Width / 4, (fiveLine2RectangleFs[1].Y + fiveLine2RectangleFs[2].Y) / 2));
  4966. c2 = Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y);
  4967. }
  4968. if (fiveLine2RectangleFs.Count > 4)
  4969. {
  4970. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4971. if (this.checkBox1.Checked)
  4972. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  4973. lineFont, new SolidBrush(Color.Black),
  4974. new PointF(fiveLine2RectangleFs[3].X - sizeF.Width / 4, (fiveLine2RectangleFs[3].Y + fiveLine2RectangleFs[4].Y) / 2));
  4975. b2 = Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y);
  4976. }
  4977. if (fiveLine3RectangleFs.Count > 1)
  4978. {
  4979. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4980. if (this.checkBox1.Checked)
  4981. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  4982. lineFont, new SolidBrush(Color.Black),
  4983. new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2));
  4984. a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y);
  4985. }
  4986. if (fiveLine3RectangleFs.Count > 2)
  4987. {
  4988. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4989. if (this.checkBox1.Checked)
  4990. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  4991. lineFont, new SolidBrush(Color.Black),
  4992. new PointF(fiveLine3RectangleFs[1].X - sizeF.Width / 4, (fiveLine3RectangleFs[1].Y + fiveLine3RectangleFs[2].Y) / 2));
  4993. c3 = Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y);
  4994. }
  4995. if (fiveLine3RectangleFs.Count > 4)
  4996. {
  4997. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  4998. if (this.checkBox1.Checked)
  4999. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5000. lineFont, new SolidBrush(Color.Black),
  5001. new PointF(fiveLine3RectangleFs[3].X - sizeF.Width / 4, (fiveLine3RectangleFs[3].Y + fiveLine3RectangleFs[4].Y) / 2));
  5002. b3 = Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y);
  5003. }
  5004. if (fiveLine4RectangleFs.Count > 1)
  5005. {
  5006. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5007. if (this.checkBox1.Checked)
  5008. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5009. lineFont, new SolidBrush(Color.Black),
  5010. new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2));
  5011. a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y);
  5012. }
  5013. if (fiveLine4RectangleFs.Count > 2)
  5014. {
  5015. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5016. if (this.checkBox1.Checked)
  5017. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5018. lineFont, new SolidBrush(Color.Black),
  5019. new PointF(fiveLine4RectangleFs[1].X - sizeF.Width / 4, (fiveLine4RectangleFs[1].Y + fiveLine4RectangleFs[2].Y) / 2));
  5020. c4 = Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y);
  5021. }
  5022. if (fiveLine4RectangleFs.Count > 4)
  5023. {
  5024. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5025. if (this.checkBox1.Checked)
  5026. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5027. lineFont, new SolidBrush(Color.Black),
  5028. new PointF(fiveLine4RectangleFs[3].X - sizeF.Width / 4, (fiveLine4RectangleFs[3].Y + fiveLine4RectangleFs[4].Y) / 2));
  5029. b4 = Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y);
  5030. }
  5031. if (fiveLine5RectangleFs.Count > 1)
  5032. {
  5033. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5034. if (this.checkBox1.Checked)
  5035. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5036. lineFont, new SolidBrush(Color.Black),
  5037. new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2));
  5038. a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y);
  5039. }
  5040. if (fiveLine5RectangleFs.Count > 2)
  5041. {
  5042. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5043. if (this.checkBox1.Checked)
  5044. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5045. lineFont, new SolidBrush(Color.Black),
  5046. new PointF(fiveLine5RectangleFs[1].X - sizeF.Width / 4, (fiveLine5RectangleFs[1].Y + fiveLine5RectangleFs[2].Y) / 2));
  5047. c5 = Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y);
  5048. }
  5049. if (fiveLine5RectangleFs.Count > 4)
  5050. {
  5051. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5052. if (this.checkBox1.Checked)
  5053. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5054. lineFont, new SolidBrush(Color.Black),
  5055. new PointF(fiveLine5RectangleFs[3].X - sizeF.Width / 4, (fiveLine5RectangleFs[3].Y + fiveLine5RectangleFs[4].Y) / 2));
  5056. b5 = Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y);
  5057. }
  5058. }
  5059. else if (this.type.Equals(constTypeD))
  5060. {
  5061. if (fiveLine1RectangleFs.Count == 2)
  5062. {
  5063. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5064. }
  5065. else if (fiveLine1RectangleFs.Count == 3)
  5066. {
  5067. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5068. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  5069. }
  5070. else if (fiveLine1RectangleFs.Count == 4)
  5071. {
  5072. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5073. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  5074. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength));
  5075. }
  5076. else if (fiveLine1RectangleFs.Count == 5)
  5077. {
  5078. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5079. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  5080. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength));
  5081. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength));
  5082. }
  5083. else if (fiveLine1RectangleFs.Count == 6)
  5084. {
  5085. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5086. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  5087. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength));
  5088. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength));
  5089. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[4].Y - fiveLine1RectangleFs[5].Y) * this.unitLength));
  5090. }
  5091. if (fiveLine2RectangleFs.Count == 2)
  5092. {
  5093. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5094. }
  5095. else if (fiveLine2RectangleFs.Count == 3)
  5096. {
  5097. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5098. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  5099. }
  5100. else if (fiveLine2RectangleFs.Count == 4)
  5101. {
  5102. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5103. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  5104. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength));
  5105. }
  5106. else if (fiveLine2RectangleFs.Count == 5)
  5107. {
  5108. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5109. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  5110. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength));
  5111. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength));
  5112. }
  5113. else if (fiveLine2RectangleFs.Count == 6)
  5114. {
  5115. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5116. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  5117. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength));
  5118. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength));
  5119. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[4].Y - fiveLine2RectangleFs[5].Y) * this.unitLength));
  5120. }
  5121. if (fiveLine3RectangleFs.Count == 2)
  5122. {
  5123. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5124. }
  5125. else if (fiveLine3RectangleFs.Count == 3)
  5126. {
  5127. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5128. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  5129. }
  5130. else if (fiveLine3RectangleFs.Count == 4)
  5131. {
  5132. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5133. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  5134. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength));
  5135. }
  5136. else if (fiveLine3RectangleFs.Count == 5)
  5137. {
  5138. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5139. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  5140. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength));
  5141. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength));
  5142. }
  5143. else if (fiveLine3RectangleFs.Count == 6)
  5144. {
  5145. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5146. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  5147. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength));
  5148. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength));
  5149. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[4].Y - fiveLine3RectangleFs[5].Y) * this.unitLength));
  5150. }
  5151. if (fiveLine4RectangleFs.Count == 2)
  5152. {
  5153. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5154. }
  5155. else if (fiveLine4RectangleFs.Count == 3)
  5156. {
  5157. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5158. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  5159. }
  5160. else if (fiveLine4RectangleFs.Count == 4)
  5161. {
  5162. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5163. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  5164. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength));
  5165. }
  5166. else if (fiveLine4RectangleFs.Count == 5)
  5167. {
  5168. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5169. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  5170. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength));
  5171. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength));
  5172. }
  5173. else if (fiveLine4RectangleFs.Count == 6)
  5174. {
  5175. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5176. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  5177. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength));
  5178. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength));
  5179. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[4].Y - fiveLine4RectangleFs[5].Y) * this.unitLength));
  5180. }
  5181. if (fiveLine5RectangleFs.Count == 2)
  5182. {
  5183. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5184. }
  5185. else if (fiveLine5RectangleFs.Count == 3)
  5186. {
  5187. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5188. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  5189. }
  5190. else if (fiveLine5RectangleFs.Count == 4)
  5191. {
  5192. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5193. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  5194. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength));
  5195. }
  5196. else if (fiveLine5RectangleFs.Count == 5)
  5197. {
  5198. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5199. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  5200. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength));
  5201. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength));
  5202. }
  5203. else if (fiveLine5RectangleFs.Count == 6)
  5204. {
  5205. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5206. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  5207. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength));
  5208. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength));
  5209. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[4].Y - fiveLine5RectangleFs[5].Y) * this.unitLength));
  5210. }
  5211. if (fiveLine1RectangleFs.Count > 1)
  5212. {
  5213. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5214. if (this.checkBox1.Checked)
  5215. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5216. lineFont, new SolidBrush(Color.Black),
  5217. new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2));
  5218. a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y);
  5219. }
  5220. if (fiveLine1RectangleFs.Count > 2)
  5221. {
  5222. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5223. if (this.checkBox1.Checked)
  5224. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5225. lineFont, new SolidBrush(Color.Black),
  5226. new PointF(fiveLine1RectangleFs[1].X - sizeF.Width / 4, (fiveLine1RectangleFs[1].Y + fiveLine1RectangleFs[2].Y) / 2));
  5227. c1 = Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y);
  5228. }
  5229. if (fiveLine1RectangleFs.Count > 4)
  5230. {
  5231. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5232. if (this.checkBox1.Checked)
  5233. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5234. lineFont, new SolidBrush(Color.Black),
  5235. new PointF(fiveLine1RectangleFs[3].X - sizeF.Width / 4, (fiveLine1RectangleFs[3].Y + fiveLine1RectangleFs[4].Y) / 2));
  5236. d1 = Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y);
  5237. }
  5238. if (fiveLine1RectangleFs.Count > 5)
  5239. {
  5240. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[4].Y - fiveLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5241. if (this.checkBox1.Checked)
  5242. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[4].Y - fiveLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  5243. lineFont, new SolidBrush(Color.Black),
  5244. new PointF(fiveLine1RectangleFs[4].X - sizeF.Width / 4, (fiveLine1RectangleFs[4].Y + fiveLine1RectangleFs[5].Y) / 2));
  5245. b1 = Math.Abs(fiveLine1RectangleFs[4].Y - fiveLine1RectangleFs[5].Y);
  5246. }
  5247. if (fiveLine2RectangleFs.Count > 1)
  5248. {
  5249. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5250. if (this.checkBox1.Checked)
  5251. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5252. lineFont, new SolidBrush(Color.Black),
  5253. new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2));
  5254. a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y);
  5255. }
  5256. if (fiveLine2RectangleFs.Count > 2)
  5257. {
  5258. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5259. if (this.checkBox1.Checked)
  5260. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5261. lineFont, new SolidBrush(Color.Black),
  5262. new PointF(fiveLine2RectangleFs[1].X - sizeF.Width / 4, (fiveLine2RectangleFs[1].Y + fiveLine2RectangleFs[2].Y) / 2));
  5263. c2 = Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y);
  5264. }
  5265. if (fiveLine2RectangleFs.Count > 4)
  5266. {
  5267. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5268. if (this.checkBox1.Checked)
  5269. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5270. lineFont, new SolidBrush(Color.Black),
  5271. new PointF(fiveLine2RectangleFs[3].X - sizeF.Width / 4, (fiveLine2RectangleFs[3].Y + fiveLine2RectangleFs[4].Y) / 2));
  5272. d2 = Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y);
  5273. }
  5274. if (fiveLine2RectangleFs.Count > 5)
  5275. {
  5276. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[4].Y - fiveLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5277. if (this.checkBox1.Checked)
  5278. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[4].Y - fiveLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  5279. lineFont, new SolidBrush(Color.Black),
  5280. new PointF(fiveLine2RectangleFs[4].X - sizeF.Width / 4, (fiveLine2RectangleFs[4].Y + fiveLine2RectangleFs[5].Y) / 2));
  5281. b2 = Math.Abs(fiveLine2RectangleFs[4].Y - fiveLine2RectangleFs[5].Y);
  5282. }
  5283. if (fiveLine3RectangleFs.Count > 1)
  5284. {
  5285. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5286. if (this.checkBox1.Checked)
  5287. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5288. lineFont, new SolidBrush(Color.Black),
  5289. new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2));
  5290. a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y);
  5291. }
  5292. if (fiveLine3RectangleFs.Count > 2)
  5293. {
  5294. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5295. if (this.checkBox1.Checked)
  5296. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5297. lineFont, new SolidBrush(Color.Black),
  5298. new PointF(fiveLine3RectangleFs[1].X - sizeF.Width / 4, (fiveLine3RectangleFs[1].Y + fiveLine3RectangleFs[2].Y) / 2));
  5299. c3 = Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y);
  5300. }
  5301. if (fiveLine3RectangleFs.Count > 4)
  5302. {
  5303. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5304. if (this.checkBox1.Checked)
  5305. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5306. lineFont, new SolidBrush(Color.Black),
  5307. new PointF(fiveLine3RectangleFs[3].X - sizeF.Width / 4, (fiveLine3RectangleFs[3].Y + fiveLine3RectangleFs[4].Y) / 2));
  5308. d3 = Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y);
  5309. }
  5310. if (fiveLine3RectangleFs.Count > 5)
  5311. {
  5312. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[4].Y - fiveLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5313. if (this.checkBox1.Checked)
  5314. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[4].Y - fiveLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  5315. lineFont, new SolidBrush(Color.Black),
  5316. new PointF(fiveLine3RectangleFs[4].X - sizeF.Width / 4, (fiveLine3RectangleFs[4].Y + fiveLine3RectangleFs[5].Y) / 2));
  5317. b3 = Math.Abs(fiveLine3RectangleFs[4].Y - fiveLine3RectangleFs[5].Y);
  5318. }
  5319. if (fiveLine4RectangleFs.Count > 1)
  5320. {
  5321. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5322. if (this.checkBox1.Checked)
  5323. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5324. lineFont, new SolidBrush(Color.Black),
  5325. new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2));
  5326. a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y);
  5327. }
  5328. if (fiveLine4RectangleFs.Count > 2)
  5329. {
  5330. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5331. if (this.checkBox1.Checked)
  5332. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5333. lineFont, new SolidBrush(Color.Black),
  5334. new PointF(fiveLine4RectangleFs[1].X - sizeF.Width / 4, (fiveLine4RectangleFs[1].Y + fiveLine4RectangleFs[2].Y) / 2));
  5335. c4 = Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y);
  5336. }
  5337. if (fiveLine4RectangleFs.Count > 4)
  5338. {
  5339. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5340. if (this.checkBox1.Checked)
  5341. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5342. lineFont, new SolidBrush(Color.Black),
  5343. new PointF(fiveLine4RectangleFs[3].X - sizeF.Width / 4, (fiveLine4RectangleFs[3].Y + fiveLine4RectangleFs[4].Y) / 2));
  5344. d4 = Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y);
  5345. }
  5346. if (fiveLine4RectangleFs.Count > 5)
  5347. {
  5348. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[4].Y - fiveLine4RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5349. if (this.checkBox1.Checked)
  5350. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[4].Y - fiveLine4RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  5351. lineFont, new SolidBrush(Color.Black),
  5352. new PointF(fiveLine4RectangleFs[4].X - sizeF.Width / 4, (fiveLine4RectangleFs[4].Y + fiveLine4RectangleFs[5].Y) / 2));
  5353. b4 = Math.Abs(fiveLine4RectangleFs[4].Y - fiveLine4RectangleFs[5].Y);
  5354. }
  5355. if (fiveLine5RectangleFs.Count > 1)
  5356. {
  5357. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5358. if (this.checkBox1.Checked)
  5359. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5360. lineFont, new SolidBrush(Color.Black),
  5361. new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2));
  5362. a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y);
  5363. }
  5364. if (fiveLine5RectangleFs.Count > 2)
  5365. {
  5366. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5367. if (this.checkBox1.Checked)
  5368. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5369. lineFont, new SolidBrush(Color.Black),
  5370. new PointF(fiveLine5RectangleFs[1].X - sizeF.Width / 4, (fiveLine5RectangleFs[1].Y + fiveLine5RectangleFs[2].Y) / 2));
  5371. c5 = Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y);
  5372. }
  5373. if (fiveLine5RectangleFs.Count > 4)
  5374. {
  5375. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5376. if (this.checkBox1.Checked)
  5377. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm",
  5378. lineFont, new SolidBrush(Color.Black),
  5379. new PointF(fiveLine5RectangleFs[3].X - sizeF.Width / 4, (fiveLine5RectangleFs[3].Y + fiveLine5RectangleFs[4].Y) / 2));
  5380. d5 = Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y);
  5381. }
  5382. if (fiveLine5RectangleFs.Count > 5)
  5383. {
  5384. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[4].Y - fiveLine5RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5385. if (this.checkBox1.Checked)
  5386. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[4].Y - fiveLine5RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm",
  5387. lineFont, new SolidBrush(Color.Black),
  5388. new PointF(fiveLine5RectangleFs[4].X - sizeF.Width / 4, (fiveLine5RectangleFs[4].Y + fiveLine5RectangleFs[5].Y) / 2));
  5389. b5 = Math.Abs(fiveLine5RectangleFs[4].Y - fiveLine5RectangleFs[5].Y);
  5390. }
  5391. }
  5392. else if (this.type.Equals(constTypeE))
  5393. {
  5394. if (fiveLine1RectangleFs.Count == 2)
  5395. {
  5396. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5397. }
  5398. else if (fiveLine1RectangleFs.Count == 3)
  5399. {
  5400. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength));
  5401. this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength));
  5402. }
  5403. if (fiveLine2RectangleFs.Count == 2)
  5404. {
  5405. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5406. }
  5407. else if (fiveLine2RectangleFs.Count == 3)
  5408. {
  5409. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength));
  5410. this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength));
  5411. }
  5412. if (fiveLine3RectangleFs.Count == 2)
  5413. {
  5414. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5415. }
  5416. else if (fiveLine3RectangleFs.Count == 3)
  5417. {
  5418. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength));
  5419. this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength));
  5420. }
  5421. if (fiveLine4RectangleFs.Count == 2)
  5422. {
  5423. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5424. }
  5425. else if (fiveLine4RectangleFs.Count == 3)
  5426. {
  5427. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength));
  5428. this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength));
  5429. }
  5430. if (fiveLine5RectangleFs.Count == 2)
  5431. {
  5432. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5433. }
  5434. else if (fiveLine5RectangleFs.Count == 3)
  5435. {
  5436. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength));
  5437. this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength));
  5438. }
  5439. if (fiveLine1RectangleFs.Count > 1)
  5440. {
  5441. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5442. if (this.checkBox1.Checked)
  5443. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5444. lineFont, new SolidBrush(Color.Black),
  5445. new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2));
  5446. a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y);
  5447. }
  5448. if (fiveLine1RectangleFs.Count > 2)
  5449. {
  5450. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5451. if (this.checkBox1.Checked)
  5452. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5453. lineFont, new SolidBrush(Color.Black),
  5454. new PointF(fiveLine1RectangleFs[1].X - sizeF.Width / 4, (fiveLine1RectangleFs[1].Y + fiveLine1RectangleFs[2].Y) / 2));
  5455. c1 = Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y);
  5456. }
  5457. if (fiveLine2RectangleFs.Count > 1)
  5458. {
  5459. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5460. if (this.checkBox1.Checked)
  5461. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5462. lineFont, new SolidBrush(Color.Black),
  5463. new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2));
  5464. a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y);
  5465. }
  5466. if (fiveLine2RectangleFs.Count > 2)
  5467. {
  5468. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5469. if (this.checkBox1.Checked)
  5470. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5471. lineFont, new SolidBrush(Color.Black),
  5472. new PointF(fiveLine2RectangleFs[1].X - sizeF.Width / 4, (fiveLine2RectangleFs[1].Y + fiveLine2RectangleFs[2].Y) / 2));
  5473. c2 = Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y);
  5474. }
  5475. if (fiveLine3RectangleFs.Count > 1)
  5476. {
  5477. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5478. if (this.checkBox1.Checked)
  5479. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5480. lineFont, new SolidBrush(Color.Black),
  5481. new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2));
  5482. a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y);
  5483. }
  5484. if (fiveLine3RectangleFs.Count > 2)
  5485. {
  5486. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5487. if (this.checkBox1.Checked)
  5488. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5489. lineFont, new SolidBrush(Color.Black),
  5490. new PointF(fiveLine3RectangleFs[1].X - sizeF.Width / 4, (fiveLine3RectangleFs[1].Y + fiveLine3RectangleFs[2].Y) / 2));
  5491. c3 = Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y);
  5492. }
  5493. if (fiveLine4RectangleFs.Count > 1)
  5494. {
  5495. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5496. if (this.checkBox1.Checked)
  5497. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5498. lineFont, new SolidBrush(Color.Black),
  5499. new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2));
  5500. a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y);
  5501. }
  5502. if (fiveLine4RectangleFs.Count > 2)
  5503. {
  5504. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5505. if (this.checkBox1.Checked)
  5506. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5507. lineFont, new SolidBrush(Color.Black),
  5508. new PointF(fiveLine4RectangleFs[1].X - sizeF.Width / 4, (fiveLine4RectangleFs[1].Y + fiveLine4RectangleFs[2].Y) / 2));
  5509. c4 = Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y);
  5510. }
  5511. if (fiveLine5RectangleFs.Count > 1)
  5512. {
  5513. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5514. if (this.checkBox1.Checked)
  5515. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm",
  5516. lineFont, new SolidBrush(Color.Black),
  5517. new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2));
  5518. a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y);
  5519. }
  5520. if (fiveLine5RectangleFs.Count > 2)
  5521. {
  5522. sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont);
  5523. if (this.checkBox1.Checked)
  5524. graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm",
  5525. lineFont, new SolidBrush(Color.Black),
  5526. new PointF(fiveLine5RectangleFs[1].X - sizeF.Width / 4, (fiveLine5RectangleFs[1].Y + fiveLine5RectangleFs[2].Y) / 2));
  5527. c5 = Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y);
  5528. }
  5529. }
  5530. }
  5531. #endregion
  5532. #endregion
  5533. #region 计算百分比基数
  5534. if (this.linesNumber == 3)
  5535. {
  5536. if (this.type.Equals(constTypeA))
  5537. {
  5538. int line = 0;
  5539. if (threeLine1RectangleFs.Count > 2)
  5540. {
  5541. line++;
  5542. w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[2].Y);
  5543. }
  5544. if (threeLine2RectangleFs.Count > 2)
  5545. {
  5546. line++;
  5547. w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[2].Y);
  5548. }
  5549. if (threeLine3RectangleFs.Count > 2)
  5550. {
  5551. line++;
  5552. w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[2].Y);
  5553. }
  5554. w = w / line;
  5555. }
  5556. else if (this.type.Equals(constTypeB))
  5557. {
  5558. int line = 0;
  5559. if (threeLine1RectangleFs.Count > 3)
  5560. {
  5561. line++;
  5562. w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[3].Y);
  5563. }
  5564. if (threeLine2RectangleFs.Count > 3 )
  5565. {
  5566. line++;
  5567. w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[3].Y);
  5568. }
  5569. if (threeLine3RectangleFs.Count > 3)
  5570. {
  5571. line++;
  5572. w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[3].Y);
  5573. }
  5574. w = w / line;
  5575. }
  5576. else if (this.type.Equals(constTypeC))
  5577. {
  5578. int line = 0;
  5579. if (threeLine1RectangleFs.Count > 4)
  5580. {
  5581. line++;
  5582. w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[4].Y);
  5583. }
  5584. if (threeLine2RectangleFs.Count > 4)
  5585. {
  5586. line++;
  5587. w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[4].Y);
  5588. }
  5589. if (threeLine3RectangleFs.Count > 4)
  5590. {
  5591. line++;
  5592. w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[4].Y);
  5593. }
  5594. w = w / line;
  5595. }
  5596. else if (this.type.Equals(constTypeD))
  5597. {
  5598. int line = 0;
  5599. if (threeLine1RectangleFs.Count > 5)
  5600. {
  5601. line++;
  5602. w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[5].Y);
  5603. }
  5604. if (threeLine2RectangleFs.Count > 5)
  5605. {
  5606. line++;
  5607. w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[5].Y);
  5608. }
  5609. if (threeLine3RectangleFs.Count > 5)
  5610. {
  5611. line++;
  5612. w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[5].Y);
  5613. }
  5614. w = w / line;
  5615. }
  5616. else if (this.type.Equals(constTypeE))
  5617. {
  5618. int line = 0;
  5619. if (threeLine1RectangleFs.Count > 3)
  5620. {
  5621. line++;
  5622. w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[3].Y);
  5623. }
  5624. if (threeLine2RectangleFs.Count > 3)
  5625. {
  5626. line++;
  5627. w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[3].Y);
  5628. }
  5629. if (threeLine3RectangleFs.Count > 3)
  5630. {
  5631. line++;
  5632. w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[3].Y);
  5633. }
  5634. w = w / line;
  5635. }
  5636. }
  5637. else if (this.linesNumber == 4)
  5638. {
  5639. if (this.type.Equals(constTypeA))
  5640. {
  5641. int line = 0;
  5642. if (fourLine1RectangleFs.Count > 2)
  5643. {
  5644. line++;
  5645. w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[2].Y);
  5646. }
  5647. if (fourLine2RectangleFs.Count > 2)
  5648. {
  5649. line++;
  5650. w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[2].Y);
  5651. }
  5652. if (fourLine3RectangleFs.Count > 2)
  5653. {
  5654. line++;
  5655. w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[2].Y);
  5656. }
  5657. if (fourLine4RectangleFs.Count > 2)
  5658. {
  5659. line++;
  5660. w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[2].Y);
  5661. }
  5662. w = w / line;
  5663. }
  5664. else if (this.type.Equals(constTypeB))
  5665. {
  5666. int line = 0;
  5667. if (fourLine1RectangleFs.Count > 3)
  5668. {
  5669. line++;
  5670. w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[3].Y);
  5671. }
  5672. if (fourLine2RectangleFs.Count > 3)
  5673. {
  5674. line++;
  5675. w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[3].Y);
  5676. }
  5677. if (fourLine3RectangleFs.Count > 3)
  5678. {
  5679. line++;
  5680. w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[3].Y);
  5681. }
  5682. if (fourLine4RectangleFs.Count > 3)
  5683. {
  5684. line++;
  5685. w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[3].Y);
  5686. }
  5687. w = w / line;
  5688. }
  5689. else if (this.type.Equals(constTypeC))
  5690. {
  5691. int line = 0;
  5692. if (fourLine1RectangleFs.Count > 4)
  5693. {
  5694. line++;
  5695. w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[4].Y);
  5696. }
  5697. if (fourLine2RectangleFs.Count > 4)
  5698. {
  5699. line++;
  5700. w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[4].Y);
  5701. }
  5702. if (fourLine3RectangleFs.Count > 4)
  5703. {
  5704. line++;
  5705. w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[4].Y);
  5706. }
  5707. if (fourLine4RectangleFs.Count > 4)
  5708. {
  5709. line++;
  5710. w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[4].Y);
  5711. }
  5712. w = w / line;
  5713. }
  5714. else if (this.type.Equals(constTypeD))
  5715. {
  5716. int line = 0;
  5717. if (fourLine1RectangleFs.Count > 5)
  5718. {
  5719. line++;
  5720. w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[5].Y);
  5721. }
  5722. if (fourLine2RectangleFs.Count > 5)
  5723. {
  5724. line++;
  5725. w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[5].Y);
  5726. }
  5727. if (fourLine3RectangleFs.Count > 5)
  5728. {
  5729. line++;
  5730. w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[5].Y);
  5731. }
  5732. if (fourLine4RectangleFs.Count > 5)
  5733. {
  5734. line++;
  5735. w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[5].Y);
  5736. }
  5737. w = w / line;
  5738. }
  5739. else if (this.type.Equals(constTypeE))
  5740. {
  5741. int line = 0;
  5742. if (fourLine1RectangleFs.Count > 3)
  5743. {
  5744. line++;
  5745. w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[3].Y);
  5746. }
  5747. if (fourLine2RectangleFs.Count > 3)
  5748. {
  5749. line++;
  5750. w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[3].Y);
  5751. }
  5752. if (fourLine3RectangleFs.Count > 3)
  5753. {
  5754. line++;
  5755. w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[3].Y);
  5756. }
  5757. if (fourLine4RectangleFs.Count > 3)
  5758. {
  5759. line++;
  5760. w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[3].Y);
  5761. }
  5762. w = w / line;
  5763. }
  5764. }
  5765. else if (this.linesNumber == 5)
  5766. {
  5767. if (this.type.Equals(constTypeA))
  5768. {
  5769. int line = 0;
  5770. if (fiveLine1RectangleFs.Count > 2)
  5771. {
  5772. line++;
  5773. w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[2].Y);
  5774. }
  5775. if (fiveLine2RectangleFs.Count > 2)
  5776. {
  5777. line++;
  5778. w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[2].Y);
  5779. }
  5780. if (fiveLine3RectangleFs.Count > 2)
  5781. {
  5782. line++;
  5783. w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[2].Y);
  5784. }
  5785. if (fiveLine4RectangleFs.Count > 2)
  5786. {
  5787. line++;
  5788. w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[2].Y);
  5789. }
  5790. if (fiveLine5RectangleFs.Count > 2)
  5791. {
  5792. line++;
  5793. w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[2].Y);
  5794. }
  5795. w = w / line;
  5796. }
  5797. else if (this.type.Equals(constTypeB))
  5798. {
  5799. int line = 0;
  5800. if (fiveLine1RectangleFs.Count > 3)
  5801. {
  5802. line++;
  5803. w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[3].Y);
  5804. }
  5805. if (fiveLine2RectangleFs.Count > 3)
  5806. {
  5807. line++;
  5808. w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[3].Y);
  5809. }
  5810. if (fiveLine3RectangleFs.Count > 3)
  5811. {
  5812. line++;
  5813. w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[3].Y);
  5814. }
  5815. if (fiveLine4RectangleFs.Count > 3)
  5816. {
  5817. line++;
  5818. w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[3].Y);
  5819. }
  5820. if (fiveLine5RectangleFs.Count > 3)
  5821. {
  5822. line++;
  5823. w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[3].Y);
  5824. }
  5825. w = w / line;
  5826. }
  5827. else if (this.type.Equals(constTypeC))
  5828. {
  5829. int line = 0;
  5830. if (fiveLine1RectangleFs.Count > 4)
  5831. {
  5832. line++;
  5833. w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[4].Y);
  5834. }
  5835. if (fiveLine2RectangleFs.Count > 4)
  5836. {
  5837. line++;
  5838. w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[4].Y);
  5839. }
  5840. if (fiveLine3RectangleFs.Count > 4)
  5841. {
  5842. line++;
  5843. w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[4].Y);
  5844. }
  5845. if (fiveLine4RectangleFs.Count > 4)
  5846. {
  5847. line++;
  5848. w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[4].Y);
  5849. }
  5850. if (fiveLine5RectangleFs.Count > 4)
  5851. {
  5852. line++;
  5853. w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[4].Y);
  5854. }
  5855. w = w / line;
  5856. }
  5857. else if (this.type.Equals(constTypeD))
  5858. {
  5859. int line = 0;
  5860. if (fiveLine1RectangleFs.Count > 5)
  5861. {
  5862. line++;
  5863. w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[5].Y);
  5864. }
  5865. if (fiveLine2RectangleFs.Count > 5)
  5866. {
  5867. line++;
  5868. w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[5].Y);
  5869. }
  5870. if (fiveLine3RectangleFs.Count > 5)
  5871. {
  5872. line++;
  5873. w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[5].Y);
  5874. }
  5875. if (fiveLine4RectangleFs.Count > 5)
  5876. {
  5877. line++;
  5878. w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[5].Y);
  5879. }
  5880. if (fiveLine5RectangleFs.Count > 5)
  5881. {
  5882. line++;
  5883. w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[5].Y);
  5884. }
  5885. w = w / line;
  5886. }
  5887. else if (this.type.Equals(constTypeE))
  5888. {
  5889. int line = 0;
  5890. if (fiveLine1RectangleFs.Count > 3)
  5891. {
  5892. line++;
  5893. w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[3].Y);
  5894. }
  5895. if (fiveLine2RectangleFs.Count > 3)
  5896. {
  5897. line++;
  5898. w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[3].Y);
  5899. }
  5900. if (fiveLine3RectangleFs.Count > 3)
  5901. {
  5902. line++;
  5903. w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[3].Y);
  5904. }
  5905. if (fiveLine4RectangleFs.Count > 3)
  5906. {
  5907. line++;
  5908. w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[3].Y);
  5909. }
  5910. if (fiveLine5RectangleFs.Count > 3)
  5911. {
  5912. line++;
  5913. w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[3].Y);
  5914. }
  5915. w = w / line;
  5916. }
  5917. }
  5918. #endregion
  5919. if(w > 0)
  5920. {
  5921. Matrix mtxSave = graphics.Transform;
  5922. Matrix matrix = graphics.Transform;
  5923. float sp = 0;
  5924. // 线条数为三
  5925. if (this.linesNumber == 3)
  5926. {
  5927. sp = this.documentWorkspace.CompositionSurface.Width - (this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing);
  5928. PointF point = new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + sp / 2 - this.lineWidth / 2, this.documentWorkspace.CompositionSurface.Height / 2);
  5929. 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));
  5930. matrix.RotateAt((float)90, new PointF(point.X, point.Y));
  5931. graphics.Transform = matrix;
  5932. graphics.DrawString("" + Math.Round(w * this.unitLength, this.decimalCls) + "μm", lineFont, brush, point);
  5933. //还原为原始旋转矩阵
  5934. graphics.Transform = mtxSave;
  5935. }
  5936. // 线条数为四
  5937. else if (this.linesNumber == 4)
  5938. {
  5939. sp = this.documentWorkspace.CompositionSurface.Width - (this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2);
  5940. PointF point = new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 + sp / 2 - this.lineWidth / 2, this.documentWorkspace.CompositionSurface.Height / 2);
  5941. 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));
  5942. matrix.RotateAt((float)90, new PointF(point.X, point.Y));
  5943. graphics.Transform = matrix;
  5944. graphics.DrawString("" + Math.Round(w * this.unitLength, this.decimalCls) + "μm", lineFont, brush, point);
  5945. //还原为原始旋转矩阵
  5946. graphics.Transform = mtxSave;
  5947. }
  5948. // 线条数为五
  5949. else if (this.linesNumber == 5)
  5950. {
  5951. sp = this.documentWorkspace.CompositionSurface.Width - (this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing);
  5952. PointF point = new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing + sp / 2 - this.lineWidth / 2, this.documentWorkspace.CompositionSurface.Height / 2);
  5953. 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));
  5954. matrix.RotateAt((float)90, new PointF(point.X, point.Y));
  5955. graphics.Transform = matrix;
  5956. graphics.DrawString("" + Math.Round(w * this.unitLength, this.decimalCls) + "μm", lineFont, brush, point);
  5957. //还原为原始旋转矩阵
  5958. graphics.Transform = mtxSave;
  5959. }
  5960. matrix.Dispose();
  5961. }
  5962. }
  5963. #region 计算测量点百分比
  5964. if (this.pointDrawkb)
  5965. {
  5966. // 取目标值/误差
  5967. int left;
  5968. int right;
  5969. string leftValue;
  5970. string rightValue;
  5971. float length1 = 0;
  5972. float length2 = 0;
  5973. float length3 = 0;
  5974. float length4 = 0;
  5975. float length5 = 0;
  5976. // 线条数为三
  5977. if (this.linesNumber == 3)
  5978. {
  5979. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  5980. {
  5981. // 总百分比
  5982. float all = 0;
  5983. if (i == 0)
  5984. {
  5985. length1 = a1;
  5986. length2 = a2;
  5987. length3 = a3;
  5988. }
  5989. else if (i == 1)
  5990. {
  5991. if (this.type.Equals(constTypeE))
  5992. {
  5993. length1 = c1;
  5994. length2 = c2;
  5995. length3 = c3;
  5996. }
  5997. else
  5998. {
  5999. length1 = b1;
  6000. length2 = b2;
  6001. length3 = b3;
  6002. }
  6003. }
  6004. else if (i == 2)
  6005. {
  6006. length1 = c1;
  6007. length2 = c2;
  6008. length3 = c3;
  6009. }
  6010. else if (i == 3)
  6011. {
  6012. length1 = d1;
  6013. length2 = d2;
  6014. length3 = d3;
  6015. }
  6016. left = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("%");
  6017. right = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("-");
  6018. leftValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(0, left);
  6019. rightValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(right + 1);
  6020. if (pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6021. {
  6022. this.dataGridView2.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6023. this.dataGridView3.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6024. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6025. }
  6026. else
  6027. {
  6028. this.dataGridView2.Rows[i].Cells[2].Value = "" + Math.Round((length1 / w) * 100, decimalCls);
  6029. this.dataGridView3.Rows[i].Cells[2].Value = "" + ((length1 / w) * 100);
  6030. all += (length1 / w) * 100;
  6031. if (length1 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6032. || length1 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6033. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6034. else
  6035. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = SystemColors.ControlLightLight;
  6036. }
  6037. if (pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6038. {
  6039. this.dataGridView2.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6040. this.dataGridView3.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6041. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6042. }
  6043. else
  6044. {
  6045. this.dataGridView2.Rows[i].Cells[3].Value = "" + Math.Round((length2 / w) * 100, decimalCls);
  6046. this.dataGridView3.Rows[i].Cells[3].Value = "" + ((length2 / w) * 100);
  6047. all += (length2 / w) * 100;
  6048. if (length2 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6049. || length2 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6050. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6051. else
  6052. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = SystemColors.ControlLightLight;
  6053. }
  6054. if (pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6055. {
  6056. this.dataGridView2.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6057. this.dataGridView3.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6058. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6059. }
  6060. else
  6061. {
  6062. this.dataGridView2.Rows[i].Cells[4].Value = "" + Math.Round((length3 / w) * 100, decimalCls);
  6063. this.dataGridView3.Rows[i].Cells[4].Value = "" + ((length3 / w) * 100);
  6064. all += (length3 / w) * 100;
  6065. if (length3 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6066. || length3 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6067. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6068. else
  6069. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = SystemColors.ControlLightLight;
  6070. }
  6071. // 平均值
  6072. this.dataGridView2.Rows[i].Cells[7].Value = "" + Math.Round(all / 3, decimalCls);
  6073. this.dataGridView3.Rows[i].Cells[7].Value = "" + (all / 3);
  6074. if (all / 3 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6075. || all / 3 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6076. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = Color.Red;
  6077. else
  6078. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = SystemColors.ControlLightLight;
  6079. }
  6080. }
  6081. // 线条数为四
  6082. else if (this.linesNumber == 4)
  6083. {
  6084. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  6085. {
  6086. // 总百分比
  6087. float all = 0;
  6088. if (i == 0)
  6089. {
  6090. length1 = a1;
  6091. length2 = a2;
  6092. length3 = a3;
  6093. length4 = a4;
  6094. }
  6095. else if (i == 1)
  6096. {
  6097. if (this.type.Equals(constTypeE))
  6098. {
  6099. length1 = c1;
  6100. length2 = c2;
  6101. length3 = c3;
  6102. length4 = c4;
  6103. }
  6104. else
  6105. {
  6106. length1 = b1;
  6107. length2 = b2;
  6108. length3 = b3;
  6109. length4 = b4;
  6110. }
  6111. }
  6112. else if (i == 2)
  6113. {
  6114. length1 = c1;
  6115. length2 = c2;
  6116. length3 = c3;
  6117. length4 = c4;
  6118. }
  6119. else if (i == 3)
  6120. {
  6121. length1 = d1;
  6122. length2 = d2;
  6123. length3 = d3;
  6124. length4 = d4;
  6125. }
  6126. left = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("%");
  6127. right = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("-");
  6128. leftValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(0, left);
  6129. rightValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(right + 1);
  6130. if (pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6131. {
  6132. this.dataGridView2.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6133. this.dataGridView3.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6134. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6135. }
  6136. else
  6137. {
  6138. this.dataGridView2.Rows[i].Cells[2].Value = "" + Math.Round((length1 / w) * 100, decimalCls);
  6139. this.dataGridView3.Rows[i].Cells[2].Value = "" + ((length1 / w) * 100);
  6140. all += (length1 / w) * 100;
  6141. if (length1 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6142. || length1 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6143. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6144. else
  6145. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = SystemColors.ControlLightLight;
  6146. }
  6147. if (pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6148. {
  6149. this.dataGridView2.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6150. this.dataGridView3.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6151. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6152. }
  6153. else
  6154. {
  6155. this.dataGridView2.Rows[i].Cells[3].Value = "" + Math.Round((length2 / w) * 100, decimalCls);
  6156. this.dataGridView3.Rows[i].Cells[3].Value = "" + ((length2 / w) * 100);
  6157. all += (length2 / w) * 100;
  6158. if (length2 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6159. || length2 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6160. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6161. else
  6162. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = SystemColors.ControlLightLight;
  6163. }
  6164. if (pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6165. {
  6166. this.dataGridView2.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6167. this.dataGridView3.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6168. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6169. }
  6170. else
  6171. {
  6172. this.dataGridView2.Rows[i].Cells[4].Value = "" + Math.Round((length3 / w) * 100, decimalCls);
  6173. this.dataGridView3.Rows[i].Cells[4].Value = "" + ((length3 / w) * 100);
  6174. all += (length3 / w) * 100;
  6175. if (length3 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6176. || length3 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6177. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6178. else
  6179. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = SystemColors.ControlLightLight;
  6180. }
  6181. if (pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6182. {
  6183. this.dataGridView2.Rows[i].Cells[5].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6184. this.dataGridView3.Rows[i].Cells[5].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6185. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red;
  6186. }
  6187. else
  6188. {
  6189. this.dataGridView2.Rows[i].Cells[5].Value = "" + Math.Round((length4 / w) * 100, decimalCls);
  6190. this.dataGridView3.Rows[i].Cells[5].Value = "" + ((length4 / w) * 100);
  6191. all += (length4 / w) * 100;
  6192. if (length4 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6193. || length4 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6194. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red;
  6195. else
  6196. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = SystemColors.ControlLightLight;
  6197. }
  6198. // 平均值
  6199. this.dataGridView2.Rows[i].Cells[7].Value = "" + Math.Round(all / 4, decimalCls);
  6200. this.dataGridView3.Rows[i].Cells[7].Value = "" + (all / 4);
  6201. if (all / 4 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6202. || all / 4 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6203. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = Color.Red;
  6204. else
  6205. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = SystemColors.ControlLightLight;
  6206. }
  6207. }
  6208. // 线条数为五
  6209. else if (this.linesNumber == 5)
  6210. {
  6211. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  6212. {
  6213. // 总百分比
  6214. float all = 0;
  6215. if (i == 0)
  6216. {
  6217. length1 = a1;
  6218. length2 = a2;
  6219. length3 = a3;
  6220. length4 = a4;
  6221. length5 = a5;
  6222. }
  6223. else if (i == 1)
  6224. {
  6225. if (this.type.Equals(constTypeE))
  6226. {
  6227. length1 = c1;
  6228. length2 = c2;
  6229. length3 = c3;
  6230. length4 = c4;
  6231. length4 = c5;
  6232. }
  6233. else
  6234. {
  6235. length1 = b1;
  6236. length2 = b2;
  6237. length3 = b3;
  6238. length4 = b4;
  6239. length4 = b5;
  6240. }
  6241. }
  6242. else if (i == 2)
  6243. {
  6244. length1 = c1;
  6245. length2 = c2;
  6246. length3 = c3;
  6247. length4 = c4;
  6248. length5 = c5;
  6249. }
  6250. else if (i == 3)
  6251. {
  6252. length1 = d1;
  6253. length2 = d2;
  6254. length3 = d3;
  6255. length4 = d4;
  6256. length5 = d5;
  6257. }
  6258. left = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("%");
  6259. right = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("-");
  6260. leftValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(0, left);
  6261. rightValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(right + 1);
  6262. if (pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6263. {
  6264. this.dataGridView2.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6265. this.dataGridView3.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6266. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6267. }
  6268. else
  6269. {
  6270. this.dataGridView2.Rows[i].Cells[2].Value = "" + Math.Round((length1 / w) * 100, decimalCls);
  6271. this.dataGridView3.Rows[i].Cells[2].Value = "" + ((length1 / w) * 100);
  6272. all += (length1 / w) * 100;
  6273. if (length1 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6274. || length1 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6275. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6276. else
  6277. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = SystemColors.ControlLightLight;
  6278. }
  6279. if (pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6280. {
  6281. this.dataGridView2.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6282. this.dataGridView3.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6283. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6284. }
  6285. else
  6286. {
  6287. this.dataGridView2.Rows[i].Cells[3].Value = "" + Math.Round((length2 / w) * 100, decimalCls);
  6288. this.dataGridView3.Rows[i].Cells[3].Value = "" + ((length2 / w) * 100);
  6289. all += (length2 / w) * 100;
  6290. if (length2 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6291. || length2 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6292. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6293. else
  6294. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = SystemColors.ControlLightLight;
  6295. }
  6296. if (pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6297. {
  6298. this.dataGridView2.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6299. this.dataGridView3.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6300. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6301. }
  6302. else
  6303. {
  6304. this.dataGridView2.Rows[i].Cells[4].Value = "" + Math.Round((length3 / w) * 100, decimalCls);
  6305. this.dataGridView3.Rows[i].Cells[4].Value = "" + ((length3 / w) * 100);
  6306. all += (length3 / w) * 100;
  6307. if (length3 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6308. || length3 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6309. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6310. else
  6311. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = SystemColors.ControlLightLight;
  6312. }
  6313. if (pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6314. {
  6315. this.dataGridView2.Rows[i].Cells[5].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6316. this.dataGridView3.Rows[i].Cells[5].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6317. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red;
  6318. }
  6319. else
  6320. {
  6321. this.dataGridView2.Rows[i].Cells[5].Value = "" + Math.Round((length4 / w) * 100, decimalCls);
  6322. this.dataGridView3.Rows[i].Cells[5].Value = "" + ((length4 / w) * 100);
  6323. all += (length4 / w) * 100;
  6324. if (length4 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6325. || length4 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6326. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red;
  6327. else
  6328. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = SystemColors.ControlLightLight;
  6329. }
  6330. if (pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount)
  6331. {
  6332. this.dataGridView2.Rows[i].Cells[6].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6333. this.dataGridView3.Rows[i].Cells[6].Value = PdnResources.GetString("Menu.Alittleless.Text");
  6334. this.dataGridView2.Rows[i].Cells[6].Style.BackColor = Color.Red;
  6335. }
  6336. else
  6337. {
  6338. this.dataGridView2.Rows[i].Cells[6].Value = "" + Math.Round((length5 / w) * 100, decimalCls);
  6339. this.dataGridView3.Rows[i].Cells[6].Value = "" + ((length5 / w) * 100);
  6340. all += (length5 / w) * 100;
  6341. if (length5 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6342. || length5 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6343. this.dataGridView2.Rows[i].Cells[6].Style.BackColor = Color.Red;
  6344. else
  6345. this.dataGridView2.Rows[i].Cells[6].Style.BackColor = SystemColors.ControlLightLight;
  6346. }
  6347. // 平均值
  6348. this.dataGridView2.Rows[i].Cells[7].Value = "" + Math.Round(all / 5, decimalCls);
  6349. this.dataGridView3.Rows[i].Cells[7].Value = "" + (all / 5);
  6350. if (all / 5 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6351. || all / 5 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6352. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = Color.Red;
  6353. else
  6354. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = SystemColors.ControlLightLight;
  6355. }
  6356. }
  6357. }
  6358. #endregion
  6359. brush.Dispose();
  6360. }
  6361. /// <summary>
  6362. /// 鼠标按下
  6363. /// </summary>
  6364. /// <param name="drawArea"></param>
  6365. /// <param name="e"></param>
  6366. private void OnMouseDown(object sender, MouseEventArgs e)
  6367. {
  6368. if (e.Button != MouseButtons.Left)
  6369. return;
  6370. for (int i = 0; i < this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count; i++)
  6371. {
  6372. this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].Selected = false;
  6373. }
  6374. // 换算后的点
  6375. PointF point1 = documentWorkspace.GetScalePoint(e.Location);
  6376. // 选择范围
  6377. int selectTop = 0;
  6378. int selectBottom = 0;
  6379. if (operationK == 0)
  6380. {
  6381. selectTop = 0;
  6382. selectBottom = this.documentWorkspace.CompositionSurface.Height;
  6383. }
  6384. else if (operationK == 1 || operationK == 2)
  6385. {
  6386. selectTop = - (int)this.pointDiameter / 2;
  6387. selectBottom = this.documentWorkspace.CompositionSurface.Height + (int)this.pointDiameter / 2;
  6388. }
  6389. // 点在图片内
  6390. if (point1.Y >= selectTop && point1.Y <= selectBottom)
  6391. {
  6392. // 添加测量点
  6393. if (operationK == 0)
  6394. {
  6395. // 线条数为三
  6396. if (this.linesNumber == 3)
  6397. {
  6398. // 在线条上添加测量点
  6399. if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing + this.lineWidth / 2
  6400. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineWidth / 2)
  6401. {
  6402. // 可绘制的点数
  6403. if (pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6404. {
  6405. // 创建用于绘制测量点的矩形
  6406. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6407. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6408. this.saveSuccess = true;
  6409. }
  6410. pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6411. if (pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6412. pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6413. }
  6414. // 在线条上添加测量点
  6415. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineWidth / 2
  6416. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineWidth / 2)
  6417. {
  6418. // 可绘制的点数
  6419. if (pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6420. {
  6421. // 创建用于绘制测量点的矩形
  6422. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6423. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6424. this.saveSuccess = true;
  6425. }
  6426. pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6427. if (pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6428. pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6429. }
  6430. // 在线条上添加测量点
  6431. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineWidth / 2
  6432. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.lineWidth / 2)
  6433. {
  6434. // 可绘制的点数
  6435. if (pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6436. {
  6437. // 创建用于绘制测量点的矩形
  6438. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6439. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6440. this.saveSuccess = true;
  6441. }
  6442. pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6443. if (pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6444. pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6445. }
  6446. }
  6447. // 线条数为四
  6448. else if (this.linesNumber == 4)
  6449. {
  6450. // 在线条上添加测量点
  6451. if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2 + this.lineWidth / 2
  6452. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2 - this.lineWidth / 2)
  6453. {
  6454. // 可绘制的点数
  6455. if (pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6456. {
  6457. // 创建用于绘制测量点的矩形
  6458. 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);
  6459. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6460. this.saveSuccess = true;
  6461. }
  6462. pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6463. if (pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6464. pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6465. }
  6466. // 在线条上添加测量点
  6467. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 + this.lineWidth / 2
  6468. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 - this.lineWidth / 2)
  6469. {
  6470. // 可绘制的点数
  6471. if (pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6472. {
  6473. // 创建用于绘制测量点的矩形
  6474. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6475. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6476. this.saveSuccess = true;
  6477. }
  6478. pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6479. if (pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6480. pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6481. }
  6482. // 在线条上添加测量点
  6483. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 + this.lineWidth / 2
  6484. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 - this.lineWidth / 2)
  6485. {
  6486. // 可绘制的点数
  6487. if (pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6488. {
  6489. // 创建用于绘制测量点的矩形
  6490. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6491. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6492. this.saveSuccess = true;
  6493. }
  6494. pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6495. if (pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6496. pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6497. }
  6498. // 在线条上添加测量点
  6499. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 + this.lineWidth / 2
  6500. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 - this.lineWidth / 2)
  6501. {
  6502. // 可绘制的点数
  6503. if (pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6504. {
  6505. // 创建用于绘制测量点的矩形
  6506. 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);
  6507. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6508. this.saveSuccess = true;
  6509. }
  6510. pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6511. if (pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6512. pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6513. }
  6514. }
  6515. // 线条数为五
  6516. else if (this.linesNumber == 5)
  6517. {
  6518. // 在线条上添加测量点
  6519. if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing + this.lineWidth / 2
  6520. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing - this.lineWidth / 2)
  6521. {
  6522. // 可绘制的点数
  6523. if (pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6524. {
  6525. // 创建用于绘制测量点的矩形
  6526. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6527. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6528. this.saveSuccess = true;
  6529. }
  6530. pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6531. if (pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6532. pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6533. }
  6534. // 在线条上添加测量点
  6535. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing + this.lineWidth / 2
  6536. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineWidth / 2)
  6537. {
  6538. // 可绘制的点数
  6539. if (pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6540. {
  6541. // 创建用于绘制测量点的矩形
  6542. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6543. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6544. this.saveSuccess = true;
  6545. }
  6546. pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6547. if (pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6548. pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6549. }
  6550. // 在线条上添加测量点
  6551. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineWidth / 2
  6552. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineWidth / 2)
  6553. {
  6554. // 可绘制的点数
  6555. if (pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6556. {
  6557. // 创建用于绘制测量点的矩形
  6558. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6559. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6560. this.saveSuccess = true;
  6561. }
  6562. pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6563. if (pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6564. pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6565. }
  6566. // 在线条上添加测量点
  6567. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineWidth / 2
  6568. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.lineWidth / 2)
  6569. {
  6570. // 可绘制的点数
  6571. if (pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6572. {
  6573. // 创建用于绘制测量点的矩形
  6574. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6575. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6576. this.saveSuccess = true;
  6577. }
  6578. pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6579. if (pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6580. pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6581. }
  6582. // 在线条上添加测量点
  6583. else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing + this.lineWidth / 2
  6584. && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing - this.lineWidth / 2)
  6585. {
  6586. // 可绘制的点数
  6587. if (pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount)
  6588. {
  6589. // 创建用于绘制测量点的矩形
  6590. RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter);
  6591. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF);
  6592. this.saveSuccess = true;
  6593. }
  6594. pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex]++;
  6595. if (pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1)
  6596. pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount;
  6597. }
  6598. }
  6599. }
  6600. // 选择测量点
  6601. else if (operationK == 1)
  6602. {
  6603. for (int i = 0; i < this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count; i++)
  6604. {
  6605. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Contains(point1))
  6606. {
  6607. m_canMove = true;
  6608. selected = i;
  6609. this.m_StartPoint = point1;
  6610. }
  6611. }
  6612. }
  6613. // 删除测量点
  6614. else if (operationK == 2)
  6615. {
  6616. int count = this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count;
  6617. // 循环测量点矩形集合
  6618. for (int i = count - 1; i >= 0; i--)
  6619. {
  6620. // 线条数为三
  6621. if (this.linesNumber == 3)
  6622. {
  6623. // 鼠标在矩形内
  6624. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Contains(point1))
  6625. {
  6626. // 第一条线
  6627. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2)
  6628. {
  6629. pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6630. if (pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6631. pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6632. }
  6633. // 第二条线
  6634. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2
  6635. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2)
  6636. {
  6637. pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6638. if (pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6639. pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6640. }
  6641. // 第三条线
  6642. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2)
  6643. {
  6644. pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6645. if (pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6646. pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6647. }
  6648. // 删除选择的矩形
  6649. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].RemoveAt(i);
  6650. this.saveSuccess = true;
  6651. break;
  6652. }
  6653. }
  6654. // 线条数为四
  6655. else if (this.linesNumber == 4)
  6656. {
  6657. // 鼠标在矩形内
  6658. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Contains(point1))
  6659. {
  6660. // 第一条线
  6661. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing)
  6662. {
  6663. pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6664. if (pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6665. pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6666. }
  6667. // 第二条线
  6668. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2
  6669. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing)
  6670. {
  6671. pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6672. if (pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6673. pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6674. }
  6675. // 第三条线
  6676. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing
  6677. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2)
  6678. {
  6679. pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6680. if (pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6681. pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6682. }
  6683. // 第四条线
  6684. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing)
  6685. {
  6686. pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6687. if (pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6688. pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6689. }
  6690. // 删除选择的矩形
  6691. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].RemoveAt(i);
  6692. this.saveSuccess = true;
  6693. break;
  6694. }
  6695. }
  6696. // 线条数为五
  6697. else if (this.linesNumber == 5)
  6698. {
  6699. // 鼠标在矩形内
  6700. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Contains(point1))
  6701. {
  6702. // 第一条线
  6703. if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2)
  6704. {
  6705. pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6706. if (pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6707. pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6708. }
  6709. // 第二条线
  6710. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2
  6711. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2)
  6712. {
  6713. pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6714. if (pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6715. pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6716. }
  6717. // 第三条线
  6718. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2
  6719. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2)
  6720. {
  6721. pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6722. if (pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6723. pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6724. }
  6725. // 第四条线
  6726. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2
  6727. && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2)
  6728. {
  6729. pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6730. if (pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6731. pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6732. }
  6733. // 第五条线
  6734. else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2)
  6735. {
  6736. pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex]--;
  6737. if (pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] < 0)
  6738. pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] = 0;
  6739. }
  6740. // 删除选择的矩形
  6741. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].RemoveAt(i);
  6742. this.saveSuccess = true;
  6743. break;
  6744. }
  6745. }
  6746. }
  6747. }
  6748. }
  6749. this.documentWorkspace.Refresh();
  6750. }
  6751. /// <summary>
  6752. /// 选择测量点移动
  6753. /// </summary>
  6754. /// <param name="sender"></param>
  6755. /// <param name="e"></param>
  6756. private void onMouseMove(object sender, MouseEventArgs e)
  6757. {
  6758. // 换算后的点
  6759. PointF point1 = documentWorkspace.GetScalePoint(e.Location);
  6760. if (e.Button == MouseButtons.Left && m_canMove)
  6761. {
  6762. RectangleF rectangleF = new RectangleF();
  6763. rectangleF = this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][selected];
  6764. // 矩形偏移
  6765. rectangleF.Offset(0, point1.Y - this.m_StartPoint.Y);
  6766. if (rectangleF.Bottom > this.documentWorkspace.CompositionSurface.Height + rectangleF.Height / 2)
  6767. rectangleF.Y = this.documentWorkspace.CompositionSurface.Height - rectangleF.Height + rectangleF.Height / 2;
  6768. if (rectangleF.Top < - rectangleF.Height / 2)
  6769. rectangleF.Y = - rectangleF.Height / 2;
  6770. if (point1.Y <= this.documentWorkspace.CompositionSurface.Height && point1.Y >= 0)
  6771. this.m_StartPoint = point1;
  6772. this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][selected] = rectangleF;
  6773. this.saveSuccess = true;
  6774. this.documentWorkspace.Refresh();
  6775. }
  6776. }
  6777. /// <summary>
  6778. /// 鼠标抬起(测量点不可移动)
  6779. /// </summary>
  6780. /// <param name="sender"></param>
  6781. /// <param name="e"></param>
  6782. private void onMouseUp(object sender, MouseEventArgs e)
  6783. {
  6784. m_canMove = false;
  6785. }
  6786. /// <summary>
  6787. /// 添加测量点
  6788. /// </summary>
  6789. /// <param name="sender"></param>
  6790. /// <param name="e"></param>
  6791. private void button6_Click(object sender, EventArgs e)
  6792. {
  6793. if (dataGridView1.SelectedRows.Count == 0)
  6794. return;
  6795. operationK = 0;
  6796. selected = -1;
  6797. this.documentWorkspace.Refresh();
  6798. }
  6799. /// <summary>
  6800. /// 失去焦点
  6801. /// </summary>
  6802. /// <param name="sender"></param>
  6803. /// <param name="e"></param>
  6804. private void button6_LostFocus(object sender, EventArgs e)
  6805. {
  6806. operationK = -1;
  6807. selected = -1;
  6808. this.documentWorkspace.Refresh();
  6809. }
  6810. /// <summary>
  6811. /// 失去焦点
  6812. /// </summary>
  6813. /// <param name="sender"></param>
  6814. /// <param name="e"></param>
  6815. private void button7_LostFocus(object sender, EventArgs e)
  6816. {
  6817. operationK = -1;
  6818. selected = -1;
  6819. this.documentWorkspace.Refresh();
  6820. }
  6821. /// <summary>
  6822. /// 失去焦点
  6823. /// </summary>
  6824. /// <param name="sender"></param>
  6825. /// <param name="e"></param>
  6826. private void button8_LostFocus(object sender, EventArgs e)
  6827. {
  6828. operationK = -1;
  6829. selected = -1;
  6830. this.documentWorkspace.Refresh();
  6831. }
  6832. /// <summary>
  6833. /// 选择测量点
  6834. /// </summary>
  6835. /// <param name="sender"></param>
  6836. /// <param name="e"></param>
  6837. private void button8_Click(object sender, EventArgs e)
  6838. {
  6839. if (dataGridView1.SelectedRows.Count == 0)
  6840. return;
  6841. operationK = 1;
  6842. }
  6843. /// <summary>
  6844. /// 删除测量点
  6845. /// </summary>
  6846. /// <param name="sender"></param>
  6847. /// <param name="e"></param>
  6848. private void button7_Click(object sender, EventArgs e)
  6849. {
  6850. if (dataGridView1.SelectedRows.Count == 0)
  6851. return;
  6852. operationK = 2;
  6853. selected = -1;
  6854. this.documentWorkspace.Refresh();
  6855. }
  6856. /// <summary>
  6857. /// 辅助线样式设置
  6858. /// </summary>
  6859. /// <param name="sender"></param>
  6860. /// <param name="e"></param>
  6861. private void button9_Click(object sender, EventArgs e)
  6862. {
  6863. GuideStyleSettingsDialog guideStyleSettingsDialog = new GuideStyleSettingsDialog(this.lineChange);
  6864. guideStyleSettingsDialog.StartPosition = FormStartPosition.CenterScreen;
  6865. guideStyleSettingsDialog.ShowDialog(this);
  6866. }
  6867. /// <summary>
  6868. /// 测量点样式设置
  6869. /// </summary>
  6870. /// <param name="sender"></param>
  6871. /// <param name="e"></param>
  6872. private void button10_Click(object sender, EventArgs e)
  6873. {
  6874. SurveyPointStyleSettingDialog surveyPointStyleSettingDialog = new SurveyPointStyleSettingDialog();
  6875. surveyPointStyleSettingDialog.StartPosition = FormStartPosition.CenterScreen;
  6876. surveyPointStyleSettingDialog.ShowDialog(this);
  6877. }
  6878. /// <summary>
  6879. /// 从XML获取数据
  6880. /// </summary>
  6881. private void GetDataFromXML()
  6882. {
  6883. workpieceMaintenanceModel = XmlSerializeHelper.DESerializer<WorkpieceMaintenanceModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkpieceMaintenanceModel.xml", FileMode.Open));
  6884. // 工件类型
  6885. this.type = string.Empty;
  6886. if (workpieceMaintenanceModel.Workpieces != null && this.comboBox1.DataSource != null)
  6887. {
  6888. for (int i = 0; i < workpieceMaintenanceModel.Workpieces.Count; i++)
  6889. {
  6890. if (workpieceMaintenanceModel.Workpieces[i].Name.Equals(this.comboBox1.SelectedValue))
  6891. this.type = workpieceMaintenanceModel.Workpieces[i].Type;
  6892. }
  6893. if (this.type.Equals(constTypeA))
  6894. pointDrawCount = 3;
  6895. else if (this.type.Equals(constTypeB))
  6896. pointDrawCount = 4;
  6897. else if (this.type.Equals(constTypeC))
  6898. pointDrawCount = 5;
  6899. else if (this.type.Equals(constTypeD))
  6900. pointDrawCount = 6;
  6901. else if (this.type.Equals(constTypeE))
  6902. pointDrawCount = 4;
  6903. }
  6904. }
  6905. /// <summary>
  6906. /// 选择样品更改
  6907. /// </summary>
  6908. /// <param name="sender"></param>
  6909. /// <param name="e"></param>
  6910. private void dataGridView1_SelectionChanged(object sender, EventArgs e)
  6911. {
  6912. if (this.dataGridView1.SelectedCells.Count > 0)
  6913. {
  6914. int dataTableIndex = 0;
  6915. for (int i = 0; i < this.pointDataTables.Count; i++)
  6916. {
  6917. if (this.pointDataTables[i].TableName.Equals(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value))
  6918. dataTableIndex = i;
  6919. }
  6920. if (this.pointDataTables[dataTableIndex].Rows.Count > 0)
  6921. {
  6922. this.dataGridView2.Rows.Clear();
  6923. this.dataGridView3.Rows.Clear();
  6924. for (int r = 0; r < this.pointDataTables[dataTableIndex].Rows.Count; r++)
  6925. {
  6926. DataGridViewRow dgvr = new DataGridViewRow();
  6927. DataGridViewRow dgvr1 = new DataGridViewRow();
  6928. foreach (DataGridViewColumn Column in this.dataGridView2.Columns)
  6929. {
  6930. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  6931. dgvr1.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  6932. }
  6933. for (int c = 0; c < this.pointDataTables[dataTableIndex].Columns.Count; c++)
  6934. {
  6935. 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()))
  6936. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pointDataTables[dataTableIndex].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  6937. else
  6938. dgvr.Cells[c].Value = this.pointDataTables[dataTableIndex].Rows[r][c].ToString();
  6939. dgvr1.Cells[c].Value = this.pointDataTables[dataTableIndex].Rows[r][c].ToString();
  6940. }
  6941. this.dataGridView2.Rows.Add(dgvr);
  6942. this.dataGridView3.Rows.Add(dgvr1);
  6943. }
  6944. int left;
  6945. int right;
  6946. string leftValue;
  6947. string rightValue;
  6948. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  6949. {
  6950. left = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("%");
  6951. right = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("-");
  6952. leftValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(0, left);
  6953. rightValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(right + 1);
  6954. if (this.dataGridView2.Rows[i].Cells[2].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6955. || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[2].Value.ToString())
  6956. && !this.dataGridView2.Rows[i].Cells[2].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6957. && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[2].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6958. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[2].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))))
  6959. this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red;
  6960. if (this.dataGridView2.Rows[i].Cells[3].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6961. || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[3].Value.ToString())
  6962. && !this.dataGridView2.Rows[i].Cells[3].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6963. && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[3].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6964. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[3].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))))
  6965. this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red;
  6966. if (this.dataGridView2.Rows[i].Cells[4].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6967. || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[4].Value.ToString())
  6968. && !this.dataGridView2.Rows[i].Cells[4].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6969. && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[4].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6970. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[4].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))))
  6971. this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red;
  6972. if (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[7].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6973. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[7].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))
  6974. this.dataGridView2.Rows[i].Cells[7].Style.BackColor = Color.Red;
  6975. if (this.linesNumber == 4)
  6976. {
  6977. if (this.dataGridView2.Rows[i].Cells[5].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6978. || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[5].Value.ToString())
  6979. && !this.dataGridView2.Rows[i].Cells[5].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6980. && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[5].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6981. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[5].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))))
  6982. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red;
  6983. }
  6984. else if (this.linesNumber == 5)
  6985. {
  6986. if (this.dataGridView2.Rows[i].Cells[5].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6987. || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[5].Value.ToString())
  6988. && !this.dataGridView2.Rows[i].Cells[5].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6989. && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[5].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6990. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[5].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))))
  6991. this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red;
  6992. if (this.dataGridView2.Rows[i].Cells[6].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6993. || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[6].Value.ToString())
  6994. && !this.dataGridView2.Rows[i].Cells[6].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))
  6995. && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[6].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue))
  6996. || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[6].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue)))))
  6997. this.dataGridView2.Rows[i].Cells[6].Style.BackColor = Color.Red;
  6998. }
  6999. }
  7000. }
  7001. this.documentWorkspace.Refresh();
  7002. }
  7003. }
  7004. /// <summary>
  7005. /// 显示测量点间距
  7006. /// </summary>
  7007. /// <param name="sender"></param>
  7008. /// <param name="e"></param>
  7009. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  7010. {
  7011. this.documentWorkspace.Refresh();
  7012. }
  7013. private void dataGridView3_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  7014. {
  7015. int dataTableIndex = 0;
  7016. if (this.dataGridView3.Rows.Count > 0)
  7017. {
  7018. for (int i = 0; i < this.pointDataTables.Count; i++)
  7019. {
  7020. if (this.pointDataTables[i].TableName.Equals(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value))
  7021. dataTableIndex = i;
  7022. }
  7023. this.pointDataTables[dataTableIndex].Rows.Clear();
  7024. for (int r = 0; r < this.dataGridView3.Rows.Count; r++)
  7025. {
  7026. DataRow dataRow = this.pointDataTables[dataTableIndex].NewRow();
  7027. for (int c = 0; c < this.dataGridView3.Rows[r].Cells.Count; c++)
  7028. {
  7029. dataRow[this.dataGridView3.Columns[c].Name] = this.dataGridView3.Rows[r].Cells[c].Value;
  7030. }
  7031. this.pointDataTables[dataTableIndex].Rows.Add(dataRow);
  7032. }
  7033. }
  7034. }
  7035. /// <summary>
  7036. /// 单元格修改验证
  7037. /// </summary>
  7038. /// <param name="sender"></param>
  7039. /// <param name="e"></param>
  7040. private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
  7041. {
  7042. if(e.RowIndex >= 0)
  7043. {
  7044. string newValue = this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
  7045. for (int i = 0; i < dataGridView1.Rows.Count; i++)
  7046. {
  7047. if (i != e.RowIndex && newValue.Equals(this.dataGridView1.Rows[i].Cells[0].Value.ToString()))
  7048. {
  7049. MessageBox.Show(PdnResources.GetString("Menu.Namealreadyexists.text")+"!");
  7050. this.dataGridView1.Rows[e.RowIndex].Cells[0].Value = oldValue;
  7051. return;
  7052. }
  7053. }
  7054. foreach (DataTable item in this.pointDataTables)
  7055. {
  7056. if (item.TableName.Equals(oldValue))
  7057. item.TableName = newValue;
  7058. }
  7059. this.saveSuccess = true;
  7060. }
  7061. }
  7062. /// <summary>
  7063. /// 获取单元格修改之前的值
  7064. /// </summary>
  7065. /// <param name="sender"></param>
  7066. /// <param name="e"></param>
  7067. private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
  7068. {
  7069. oldValue = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
  7070. }
  7071. /// <summary>
  7072. /// 保存结果
  7073. /// </summary>
  7074. /// <param name="sender"></param>
  7075. /// <param name="e"></param>
  7076. private void button2_Click(object sender, EventArgs e)
  7077. {
  7078. SaveMeasurementResults();
  7079. }
  7080. /// <summary>
  7081. /// 保存结果
  7082. /// </summary>
  7083. private void SaveMeasurementResults()
  7084. {
  7085. if (this.listView1.SelectedItems.Count > 0)
  7086. {
  7087. string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
  7088. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
  7089. if (this.button3.Visible)
  7090. {
  7091. MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!");
  7092. return;
  7093. }
  7094. if (this.pointDataTables.Count > 0)
  7095. {
  7096. DataTable dataTable1 = new DataTable();
  7097. bool replace = false;
  7098. int add = 0;
  7099. foreach (ListViewItem item in this.listView2.Items)
  7100. {
  7101. if (item.Name.Equals(tag))
  7102. {
  7103. add++;
  7104. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Themeasurementdertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  7105. if (dr == DialogResult.OK)
  7106. {
  7107. replace = true;
  7108. this.listView2.Items.Remove(item);
  7109. }
  7110. break;
  7111. }
  7112. }
  7113. if (replace || this.listView2.Items.Count == 0 || add == 0)
  7114. {
  7115. this.dataGridView4.Rows.Clear();
  7116. if (this.linesNumber == 3)
  7117. {
  7118. this.dataGridView4.Columns[7].Visible = false;
  7119. this.dataGridView4.Columns[8].Visible = false;
  7120. }
  7121. else if (this.linesNumber == 4)
  7122. {
  7123. this.dataGridView4.Columns[7].Visible = true;
  7124. this.dataGridView4.Columns[8].Visible = false;
  7125. }
  7126. else if (this.linesNumber == 5)
  7127. {
  7128. this.dataGridView4.Columns[7].Visible = true;
  7129. this.dataGridView4.Columns[8].Visible = true;
  7130. }
  7131. ListViewItem listViewItem = new ListViewItem();
  7132. listViewItem.Name = tag;
  7133. listViewItem.SubItems[0].Text = imgName;
  7134. listViewItem.Tag = "" + this.linesNumber;
  7135. if (this.listView2.Items.Count == 0)
  7136. this.listView2.Items.Add(listViewItem);
  7137. else
  7138. this.listView2.Items.Insert(0, listViewItem);
  7139. dataTable1.TableName = tag;
  7140. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  7141. {
  7142. dataTable1.Columns.Add(c.HeaderText);
  7143. }
  7144. foreach (DataTable dataTable in this.pointDataTables)
  7145. {
  7146. for (int r = 0; r < dataTable.Rows.Count; r++)
  7147. {
  7148. DataGridViewRow dgvr = new DataGridViewRow();
  7149. dgvr.Tag = tag;
  7150. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7151. {
  7152. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7153. }
  7154. for (int c = 0; c < dataTable.Columns.Count; c++)
  7155. {
  7156. dgvr.Cells[0].Value = imgName;
  7157. dgvr.Cells[1].Value = dataTable.TableName;
  7158. if (c > 1 && !dataTable.Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")))
  7159. {
  7160. if (this.linesNumber == 3)
  7161. {
  7162. if (c + 2 != 7 && c + 2 != 8)
  7163. dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7164. else
  7165. dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString();
  7166. }
  7167. else if (this.linesNumber == 4)
  7168. {
  7169. if (c + 2 != 8)
  7170. dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7171. else
  7172. dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString();
  7173. }
  7174. else if (this.linesNumber == 5)
  7175. {
  7176. dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7177. }
  7178. }
  7179. else
  7180. dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString();
  7181. }
  7182. this.dataGridView4.Rows.Add(dgvr);
  7183. DataRow dataRow = dataTable1.NewRow();
  7184. for (int c = 0; c < dataTable.Columns.Count + 2; c++)
  7185. {
  7186. if (c == 0)
  7187. dataRow[this.dataGridView4.Columns[c].HeaderText] = imgName;
  7188. else if (c == 1)
  7189. dataRow[this.dataGridView4.Columns[c].HeaderText] = dataTable.TableName;
  7190. else
  7191. dataRow[this.dataGridView4.Columns[c].HeaderText] = dataTable.Rows[r][c - 2].ToString();
  7192. }
  7193. dataTable1.Rows.Add(dataRow);
  7194. }
  7195. }
  7196. foreach (DataTable dataTable2 in pictureDataTables)
  7197. {
  7198. if (dataTable2.TableName.Equals(dataTable1.TableName))
  7199. {
  7200. pictureDataTables.Remove(dataTable2);
  7201. break;
  7202. }
  7203. }
  7204. this.pictureDataTables.Add(dataTable1);
  7205. if (this.allShow)
  7206. AllShow();
  7207. this.listView2.Items[0].Selected = true;
  7208. this.saveSuccess = false;
  7209. this.bitDic.Clear();
  7210. foreach (var item in this.bitDic1)
  7211. {
  7212. this.bitDic.Add(item.Key, item.Value);
  7213. }
  7214. //拼接中间数据
  7215. List<List<string>> dataList = new List<List<string>>();
  7216. List<string> columnName = new List<string>();
  7217. columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
  7218. columnName.Add(PdnResources.GetString("Menu.Thesamplename.Text"));
  7219. columnName.Add(PdnResources.GetString("Menu.Theintersectionsofthefirstline.Text"));
  7220. columnName.Add(PdnResources.GetString("Menu.Theintersectionsofthesecondtline.Text"));
  7221. columnName.Add(PdnResources.GetString("Menu.Theintersectionsofthethirdtline.Text"));
  7222. if (this.linesNumber == 4)
  7223. {
  7224. columnName.Add(PdnResources.GetString("Menu.Theintersectionsoftheforthtline.Text"));
  7225. }
  7226. else if (this.linesNumber == 5)
  7227. {
  7228. columnName.Add(PdnResources.GetString("Menu.Theintersectionsoftheforthtline.Text"));
  7229. columnName.Add(PdnResources.GetString("Menu.Theintersectionsofthefivthtline.Text"));
  7230. }
  7231. dataList.Add(columnName);
  7232. string valuesL1 = string.Empty;
  7233. string valuesL2 = string.Empty;
  7234. string valuesL3 = string.Empty;
  7235. string valuesL4 = string.Empty;
  7236. string valuesL5 = string.Empty;
  7237. int valueCt1 = 0;
  7238. int valueCt2 = 0;
  7239. int valueCt3 = 0;
  7240. int valueCt4 = 0;
  7241. int valueCt5 = 0;
  7242. if (this.linesNumber == 3)
  7243. {
  7244. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  7245. {
  7246. valuesL1 = string.Empty;
  7247. valuesL2 = string.Empty;
  7248. valuesL3 = string.Empty;
  7249. List<string> strList = new List<string>();
  7250. strList.Add((i + 1).ToString());
  7251. strList.Add(this.dataGridView1.Rows[i].Cells[0].Value.ToString());
  7252. foreach (var lengthList in this.lengthL1[i])
  7253. {
  7254. if (this.lengthL1[i].Count == 1 || valueCt1 == this.lengthL1[i].Count - 1)
  7255. valuesL1 += lengthList.ToString();
  7256. else
  7257. valuesL1 += lengthList.ToString() + ",";
  7258. valueCt1++;
  7259. }
  7260. foreach (var lengthList in this.lengthL2[i])
  7261. {
  7262. if (this.lengthL2[i].Count == 1 || valueCt2 == this.lengthL2[i].Count - 1)
  7263. valuesL2 += lengthList.ToString();
  7264. else
  7265. valuesL2 += lengthList.ToString() + ",";
  7266. valueCt2++;
  7267. }
  7268. foreach (var lengthList in this.lengthL3[i])
  7269. {
  7270. if (this.lengthL3[i].Count == 1 || valueCt3 == this.lengthL3[i].Count - 1)
  7271. valuesL3 += lengthList.ToString();
  7272. else
  7273. valuesL3 += lengthList.ToString() + ",";
  7274. valueCt3++;
  7275. }
  7276. strList.Add(valuesL1);
  7277. strList.Add(valuesL2);
  7278. strList.Add(valuesL3);
  7279. dataList.Add(strList);
  7280. }
  7281. }
  7282. else if (this.linesNumber == 4)
  7283. {
  7284. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  7285. {
  7286. valuesL1 = string.Empty;
  7287. valuesL2 = string.Empty;
  7288. valuesL3 = string.Empty;
  7289. valuesL4 = string.Empty;
  7290. List<string> strList = new List<string>();
  7291. strList.Add((i + 1).ToString());
  7292. strList.Add(this.dataGridView1.Rows[i].Cells[0].Value.ToString());
  7293. foreach (var lengthList in this.lengthL1[i])
  7294. {
  7295. if (this.lengthL1[i].Count == 1 || valueCt1 == this.lengthL1[i].Count - 1)
  7296. valuesL1 += lengthList.ToString();
  7297. else
  7298. valuesL1 += lengthList.ToString() + ",";
  7299. valueCt1++;
  7300. }
  7301. foreach (var lengthList in this.lengthL2[i])
  7302. {
  7303. if (this.lengthL2[i].Count == 1 || valueCt2 == this.lengthL2[i].Count - 1)
  7304. valuesL2 += lengthList.ToString();
  7305. else
  7306. valuesL2 += lengthList.ToString() + ",";
  7307. valueCt2++;
  7308. }
  7309. foreach (var lengthList in this.lengthL3[i])
  7310. {
  7311. if (this.lengthL3[i].Count == 1 || valueCt3 == this.lengthL3[i].Count - 1)
  7312. valuesL3 += lengthList.ToString();
  7313. else
  7314. valuesL3 += lengthList.ToString() + ",";
  7315. valueCt3++;
  7316. }
  7317. foreach (var lengthList in this.lengthL4[i])
  7318. {
  7319. if (this.lengthL4[i].Count == 1 || valueCt4 == this.lengthL4[i].Count - 1)
  7320. valuesL4 += lengthList.ToString();
  7321. else
  7322. valuesL4 += lengthList.ToString() + ",";
  7323. valueCt4++;
  7324. }
  7325. strList.Add(valuesL1);
  7326. strList.Add(valuesL2);
  7327. strList.Add(valuesL3);
  7328. strList.Add(valuesL4);
  7329. dataList.Add(strList);
  7330. }
  7331. }
  7332. else if(this.linesNumber == 5)
  7333. {
  7334. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  7335. {
  7336. valuesL1 = string.Empty;
  7337. valuesL2 = string.Empty;
  7338. valuesL3 = string.Empty;
  7339. valuesL4 = string.Empty;
  7340. valuesL5 = string.Empty;
  7341. List<string> strList = new List<string>();
  7342. strList.Add((i + 1).ToString());
  7343. strList.Add(this.dataGridView1.Rows[i].Cells[0].Value.ToString());
  7344. foreach (var lengthList in this.lengthL1[i])
  7345. {
  7346. if (this.lengthL1[i].Count == 1 || valueCt1 == this.lengthL1[i].Count - 1)
  7347. valuesL1 += lengthList.ToString();
  7348. else
  7349. valuesL1 += lengthList.ToString() + ",";
  7350. valueCt1++;
  7351. }
  7352. foreach (var lengthList in this.lengthL2[i])
  7353. {
  7354. if (this.lengthL2[i].Count == 1 || valueCt2 == this.lengthL2[i].Count - 1)
  7355. valuesL2 += lengthList.ToString();
  7356. else
  7357. valuesL2 += lengthList.ToString() + ",";
  7358. valueCt2++;
  7359. }
  7360. foreach (var lengthList in this.lengthL3[i])
  7361. {
  7362. if (this.lengthL3[i].Count == 1 || valueCt3 == this.lengthL3[i].Count - 1)
  7363. valuesL3 += lengthList.ToString();
  7364. else
  7365. valuesL3 += lengthList.ToString() + ",";
  7366. valueCt3++;
  7367. }
  7368. foreach (var lengthList in this.lengthL4[i])
  7369. {
  7370. if (this.lengthL4[i].Count == 1 || valueCt4 == this.lengthL4[i].Count - 1)
  7371. valuesL4 += lengthList.ToString();
  7372. else
  7373. valuesL4 += lengthList.ToString() + ",";
  7374. valueCt4++;
  7375. }
  7376. foreach (var lengthList in this.lengthL5[i])
  7377. {
  7378. if (this.lengthL5[i].Count == 1 || valueCt5 == this.lengthL5[i].Count - 1)
  7379. valuesL5 += lengthList.ToString();
  7380. else
  7381. valuesL5 += lengthList.ToString() + ",";
  7382. valueCt5++;
  7383. }
  7384. strList.Add(valuesL1);
  7385. strList.Add(valuesL2);
  7386. strList.Add(valuesL3);
  7387. strList.Add(valuesL4);
  7388. strList.Add(valuesL5);
  7389. dataList.Add(strList);
  7390. }
  7391. }
  7392. bool isExist = false;//是否已存在进行替换
  7393. int modelIndex = -1;//要替换的下标
  7394. for (int j = 0; j < tempDataModel.Count; j++)
  7395. {
  7396. if (tempDataModel[j].tagName.Equals(tag))
  7397. {
  7398. isExist = true;
  7399. modelIndex = j;
  7400. break;
  7401. }
  7402. }
  7403. if (isExist && modelIndex > -1)
  7404. tempDataModel[modelIndex].dataList = dataList;
  7405. else
  7406. {
  7407. ExportProjectModel newModel = new ExportProjectModel();
  7408. newModel.tagName = tag;
  7409. newModel.picName = imgName;
  7410. newModel.dataList = dataList;
  7411. tempDataModel.Add(newModel);
  7412. }
  7413. }
  7414. }
  7415. else
  7416. {
  7417. MessageBox.Show(PdnResources.GetString("Menu.Pleaseaddsamples.text")+"!");
  7418. }
  7419. }
  7420. else
  7421. {
  7422. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapictureandmeasure.text")+"!");
  7423. }
  7424. }
  7425. /// <summary>
  7426. /// 切换测量记录
  7427. /// </summary>
  7428. /// <param name="sender"></param>
  7429. /// <param name="e"></param>
  7430. private void listView_SelectedIndexChanged(object sender, EventArgs e)
  7431. {
  7432. if(!this.allShow)
  7433. {
  7434. if (this.listView2.SelectedItems.Count > 0)
  7435. {
  7436. if(this.listView2.SelectedItems[0].Tag.ToString().Equals("3"))
  7437. {
  7438. this.dataGridView4.Columns[7].Visible = false;
  7439. this.dataGridView4.Columns[8].Visible = false;
  7440. }
  7441. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("4"))
  7442. {
  7443. this.dataGridView4.Columns[7].Visible = true;
  7444. this.dataGridView4.Columns[8].Visible = false;
  7445. }
  7446. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("5"))
  7447. {
  7448. this.dataGridView4.Columns[7].Visible = true;
  7449. this.dataGridView4.Columns[8].Visible = true;
  7450. }
  7451. List<int> dataTableIndex = new List<int>();
  7452. for (int i = 0; i < this.pictureDataTables.Count; i++)
  7453. {
  7454. foreach (ListViewItem item in this.listView2.SelectedItems)
  7455. {
  7456. if (this.pictureDataTables[i].TableName.Equals(item.Name))
  7457. dataTableIndex .Add(i);
  7458. }
  7459. }
  7460. this.dataGridView4.Rows.Clear();
  7461. foreach (var item in dataTableIndex)
  7462. {
  7463. if (this.pictureDataTables[item].Rows.Count > 0)
  7464. {
  7465. for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
  7466. {
  7467. DataGridViewRow dgvr = new DataGridViewRow();
  7468. dgvr.Tag = this.pictureDataTables[item].TableName;
  7469. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7470. {
  7471. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7472. }
  7473. for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
  7474. {
  7475. 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()))
  7476. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c])
  7477. , Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7478. else
  7479. dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
  7480. }
  7481. this.dataGridView4.Rows.Add(dgvr);
  7482. }
  7483. }
  7484. }
  7485. }
  7486. }
  7487. else
  7488. {
  7489. this.dataGridView4.Columns[7].Visible = true;
  7490. this.dataGridView4.Columns[8].Visible = true;
  7491. }
  7492. }
  7493. /// <summary>
  7494. /// 全部显示
  7495. /// </summary>
  7496. /// <param name="sender"></param>
  7497. /// <param name="e"></param>
  7498. private void button11_Click(object sender, EventArgs e)
  7499. {
  7500. this.allShow = true;
  7501. this.button11.Visible = false;
  7502. this.button16.Visible = true;
  7503. AllShow();
  7504. }
  7505. private void AllShow()
  7506. {
  7507. this.dataGridView4.Rows.Clear();
  7508. DataTable dataTable = new DataTable();
  7509. foreach (DataTable item in this.pictureDataTables)
  7510. {
  7511. if (item.Columns.Count == 8)
  7512. {
  7513. this.dataGridView4.Columns[7].Visible = false;
  7514. this.dataGridView4.Columns[8].Visible = false;
  7515. }
  7516. if (item.Columns.Count == 9)
  7517. {
  7518. this.dataGridView4.Columns[7].Visible = true;
  7519. this.dataGridView4.Columns[8].Visible = false;
  7520. }
  7521. if (item.Columns.Count == 10)
  7522. {
  7523. this.dataGridView4.Columns[7].Visible = true;
  7524. this.dataGridView4.Columns[8].Visible = true;
  7525. }
  7526. }
  7527. for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
  7528. {
  7529. dataTable = this.pictureDataTables[i];
  7530. for (int r = 0; r < dataTable.Rows.Count; r++)
  7531. {
  7532. DataGridViewRow dgvr = new DataGridViewRow();
  7533. dgvr.Tag = dataTable.TableName;
  7534. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7535. {
  7536. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7537. }
  7538. for (int c = 0; c < dataTable.Columns.Count; c++)
  7539. {
  7540. if (c > 3 && !dataTable.Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(dataTable.Rows[r][c].ToString()))
  7541. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c])
  7542. , Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7543. else
  7544. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  7545. }
  7546. this.dataGridView4.Rows.Add(dgvr);
  7547. }
  7548. }
  7549. }
  7550. /// <summary>
  7551. /// 取消全部显示
  7552. /// </summary>
  7553. /// <param name="sender"></param>
  7554. /// <param name="e"></param>
  7555. private void button16_Click(object sender, EventArgs e)
  7556. {
  7557. this.allShow = false;
  7558. this.button11.Visible = true;
  7559. this.button16.Visible = false;
  7560. if (this.listView2.SelectedItems.Count > 0)
  7561. {
  7562. if (this.listView2.SelectedItems[0].Tag.ToString().Equals("3"))
  7563. {
  7564. this.dataGridView4.Columns[7].Visible = false;
  7565. this.dataGridView4.Columns[8].Visible = false;
  7566. }
  7567. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("4"))
  7568. {
  7569. this.dataGridView4.Columns[7].Visible = true;
  7570. this.dataGridView4.Columns[8].Visible = false;
  7571. }
  7572. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("5"))
  7573. {
  7574. this.dataGridView4.Columns[7].Visible = true;
  7575. this.dataGridView4.Columns[8].Visible = true;
  7576. }
  7577. List<int> dataTableIndex = new List<int>();
  7578. for (int i = 0; i < this.pictureDataTables.Count; i++)
  7579. {
  7580. foreach (ListViewItem item in this.listView2.SelectedItems)
  7581. {
  7582. if (this.pictureDataTables[i].TableName.Equals(item.Name))
  7583. dataTableIndex.Add(i);
  7584. }
  7585. }
  7586. this.dataGridView4.Rows.Clear();
  7587. foreach (var item in dataTableIndex)
  7588. {
  7589. if (this.pictureDataTables[item].Rows.Count > 0)
  7590. {
  7591. for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
  7592. {
  7593. DataGridViewRow dgvr = new DataGridViewRow();
  7594. dgvr.Tag = this.pictureDataTables[item].TableName;
  7595. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7596. {
  7597. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7598. }
  7599. for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
  7600. {
  7601. 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()))
  7602. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c])
  7603. , Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7604. else
  7605. dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
  7606. }
  7607. this.dataGridView4.Rows.Add(dgvr);
  7608. }
  7609. }
  7610. }
  7611. }
  7612. else
  7613. {
  7614. if (this.listView2.Items.Count >0 )
  7615. {
  7616. this.listView2.Items[0].Selected = true;
  7617. }
  7618. if (this.pictureDataTables.Count > 0
  7619. && this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count > 0)
  7620. {
  7621. this.dataGridView4.Rows.Clear();
  7622. for (int r = 0; r < this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count; r++)
  7623. {
  7624. DataGridViewRow dgvr = new DataGridViewRow();
  7625. dgvr.Tag = this.pictureDataTables[this.pictureDataTables.Count - 1].TableName;
  7626. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7627. {
  7628. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7629. }
  7630. for (int c = 0; c < this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count; c++)
  7631. {
  7632. 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()))
  7633. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c])
  7634. , Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7635. else
  7636. dgvr.Cells[c].Value = this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c].ToString();
  7637. }
  7638. this.dataGridView4.Rows.Add(dgvr);
  7639. }
  7640. }
  7641. }
  7642. }
  7643. /// <summary>
  7644. /// 导出结果Excel
  7645. /// </summary>
  7646. /// <param name="sender"></param>
  7647. /// <param name="e"></param>
  7648. private void button14_Click(object sender, EventArgs e)
  7649. {
  7650. if(this.listView2.Items.Count > 0)
  7651. {
  7652. SaveFileDialog exe = new SaveFileDialog();
  7653. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  7654. exe.FilterIndex = 0;
  7655. exe.RestoreDirectory = true;
  7656. exe.Title = "Export Excel File";
  7657. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  7658. exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + PdnResources.GetString("Menu.DedicatedAnalysis.NonferrousMetal.RecombinationRate.Text")+ PdnResources.GetString("Menu.Analysisresult.text");
  7659. DialogResult dr = exe.ShowDialog();
  7660. if (dr == DialogResult.OK)
  7661. {
  7662. DataTable dtb = new DataTable();
  7663. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  7664. {
  7665. dtb.Columns.Add(c.HeaderText);
  7666. }
  7667. for (int r = 0; r < this.dataGridView4.Rows.Count; r++)
  7668. {
  7669. DataRow dataRow = dtb.NewRow();
  7670. for (int c = 0; c < this.dataGridView4.Rows[r].Cells.Count; c++)
  7671. {
  7672. dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView4.Rows[r].Cells[c].Value;
  7673. }
  7674. dtb.Rows.Add(dataRow);
  7675. }
  7676. List<DataTable> list = new List<DataTable>();
  7677. list.Add(dtb);
  7678. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
  7679. }
  7680. }
  7681. else
  7682. {
  7683. MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
  7684. }
  7685. }
  7686. /// <summary>
  7687. /// 小数
  7688. /// </summary>
  7689. /// <param name="sender"></param>
  7690. /// <param name="e"></param>
  7691. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  7692. {
  7693. this.decimalCls = (int)this.numericUpDown1.Value;
  7694. this.documentWorkspace.Refresh();
  7695. RefreshDataGridView4();
  7696. }
  7697. /// <summary>
  7698. /// 分析结果删除
  7699. /// </summary>
  7700. /// <param name="sender"></param>
  7701. /// <param name="e"></param>
  7702. private void button12_Click(object sender, EventArgs e)
  7703. {
  7704. if(this.listView2.Items.Count > 0)
  7705. {
  7706. if (this.listView2.SelectedItems.Count > 0)
  7707. {
  7708. if (this.listView2.SelectedItems[0].Tag.ToString().Equals("3"))
  7709. {
  7710. this.dataGridView4.Columns[7].Visible = false;
  7711. this.dataGridView4.Columns[8].Visible = false;
  7712. }
  7713. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("4"))
  7714. {
  7715. this.dataGridView4.Columns[7].Visible = true;
  7716. this.dataGridView4.Columns[8].Visible = false;
  7717. }
  7718. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("5"))
  7719. {
  7720. this.dataGridView4.Columns[7].Visible = true;
  7721. this.dataGridView4.Columns[8].Visible = true;
  7722. }
  7723. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethisanalysisresult.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  7724. if (dr == DialogResult.OK)
  7725. {
  7726. List<string> detaleName = new List<string>();
  7727. int selectIndex = this.listView2.SelectedItems[0].Index;
  7728. foreach (ListViewItem item in this.listView2.SelectedItems)
  7729. {
  7730. detaleName.Add(item.Name.ToString());
  7731. this.listView2.Items.Remove(item);
  7732. }
  7733. foreach (string item in detaleName)
  7734. {
  7735. foreach (DataTable dataTable in this.pictureDataTables)
  7736. {
  7737. if (dataTable.TableName.Equals(item))
  7738. {
  7739. this.pictureDataTables.Remove(dataTable);
  7740. break;
  7741. }
  7742. }
  7743. }
  7744. foreach (string tag in detaleName)
  7745. {
  7746. for (int i = 0; i < bitDic.Count; i++)
  7747. {
  7748. foreach (var item in bitDic)
  7749. {
  7750. string keyDe = item.Key.Substring(0, item.Key.IndexOf("|"));
  7751. if (tag.Equals(keyDe))
  7752. {
  7753. bitDic.Remove(item.Key);
  7754. break;
  7755. }
  7756. }
  7757. }
  7758. foreach (ExportProjectModel model in this.tempDataModel)
  7759. {
  7760. if (model.tagName.Equals(tag))
  7761. {
  7762. this.tempDataModel.Remove(model);
  7763. break;
  7764. }
  7765. }
  7766. }
  7767. if (this.listView2.Items.Count > 0)
  7768. {
  7769. if(selectIndex == 0)
  7770. this.listView2.Items[0].Selected = true;
  7771. else
  7772. this.listView2.Items[selectIndex - 1].Selected = true;
  7773. RefreshDataGridView4();
  7774. }
  7775. else
  7776. {
  7777. this.dataGridView4.Rows.Clear();
  7778. }
  7779. }
  7780. }
  7781. else
  7782. {
  7783. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheanalysisresulttodelete.text")+"!");
  7784. }
  7785. }
  7786. else
  7787. {
  7788. MessageBox.Show(PdnResources.GetString("Menu.Nodataintheanalysisresults.text")+"!");
  7789. }
  7790. }
  7791. /// <summary>
  7792. /// 刷新分析结果数据
  7793. /// </summary>
  7794. private void RefreshDataGridView4()
  7795. {
  7796. if (!this.allShow)
  7797. {
  7798. if (this.listView2.SelectedItems.Count > 0)
  7799. {
  7800. if (this.listView2.SelectedItems[0].Tag.ToString().Equals("3"))
  7801. {
  7802. this.dataGridView4.Columns[7].Visible = false;
  7803. this.dataGridView4.Columns[8].Visible = false;
  7804. }
  7805. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("4"))
  7806. {
  7807. this.dataGridView4.Columns[7].Visible = true;
  7808. this.dataGridView4.Columns[8].Visible = false;
  7809. }
  7810. else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("5"))
  7811. {
  7812. this.dataGridView4.Columns[7].Visible = true;
  7813. this.dataGridView4.Columns[8].Visible = true;
  7814. }
  7815. List<int> dataTableIndex = new List<int>();
  7816. for (int i = 0; i < this.pictureDataTables.Count; i++)
  7817. {
  7818. foreach (ListViewItem item in this.listView2.SelectedItems)
  7819. {
  7820. if (this.pictureDataTables[i].TableName.Equals(item.Name))
  7821. dataTableIndex.Add(i);
  7822. }
  7823. }
  7824. this.dataGridView4.Rows.Clear();
  7825. foreach (var item in dataTableIndex)
  7826. {
  7827. if (this.pictureDataTables[item].Rows.Count > 0)
  7828. {
  7829. for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
  7830. {
  7831. DataGridViewRow dgvr = new DataGridViewRow();
  7832. dgvr.Tag = this.pictureDataTables[item].TableName;
  7833. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7834. {
  7835. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7836. }
  7837. for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
  7838. {
  7839. 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()))
  7840. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c])
  7841. , Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7842. else
  7843. dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
  7844. }
  7845. this.dataGridView4.Rows.Add(dgvr);
  7846. }
  7847. }
  7848. }
  7849. }
  7850. }
  7851. else
  7852. {
  7853. this.dataGridView4.Rows.Clear();
  7854. DataTable dataTable = new DataTable();
  7855. for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
  7856. {
  7857. dataTable = this.pictureDataTables[i];
  7858. for (int r = 0; r < dataTable.Rows.Count; r++)
  7859. {
  7860. DataGridViewRow dgvr = new DataGridViewRow();
  7861. dgvr.Tag = dataTable.TableName;
  7862. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  7863. {
  7864. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  7865. }
  7866. for (int c = 0; c < dataTable.Columns.Count; c++)
  7867. {
  7868. if (c > 3 && !dataTable.Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(dataTable.Rows[r][c].ToString()))
  7869. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c])
  7870. , Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  7871. else
  7872. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  7873. }
  7874. this.dataGridView4.Rows.Add(dgvr);
  7875. }
  7876. }
  7877. }
  7878. }
  7879. /// <summary>
  7880. /// 生成报告
  7881. /// </summary>
  7882. /// <param name="sender"></param>
  7883. /// <param name="e"></param>
  7884. private void button13_Click(object sender, EventArgs e)
  7885. {
  7886. if (this.checkBox2.Checked)
  7887. {
  7888. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.RecombinationRate");
  7889. if (recombinationRateSetDialog.hasModule)
  7890. {
  7891. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  7892. recombinationRateSetDialog.ShowDialog();
  7893. }
  7894. else
  7895. {
  7896. recombinationRateSetDialog = null;
  7897. }
  7898. }
  7899. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  7900. {
  7901. //获取word书签与excel单元格的关系,以字典方式存储
  7902. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  7903. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  7904. if (mic_module_infos != null && mic_module_infos.Count > 0)
  7905. {
  7906. foreach (mic_module_infos info in mic_module_infos)
  7907. {
  7908. tagInfos.Add(info.tag_name, info.cell_position);
  7909. }
  7910. }
  7911. List<List<string>> analysisContent = new List<List<string>>();
  7912. if (this.linesNumber == 3)
  7913. {
  7914. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  7915. {
  7916. List<string> content1 = new List<string>();
  7917. if(i == 0)
  7918. {
  7919. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  7920. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  7921. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  7922. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  7923. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  7924. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  7925. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  7926. content1.Add(this.dataGridView4.Columns[9].HeaderText);
  7927. analysisContent.Add(content1);
  7928. }
  7929. content1 = new List<string>();
  7930. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  7931. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  7932. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  7933. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  7934. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  7935. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  7936. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  7937. content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
  7938. analysisContent.Add(content1);
  7939. }
  7940. }
  7941. else if (this.linesNumber == 4)
  7942. {
  7943. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  7944. {
  7945. List<string> content1 = new List<string>();
  7946. if (i == 0)
  7947. {
  7948. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  7949. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  7950. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  7951. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  7952. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  7953. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  7954. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  7955. content1.Add(this.dataGridView4.Columns[7].HeaderText);
  7956. content1.Add(this.dataGridView4.Columns[9].HeaderText);
  7957. analysisContent.Add(content1);
  7958. }
  7959. content1 = new List<string>();
  7960. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  7961. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  7962. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  7963. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  7964. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  7965. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  7966. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  7967. content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString());
  7968. content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
  7969. analysisContent.Add(content1);
  7970. }
  7971. }
  7972. else if (this.linesNumber == 5)
  7973. {
  7974. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  7975. {
  7976. List<string> content1 = new List<string>();
  7977. if (i == 0)
  7978. {
  7979. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  7980. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  7981. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  7982. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  7983. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  7984. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  7985. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  7986. content1.Add(this.dataGridView4.Columns[7].HeaderText);
  7987. content1.Add(this.dataGridView4.Columns[8].HeaderText);
  7988. content1.Add(this.dataGridView4.Columns[9].HeaderText);
  7989. analysisContent.Add(content1);
  7990. }
  7991. content1 = new List<string>();
  7992. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  7993. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  7994. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  7995. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  7996. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  7997. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  7998. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  7999. content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString());
  8000. content1.Add(this.dataGridView4.Rows[i].Cells[8].Value.ToString());
  8001. content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
  8002. analysisContent.Add(content1);
  8003. }
  8004. }
  8005. bitList = new List<Bitmap>();
  8006. if (this.allShow)
  8007. {
  8008. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  8009. {
  8010. bitList.Add(kv.Value[0]);
  8011. bitList.Add(kv.Value[1]);
  8012. }
  8013. }
  8014. else
  8015. {
  8016. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  8017. {
  8018. foreach (DataGridViewRow itemRow in this.dataGridView4.Rows)
  8019. {
  8020. foreach (ListViewItem item in this.listView2.SelectedItems)
  8021. {
  8022. if (bitDic.ContainsKey(item.Name + "|" + itemRow.Cells[1].Value.ToString()) && itemRow.Tag.Equals(item.Name))
  8023. {
  8024. bitList.Add(bitDic[item.Name + "|" + itemRow.Cells[1].Value.ToString()][0]);
  8025. bitList.Add(bitDic[item.Name + "|" + itemRow.Cells[1].Value.ToString()][1]);
  8026. }
  8027. }
  8028. }
  8029. }
  8030. }
  8031. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  8032. }
  8033. else
  8034. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  8035. }
  8036. private void listView2_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
  8037. {
  8038. if(!this.allShow)
  8039. {
  8040. if (this.listView2.SelectedItems.Count == 0)
  8041. this.dataGridView4.Rows.Clear();
  8042. }
  8043. }
  8044. /// <summary>
  8045. /// 不可点击空白区域
  8046. /// </summary>
  8047. /// <param name="sender"></param>
  8048. /// <param name="e"></param>
  8049. private void listView1_MouseUp(object sender, MouseEventArgs e)
  8050. {
  8051. if (e.Button == MouseButtons.Left)
  8052. {
  8053. if (listView1.SelectedItems.Count > 0)
  8054. {
  8055. }
  8056. else if (listView1.SelectedItems.Count <= 0)//点击空白区
  8057. {
  8058. if (this.listView1.FocusedItem != null)
  8059. {
  8060. ListViewItem item = this.listView1.GetItemAt(e.X, e.Y);
  8061. if (item == null)
  8062. {
  8063. this.listView1.FocusedItem.Selected = true;
  8064. }
  8065. }
  8066. }
  8067. }
  8068. }
  8069. /// <summary>
  8070. /// 导出项目
  8071. /// </summary>
  8072. /// <param name="sender"></param>
  8073. /// <param name="e"></param>
  8074. private void button17_Click(object sender, EventArgs e)
  8075. {
  8076. try
  8077. {
  8078. if (this.analyzeSettingModel == null)
  8079. {
  8080. MessageBox.Show(PdnResources.GetString("Menu.Settheexporteitemfirst.Text"));
  8081. return;
  8082. }
  8083. //获取项目工程内的文件夹路径
  8084. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.NonferrousMetal.RecombinationRate.Text", this.analyzeSettingModel.savePath);
  8085. if (item != null)
  8086. {
  8087. //向文件夹内保存图片和报告
  8088. if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  8089. {
  8090. //获取word书签与excel单元格的关系,以字典方式存储
  8091. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  8092. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  8093. if (mic_module_infos != null && mic_module_infos.Count > 0)
  8094. {
  8095. foreach (mic_module_infos info in mic_module_infos)
  8096. {
  8097. tagInfos.Add(info.tag_name, info.cell_position);
  8098. }
  8099. }
  8100. //分析结果
  8101. List<List<string>> analysisContent = new List<List<string>>();
  8102. if (this.linesNumber == 3)
  8103. {
  8104. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  8105. {
  8106. List<string> content1 = new List<string>();
  8107. if (i == 0)
  8108. {
  8109. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  8110. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  8111. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  8112. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  8113. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  8114. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  8115. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  8116. content1.Add(this.dataGridView4.Columns[9].HeaderText);
  8117. analysisContent.Add(content1);
  8118. }
  8119. content1 = new List<string>();
  8120. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  8121. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  8122. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  8123. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  8124. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  8125. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  8126. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  8127. content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
  8128. analysisContent.Add(content1);
  8129. }
  8130. }
  8131. else if (this.linesNumber == 4)
  8132. {
  8133. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  8134. {
  8135. List<string> content1 = new List<string>();
  8136. if (i == 0)
  8137. {
  8138. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  8139. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  8140. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  8141. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  8142. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  8143. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  8144. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  8145. content1.Add(this.dataGridView4.Columns[7].HeaderText);
  8146. content1.Add(this.dataGridView4.Columns[9].HeaderText);
  8147. analysisContent.Add(content1);
  8148. }
  8149. content1 = new List<string>();
  8150. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  8151. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  8152. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  8153. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  8154. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  8155. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  8156. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  8157. content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString());
  8158. content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
  8159. analysisContent.Add(content1);
  8160. }
  8161. }
  8162. else if (this.linesNumber == 5)
  8163. {
  8164. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  8165. {
  8166. List<string> content1 = new List<string>();
  8167. if (i == 0)
  8168. {
  8169. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  8170. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  8171. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  8172. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  8173. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  8174. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  8175. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  8176. content1.Add(this.dataGridView4.Columns[7].HeaderText);
  8177. content1.Add(this.dataGridView4.Columns[8].HeaderText);
  8178. content1.Add(this.dataGridView4.Columns[9].HeaderText);
  8179. analysisContent.Add(content1);
  8180. }
  8181. content1 = new List<string>();
  8182. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  8183. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  8184. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  8185. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  8186. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  8187. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  8188. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  8189. content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString());
  8190. content1.Add(this.dataGridView4.Rows[i].Cells[8].Value.ToString());
  8191. content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
  8192. analysisContent.Add(content1);
  8193. }
  8194. }
  8195. //图片
  8196. bitList = new List<Bitmap>();
  8197. if (this.allShow)
  8198. {
  8199. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  8200. {
  8201. bitList.Add(kv.Value[0]);
  8202. bitList.Add(kv.Value[1]);
  8203. }
  8204. }
  8205. else
  8206. {
  8207. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  8208. {
  8209. foreach (DataGridViewRow itemRow in this.dataGridView4.Rows)
  8210. {
  8211. foreach (ListViewItem itemL2 in this.listView2.SelectedItems)
  8212. {
  8213. if (bitDic.ContainsKey(itemL2.Name + "|" + itemRow.Cells[1].Value.ToString()))
  8214. {
  8215. bitList.Add(bitDic[itemL2.Name + "|" + itemRow.Cells[1].Value.ToString()][0]);
  8216. bitList.Add(bitDic[itemL2.Name + "|" + itemRow.Cells[1].Value.ToString()][1]);
  8217. }
  8218. }
  8219. }
  8220. }
  8221. }
  8222. //中间数据
  8223. if (!this.allShow)
  8224. {
  8225. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  8226. {
  8227. List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
  8228. foreach (ListViewItem rowItem in this.listView2.SelectedItems)
  8229. {
  8230. foreach (ExportProjectModel model in this.tempDataModel)
  8231. {
  8232. if (model.tagName.Equals(rowItem.Name))
  8233. {
  8234. ExportProjectModel tempModel = new ExportProjectModel();
  8235. tempModel.tagName = model.tagName;
  8236. tempModel.picName = model.picName;
  8237. tempModel.dataList = model.dataList;
  8238. exportModel.Add(tempModel);
  8239. break;
  8240. }
  8241. }
  8242. }
  8243. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);
  8244. }
  8245. }
  8246. else
  8247. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, item.path, item.code);
  8248. }
  8249. else
  8250. {
  8251. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  8252. return;
  8253. }
  8254. //保存项目信息到数据库
  8255. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  8256. }
  8257. }
  8258. catch (Exception)
  8259. {
  8260. }
  8261. }
  8262. #region 参数保存及提取
  8263. /// <summary>
  8264. /// 保存参数的key,value和type
  8265. /// </summary>
  8266. /// <param name="param_key"></param>
  8267. /// <param name="param_value"></param>
  8268. /// <param name="param_type"></param>
  8269. private void saveParamValue(string param_key, string param_value, int param_type)
  8270. {
  8271. bool foundItem = false;
  8272. foreach (var item in this.analysisModel.ListParam)
  8273. {
  8274. if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
  8275. {
  8276. item.param_value = param_value;
  8277. item.setValue();
  8278. foundItem = true;
  8279. break;
  8280. }
  8281. }
  8282. if (!foundItem)
  8283. {
  8284. GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
  8285. analysisItem.menuId = this.menuId;
  8286. analysisItem.param_key = param_key;
  8287. analysisItem.param_type = param_type;
  8288. analysisItem.param_value = param_value;
  8289. analysisItem.setValue();
  8290. this.analysisModel.ListParam.Add(analysisItem);
  8291. }
  8292. }
  8293. /// <summary>
  8294. /// 保存界面中的参数到model
  8295. /// </summary>
  8296. private void saveDialogParamValues()
  8297. {
  8298. saveParamValue(ParamKey_ShowData, checkBox1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//显示数据
  8299. saveParamValue(ParamKey_Report, checkBox2.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//报告设置
  8300. saveParamValue(ParamKey_DecimalPlace, numericUpDown1 != null ? numericUpDown1.Value.ToString() : "", (int)Base.Dtryt.Decimal);//保留小数位数
  8301. }
  8302. /// <summary>
  8303. /// 获取保存的参数
  8304. /// </summary>
  8305. private void GetListParamModel()
  8306. {
  8307. if (this.analysisModel != null)
  8308. {
  8309. for (int i = 0; i < this.analysisModel.ListParam.Count; i++)
  8310. {
  8311. switch (this.analysisModel.ListParam[i].param_key)
  8312. {
  8313. case ParamKey_ShowData:
  8314. checkBox1.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  8315. break;
  8316. case ParamKey_Report:
  8317. checkBox2.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  8318. break;
  8319. case ParamKey_DecimalPlace:
  8320. numericUpDown1.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
  8321. break;
  8322. }
  8323. }
  8324. }
  8325. }
  8326. /// <summary>
  8327. /// 关闭窗体时保存参数
  8328. /// </summary>
  8329. /// <param name="sender"></param>
  8330. /// <param name="e"></param>
  8331. private void RecombinationRateDialog_FormClosing(object sender, FormClosingEventArgs e)
  8332. {
  8333. #region [开启脚本录制]
  8334. if (appWorkspace.startScriptRecording)
  8335. {
  8336. getScriptRecording();
  8337. }
  8338. #endregion
  8339. this.saveDialogParamValues();
  8340. //xml保存路径
  8341. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  8342. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  8343. foreach (var analysisItem in this.analysisModel.ListParam)
  8344. {
  8345. bool foundItem = false;
  8346. foreach (var item in analysisModelXml.ListParam)
  8347. {
  8348. if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
  8349. {
  8350. item.param_value = analysisItem.param_value;
  8351. foundItem = true;
  8352. break;
  8353. }
  8354. }
  8355. if (!foundItem)
  8356. analysisModelXml.ListParam.Add(analysisItem.cloneModel());
  8357. }
  8358. //按路径和名称保存xml文件
  8359. string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
  8360. //保存xml
  8361. FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
  8362. }
  8363. #endregion
  8364. #region [脚本相关]
  8365. private void getValue(string key, object value)
  8366. {
  8367. switch (key)
  8368. {
  8369. case "parameter1":
  8370. checkBox1.Checked = Convert.ToBoolean(value);
  8371. break;
  8372. case "OpenWhileExportReport":
  8373. checkBox2.Checked = Convert.ToBoolean(value);
  8374. break;
  8375. case "CalculatorDecimalDigits":
  8376. numericUpDown1.Value = Convert.ToDecimal(value);
  8377. break;
  8378. }
  8379. }
  8380. #endregion
  8381. #region [脚本录制]
  8382. private void getScriptRecording()
  8383. {
  8384. string className = InvariantData.path_Action + ".Action" + menuId;
  8385. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  8386. List<Args> args = param.Lists;
  8387. foreach (var item in args)
  8388. {
  8389. item.value = setScriptRecording(item.key);
  8390. }
  8391. appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
  8392. }
  8393. private object setScriptRecording(string key)
  8394. {
  8395. object value = null;
  8396. switch (key)
  8397. {
  8398. case "parameter1":
  8399. value = checkBox1.Checked;
  8400. break;
  8401. case "OpenWhileExportReport":
  8402. value = checkBox2.Checked;
  8403. break;
  8404. case "CalculatorDecimalDigits":
  8405. value = numericUpDown1.Value;
  8406. break;
  8407. }
  8408. return value;
  8409. }
  8410. #endregion
  8411. }
  8412. }