QuantitativeAnalysisDialog.cs 275 KB

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