QuantitativeAnalysisDialog.cs 275 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428
  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. /// 选中图片的mat
  116. /// </summary>
  117. private Mat imageMat;
  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.documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
  396. this.documentWorkspace.Dock = DockStyle.Fill;
  397. this.documentWorkspace.HookMouseEvents();
  398. this.documentWorkspace.AuxiliaryLineEnabled = false;
  399. this.documentWorkspace.Visible = true;
  400. this.documentWorkspace.panel.Paint += Panel_Paint;
  401. this.documentWorkspace.panel.MouseDown += OnMouseDown;
  402. this.documentWorkspace.panel.Paint += Panel_Paint;
  403. this.documentWorkspace.panel.MouseUp += OnMouseUp;
  404. this.documentWorkspace.panel.MouseMove += onMouseMove;
  405. this.documentWorkspace.panel.PreviewKeyDown += onPreviewKeyDown;
  406. this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
  407. this.groupBox7.Controls.Add(this.documentWorkspace);
  408. this.commonControlButtons = new GeneralAnalysisCommonControlButtons();
  409. this.commonControlButtons.Dock = DockStyle.Top;
  410. this.commonControlButtons.Height = 30;
  411. this.commonControlButtons.HideZoomToWindowAndActualSize();
  412. this.commonControlButtons.trackLabel.Text = PdnResources.GetString("Menu.1point:clicktelete:doubleclick.text");
  413. this.commonControlButtons.trackLabel.Visible = true;
  414. this.commonControlButtons.trackLabel.Width = 300;
  415. this.commonControlButtons.Visible = false;
  416. this.groupBox7.Controls.Add(commonControlButtons);
  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.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
  2579. if (!existViewFlag)
  2580. mat = imageMat.Clone();
  2581. else
  2582. mat = PaintDotNet.Camera.Tools.ToMat(this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFullSizeWithRegion());
  2583. //二值化集成4
  2584. binaryClass.listView1_SelectedIndexChanged(this.imageMat.Clone());
  2585. binaryClass.applyButtonImpl();
  2586. if (bcOriginChecked())
  2587. {
  2588. this.documentWorkspace.PhaseModels[0].choise = false;
  2589. this.documentWorkspace.PhaseModels[1].choise = false;
  2590. this.documentWorkspace.Refresh();
  2591. }
  2592. this.dataGridView1.Rows.Clear();
  2593. this.p1RectangleFs.Clear();
  2594. this.p2RectangleFs.Clear();
  2595. Init();
  2596. //RefreshGridIntersections();
  2597. if (this.wholePicture)
  2598. RefreshGridIntersections(false);
  2599. else
  2600. RefreshDrawRegion(PointF.Empty, false);
  2601. this.documentWorkspace.Refresh();
  2602. }
  2603. }
  2604. private void Init()
  2605. {
  2606. this.commonControlButtons.Visible = true;
  2607. this.switchImg = false;
  2608. this.selectPicture = true;
  2609. this.dataGridView1.Rows.Clear();
  2610. }
  2611. /// <summary>
  2612. /// 画布绘制
  2613. /// </summary>
  2614. /// <param name="sender"></param>
  2615. /// <param name="e"></param>
  2616. private void Panel_Paint(object sender, PaintEventArgs e)
  2617. {
  2618. if (this.documentWorkspace.CompositionSurface != null)
  2619. {
  2620. //
  2621. // 以下是计算绘制图片的位置和大小并绘制图片
  2622. //
  2623. Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
  2624. int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
  2625. int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
  2626. int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
  2627. int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
  2628. //
  2629. // 以下是绘制网格、标注、测量、视场等开始
  2630. //
  2631. e.Graphics.TranslateTransform(x, y);
  2632. e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
  2633. Draw(e.Graphics);
  2634. if(this.listView1.SelectedItems.Count > 0 && this.dataGridView1.SelectedRows.Count > 0 && this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
  2635. {
  2636. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString().Replace("相", string.Empty);
  2637. //保存处理后的图片
  2638. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  2639. List<Bitmap> tempBit = new List<Bitmap>();
  2640. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  2641. originalBit.Tag = pantographRatio;
  2642. tempBit.Add(originalBit);
  2643. Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
  2644. Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  2645. Graphics graphics = Graphics.FromImage(newBit);
  2646. graphics.DrawImage(processedBit, new PointF(0, 0));
  2647. Draw(graphics);
  2648. newBit.Tag = pantographRatio;
  2649. tempBit.Add(newBit);
  2650. if(bitDic1.ContainsKey(tag))
  2651. bitDic1[tag] = tempBit;
  2652. }
  2653. e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
  2654. e.Graphics.TranslateTransform(-x, -y);
  2655. }
  2656. }
  2657. /// <summary>
  2658. /// 绘制
  2659. /// </summary>
  2660. /// <param name="graphics"></param>
  2661. private void Draw(Graphics graphics)
  2662. {
  2663. Pen linePen = new Pen(Color.FromArgb(this.gridColor), this.gridWidth);
  2664. if (this.selected && !this.wholePicture)
  2665. linePen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;
  2666. if (!this.checkBox4.Checked)
  2667. linePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
  2668. float hGridSpacingDraw;
  2669. float vGridSpacingDraw;
  2670. float blankDraw;
  2671. if(rectangleFs.Count > 0)
  2672. if(this.radioButton1.Checked)
  2673. {
  2674. if (this.p1RectangleFs.Count > 0 && this.dataGridView1.SelectedRows.Count > 0)
  2675. {
  2676. int index = -1;
  2677. // 1截点
  2678. foreach (var pointRectangleF in this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index])
  2679. {
  2680. index++;
  2681. // 绘制点
  2682. PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
  2683. float size = (float)(Convert.ToInt32(this.txt_LeftSize.Text) / unitLength);
  2684. // 圆形
  2685. if (this.rb_LeftCircle.Checked)
  2686. {
  2687. // 实心
  2688. if (this.rb_leftFill.Checked)
  2689. graphics.FillEllipse(new SolidBrush(this.panel1.BackColor), pointF.X - (float)size / 2, pointF.Y - (float)size / 2
  2690. , size, size);
  2691. // 空心
  2692. else
  2693. graphics.DrawEllipse(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
  2694. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  2695. }
  2696. // 方形
  2697. else
  2698. {
  2699. // 实心
  2700. if (this.rb_leftFill.Checked)
  2701. graphics.FillRectangle(new SolidBrush(this.panel1.BackColor)
  2702. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  2703. // 空心
  2704. else
  2705. graphics.DrawRectangle(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
  2706. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  2707. }
  2708. }
  2709. }
  2710. if (this.p2RectangleFs.Count > 0 && this.dataGridView1.SelectedRows.Count > 0)
  2711. {
  2712. // 0.5截点
  2713. foreach (var pointRectangleF in this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index])
  2714. {
  2715. // 绘制点
  2716. PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
  2717. float size = (float)(Convert.ToInt32(this.txt_RightSize.Text) / unitLength);
  2718. // 圆形
  2719. if (this.rb_RightCircle.Checked)
  2720. {
  2721. // 实心
  2722. if (this.rb_RightFill.Checked)
  2723. graphics.FillEllipse(new SolidBrush(this.panel2.BackColor)
  2724. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  2725. // 空心
  2726. else
  2727. graphics.DrawEllipse(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
  2728. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  2729. }
  2730. // 方形
  2731. else
  2732. {
  2733. // 实心
  2734. if (this.rb_RightFill.Checked)
  2735. graphics.FillRectangle(new SolidBrush(this.panel2.BackColor)
  2736. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  2737. // 空心
  2738. else
  2739. graphics.DrawRectangle(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
  2740. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  2741. }
  2742. }
  2743. }
  2744. foreach (RectangleF rectangleF in rectangleFs)
  2745. {
  2746. graphics.DrawLine(linePen, new PointF(rectangleF.Left, rectangleF.Y + rectangleF.Height / 2)
  2747. , new PointF(rectangleF.Right, rectangleF.Y + rectangleF.Height / 2));
  2748. graphics.DrawLine(linePen, new PointF(rectangleF.Left + rectangleF.Width / 2, rectangleF.Top)
  2749. , new PointF(rectangleF.Left + rectangleF.Width / 2, rectangleF.Bottom));
  2750. }
  2751. }
  2752. else
  2753. {
  2754. if (this.wholePicture)
  2755. {
  2756. hGridSpacingDraw = (float)(this.documentWorkspace.CompositionSurface.Height - 2 * this.blank) / (this.hNumber - 1);
  2757. vGridSpacingDraw = (float)(this.documentWorkspace.CompositionSurface.Width - 2 * this.blank) / (this.vNumber - 1);
  2758. blankDraw = this.blank;
  2759. if (this.hNumber > 0)
  2760. {
  2761. if (this.hNumber % 2 == 0)
  2762. {
  2763. float Spacing = hGridSpacingDraw / 2;
  2764. for (int i = 0; i < (float)this.hNumber / 2; i++)
  2765. {
  2766. if (this.wholePicture)
  2767. {
  2768. if (this.documentWorkspace.CompositionSurface.Height > 2 * this.blank && this.documentWorkspace.CompositionSurface.Width > 2 * this.blank)
  2769. {
  2770. if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= blankDraw)
  2771. {
  2772. graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing)
  2773. , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing));
  2774. }
  2775. if ((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height - blankDraw)
  2776. {
  2777. graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing)
  2778. , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing));
  2779. }
  2780. }
  2781. }
  2782. Spacing += hGridSpacingDraw;
  2783. }
  2784. }
  2785. else
  2786. {
  2787. if ((float)this.documentWorkspace.CompositionSurface.Width > 2 * blankDraw)
  2788. {
  2789. if (this.hNumber == 1)
  2790. graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2)
  2791. , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2));
  2792. else
  2793. {
  2794. float Spacing = hGridSpacingDraw;
  2795. for (int i = 0; i < (this.hNumber - 1) / 2; i++)
  2796. {
  2797. if (this.wholePicture)
  2798. {
  2799. if (this.documentWorkspace.CompositionSurface.Height > 2 * this.blank && this.documentWorkspace.CompositionSurface.Width > 2 * this.blank)
  2800. {
  2801. if (i == 0)
  2802. graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2)
  2803. , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2));
  2804. if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= blankDraw)
  2805. {
  2806. graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing)
  2807. , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing));
  2808. }
  2809. if ((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height - blankDraw)
  2810. {
  2811. graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing)
  2812. , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing));
  2813. }
  2814. }
  2815. }
  2816. Spacing += hGridSpacingDraw;
  2817. }
  2818. }
  2819. }
  2820. }
  2821. }
  2822. if (this.vNumber > 0)
  2823. {
  2824. if (this.vNumber % 2 == 0)
  2825. {
  2826. float Spacing = vGridSpacingDraw / 2;
  2827. for (int i = 0; i < (float)this.vNumber / 2; i++)
  2828. {
  2829. if (this.wholePicture)
  2830. {
  2831. if (this.documentWorkspace.CompositionSurface.Height > 2 * this.blank && this.documentWorkspace.CompositionSurface.Width > 2 * this.blank)
  2832. {
  2833. if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0
  2834. && (float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= blankDraw)
  2835. {
  2836. graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, blankDraw)
  2837. , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
  2838. }
  2839. if ((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width
  2840. && (float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width - blankDraw)
  2841. {
  2842. graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, blankDraw)
  2843. , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
  2844. }
  2845. }
  2846. }
  2847. Spacing += vGridSpacingDraw;
  2848. }
  2849. }
  2850. else
  2851. {
  2852. if (this.documentWorkspace.CompositionSurface.Height > 2 * blankDraw)
  2853. {
  2854. if (this.vNumber == 1)
  2855. graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, blankDraw)
  2856. , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
  2857. else
  2858. {
  2859. float Spacing = vGridSpacingDraw;
  2860. for (int i = 0; i < (this.vNumber - 1) / 2; i++)
  2861. {
  2862. if (this.wholePicture)
  2863. {
  2864. if (this.documentWorkspace.CompositionSurface.Height > 2 * this.blank && this.documentWorkspace.CompositionSurface.Width > 2 * this.blank)
  2865. {
  2866. if (i == 0)
  2867. graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, blankDraw)
  2868. , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
  2869. if ((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width
  2870. && this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width - blankDraw)
  2871. {
  2872. graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, blankDraw)
  2873. , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
  2874. }
  2875. if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0 && (float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= blankDraw)
  2876. {
  2877. graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, blankDraw)
  2878. , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
  2879. }
  2880. }
  2881. }
  2882. Spacing += vGridSpacingDraw;
  2883. }
  2884. }
  2885. }
  2886. }
  2887. }
  2888. }
  2889. else
  2890. {
  2891. hGridSpacingDraw = (float)Math.Round(this.gridSpacing / unitLength);
  2892. vGridSpacingDraw = (float)Math.Round(this.gridSpacing / unitLength);
  2893. if (this.hNumber > 0)
  2894. {
  2895. if (this.hNumber % 2 == 0)
  2896. {
  2897. float Spacing = hGridSpacingDraw / 2;
  2898. for (int i = 0; i < (float)this.hNumber / 2; i++)
  2899. {
  2900. if ((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing >= (float)this.drawRectangleF.Top)
  2901. {
  2902. graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing)
  2903. , new PointF((float)(this.drawRectangleF.Right), (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing));
  2904. }
  2905. if ((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing <= this.drawRectangleF.Bottom)
  2906. {
  2907. graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing)
  2908. , new PointF((float)this.drawRectangleF.Right, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing));
  2909. }
  2910. Spacing += hGridSpacingDraw;
  2911. }
  2912. }
  2913. else
  2914. {
  2915. if (this.hNumber == 1)
  2916. graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2)
  2917. , new PointF((float)this.drawRectangleF.Right, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2));
  2918. else
  2919. {
  2920. float Spacing = hGridSpacingDraw;
  2921. for (int i = 0; i < (this.hNumber - 1) / 2; i++)
  2922. {
  2923. if (i == 0)
  2924. graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2)
  2925. , new PointF((float)this.drawRectangleF.Right, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2));
  2926. if ((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing >= this.drawRectangleF.Top)
  2927. {
  2928. graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing)
  2929. , new PointF((float)this.drawRectangleF.Right, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing));
  2930. }
  2931. if ((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing <= this.drawRectangleF.Bottom)
  2932. {
  2933. graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing)
  2934. , new PointF((float)this.drawRectangleF.Right, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing));
  2935. }
  2936. Spacing += hGridSpacingDraw;
  2937. }
  2938. }
  2939. }
  2940. }
  2941. if (this.vNumber > 0)
  2942. {
  2943. if (this.vNumber % 2 == 0)
  2944. {
  2945. float Spacing = vGridSpacingDraw / 2;
  2946. for (int i = 0; i < (float)this.vNumber / 2; i++)
  2947. {
  2948. //if ((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing >= 0)
  2949. {
  2950. graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing, (float)this.drawRectangleF.Top)
  2951. , new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing, (float)this.drawRectangleF.Bottom));
  2952. }
  2953. if ((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing <= this.drawRectangleF.Right)
  2954. {
  2955. graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing, (float)this.drawRectangleF.Top)
  2956. , new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing, (float)this.drawRectangleF.Bottom));
  2957. }
  2958. Spacing += vGridSpacingDraw;
  2959. }
  2960. }
  2961. else
  2962. {
  2963. if (this.vNumber == 1)
  2964. graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2, (float)this.drawRectangleF.Top)
  2965. , new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2, (float)this.drawRectangleF.Bottom));
  2966. else
  2967. {
  2968. float Spacing = vGridSpacingDraw;
  2969. for (int i = 0; i < (this.vNumber - 1) / 2; i++)
  2970. {
  2971. if (i == 0)
  2972. graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2, (float)this.drawRectangleF.Top)
  2973. , new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2, (float)this.drawRectangleF.Bottom));
  2974. if ((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing <= this.drawRectangleF.Right)
  2975. {
  2976. graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing, (float)this.drawRectangleF.Top)
  2977. , new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing, (float)this.drawRectangleF.Bottom));
  2978. }
  2979. if ((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing >= this.drawRectangleF.Left)
  2980. {
  2981. graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing, (float)this.drawRectangleF.Top)
  2982. , new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing, (float)this.drawRectangleF.Bottom));
  2983. }
  2984. Spacing += vGridSpacingDraw;
  2985. }
  2986. }
  2987. }
  2988. }
  2989. }
  2990. if (this.p1RectangleFs.Count > 0 && this.dataGridView1.SelectedRows.Count > 0)
  2991. {
  2992. int index = -1;
  2993. // 1截点
  2994. foreach (var pointRectangleF in this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index])
  2995. {
  2996. index++;
  2997. // 绘制点
  2998. PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
  2999. float size = (float)(Convert.ToInt32(this.txt_LeftSize.Text) / unitLength);
  3000. // 圆形
  3001. if (this.rb_LeftCircle.Checked)
  3002. {
  3003. // 实心
  3004. if (this.rb_leftFill.Checked)
  3005. graphics.FillEllipse(new SolidBrush(this.panel1.BackColor), pointF.X - (float)size / 2, pointF.Y - (float)size / 2
  3006. , size, size);
  3007. // 空心
  3008. else
  3009. graphics.DrawEllipse(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
  3010. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  3011. }
  3012. // 方形
  3013. else
  3014. {
  3015. // 实心
  3016. if (this.rb_leftFill.Checked)
  3017. graphics.FillRectangle(new SolidBrush(this.panel1.BackColor)
  3018. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  3019. // 空心
  3020. else
  3021. graphics.DrawRectangle(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
  3022. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  3023. }
  3024. }
  3025. }
  3026. if (this.p2RectangleFs.Count > 0 && this.dataGridView1.SelectedRows.Count > 0)
  3027. {
  3028. // 0.5截点
  3029. foreach (var pointRectangleF in this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index])
  3030. {
  3031. // 绘制点
  3032. PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
  3033. float size = (float)(Convert.ToInt32(this.txt_RightSize.Text) / unitLength);
  3034. // 圆形
  3035. if (this.rb_RightCircle.Checked)
  3036. {
  3037. // 实心
  3038. if (this.rb_RightFill.Checked)
  3039. graphics.FillEllipse(new SolidBrush(this.panel2.BackColor)
  3040. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  3041. // 空心
  3042. else
  3043. graphics.DrawEllipse(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
  3044. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  3045. }
  3046. // 方形
  3047. else
  3048. {
  3049. // 实心
  3050. if (this.rb_RightFill.Checked)
  3051. graphics.FillRectangle(new SolidBrush(this.panel2.BackColor)
  3052. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  3053. // 空心
  3054. else
  3055. graphics.DrawRectangle(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
  3056. , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  3057. }
  3058. }
  3059. }
  3060. }
  3061. }
  3062. private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
  3063. {
  3064. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
  3065. e.Handled = true;
  3066. }
  3067. private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
  3068. {
  3069. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
  3070. e.Handled = true;
  3071. }
  3072. private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
  3073. {
  3074. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
  3075. e.Handled = true;
  3076. }
  3077. private void textBox5_KeyPress(object sender, KeyPressEventArgs e)
  3078. {
  3079. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
  3080. e.Handled = true;
  3081. }
  3082. private void textBoxLeftSize_KeyPress(object sender, KeyPressEventArgs e)
  3083. {
  3084. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
  3085. e.Handled = true;
  3086. }
  3087. private void textBoxLeftWidth_KeyPress(object sender, KeyPressEventArgs e)
  3088. {
  3089. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
  3090. e.Handled = true;
  3091. }
  3092. private void textBoxRightSize_KeyPress(object sender, KeyPressEventArgs e)
  3093. {
  3094. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
  3095. e.Handled = true;
  3096. }
  3097. private void textBoxRightWidth_KeyPress(object sender, KeyPressEventArgs e)
  3098. {
  3099. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
  3100. e.Handled = true;
  3101. }
  3102. /// <summary>
  3103. /// 水平线值
  3104. /// </summary>
  3105. private string hText;
  3106. /// <summary>
  3107. /// 垂直线值
  3108. /// </summary>
  3109. private string vText;
  3110. /// <summary>
  3111. /// 线宽值
  3112. /// </summary>
  3113. private string wText;
  3114. /// <summary>
  3115. /// 间距值
  3116. /// </summary>
  3117. private string sText;
  3118. /// <summary>
  3119. /// 水平线数量改变
  3120. /// </summary>
  3121. /// <param name="sender"></param>
  3122. /// <param name="e"></param>
  3123. private void textBox2_TextChanged(object sender, EventArgs e)
  3124. {
  3125. PointF pointF = new PointF(this.drawRectangleF.X, this.drawRectangleF.Y);
  3126. if (string.IsNullOrEmpty(this.textBox2.Text))
  3127. this.textBox2.Text = "0";
  3128. if (this.textBox2.Text.Length > 1 && this.textBox2.Text.Substring(0, 1).Equals("0"))
  3129. this.textBox2.Text = this.textBox2.Text.Substring(1, (this.textBox2.Text.Length - 1));
  3130. if (Convert.ToInt32(this.textBox2.Text) > 100000)
  3131. this.textBox2.Text = "100000";
  3132. if (Convert.ToInt32(this.textBox2.Text) > 0)
  3133. this.hNumber = Convert.ToInt32(this.textBox2.Text) + 1;
  3134. else
  3135. this.hNumber = 0;
  3136. if (selectPicture)
  3137. {
  3138. if (this.wholePicture)
  3139. RefreshGridIntersections(false);
  3140. else
  3141. RefreshDrawRegion(pointF, false);
  3142. }
  3143. //RefreshGridIntersections();
  3144. if (this.exceed)
  3145. this.textBox2.Text = this.hText;
  3146. foreach (var item in this.p1RectangleFs)
  3147. {
  3148. item.Clear();
  3149. }
  3150. foreach (var item in this.p2RectangleFs)
  3151. {
  3152. item.Clear();
  3153. }
  3154. //this.p1RectangleFs.Clear();
  3155. //this.p2RectangleFs.Clear();
  3156. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  3157. {
  3158. this.dataGridView1.Rows[i].Cells[2].Value = 0;
  3159. this.dataGridView1.Rows[i].Cells[3].Value = 0;
  3160. this.dataGridView1.Rows[i].Cells[5].Value = 0;
  3161. this.dataGridView1.Rows[i].Cells[6].Value = 0;
  3162. this.dataGridView1.Rows[i].Cells[7].Value = 0;
  3163. }
  3164. if (this.dataGridView1.Rows.Count > 0)
  3165. {
  3166. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  3167. {
  3168. this.dataGridView1.Rows[i].Cells[4].Value = this.rectangleFs.Count;
  3169. }
  3170. }
  3171. this.hText = this.textBox2.Text;
  3172. this.documentWorkspace.Refresh();
  3173. }
  3174. /// <summary>
  3175. /// 垂线数量改变
  3176. /// </summary>
  3177. /// <param name="sender"></param>
  3178. /// <param name="e"></param>
  3179. private void textBox3_TextChanged(object sender, EventArgs e)
  3180. {
  3181. PointF pointF = new PointF(this.drawRectangleF.X, this.drawRectangleF.Y);
  3182. if (string.IsNullOrEmpty(this.textBox3.Text))
  3183. this.textBox3.Text = "0";
  3184. if (this.textBox3.Text.Length > 1 && this.textBox3.Text.Substring(0, 1).Equals("0"))
  3185. this.textBox3.Text = this.textBox3.Text.Substring(1, (this.textBox3.Text.Length - 1));
  3186. if (Convert.ToInt32(this.textBox3.Text) > 100000)
  3187. this.textBox3.Text = "100000";
  3188. if (Convert.ToInt32(this.textBox3.Text) > 0)
  3189. this.vNumber = Convert.ToInt32(this.textBox3.Text) + 1;
  3190. else
  3191. this.vNumber = 0;
  3192. if (selectPicture)
  3193. {
  3194. if (this.wholePicture)
  3195. RefreshGridIntersections(false);
  3196. else
  3197. RefreshDrawRegion(pointF, false);
  3198. }
  3199. if (this.exceed)
  3200. this.textBox3.Text = this.vText;
  3201. foreach (var item in this.p1RectangleFs)
  3202. {
  3203. item.Clear();
  3204. }
  3205. foreach (var item in this.p2RectangleFs)
  3206. {
  3207. item.Clear();
  3208. }
  3209. //this.p1RectangleFs.Clear();
  3210. //this.p2RectangleFs.Clear();
  3211. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  3212. {
  3213. this.dataGridView1.Rows[i].Cells[2].Value = 0;
  3214. this.dataGridView1.Rows[i].Cells[3].Value = 0;
  3215. this.dataGridView1.Rows[i].Cells[5].Value = 0;
  3216. this.dataGridView1.Rows[i].Cells[6].Value = 0;
  3217. this.dataGridView1.Rows[i].Cells[7].Value = 0;
  3218. }
  3219. if (this.dataGridView1.Rows.Count > 0)
  3220. {
  3221. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  3222. {
  3223. this.dataGridView1.Rows[i].Cells[4].Value = this.rectangleFs.Count;
  3224. }
  3225. }
  3226. this.vText = this.textBox3.Text;
  3227. this.documentWorkspace.Refresh();
  3228. }
  3229. /// <summary>
  3230. /// 网格线宽改变
  3231. /// </summary>
  3232. /// <param name="sender"></param>
  3233. /// <param name="e"></param>
  3234. private void textBox4_TextChanged(object sender, EventArgs e)
  3235. {
  3236. PointF pointF = new PointF(this.drawRectangleF.X, this.drawRectangleF.Y);
  3237. if (string.IsNullOrEmpty(this.textBox4.Text))
  3238. this.textBox4.Text = "0";
  3239. if (this.textBox4.Text.Length > 1 && this.textBox4.Text.Substring(0, 1).Equals("0"))
  3240. this.textBox4.Text = this.textBox4.Text.Substring(1, (this.textBox4.Text.Length - 1));
  3241. if (Convert.ToInt32(this.textBox4.Text) > 100000)
  3242. this.textBox4.Text = "100000";
  3243. this.gridWidth = Convert.ToInt32(this.textBox4.Text);
  3244. if (selectPicture)
  3245. {
  3246. if (this.wholePicture)
  3247. RefreshGridIntersections(false);
  3248. else
  3249. RefreshDrawRegion(pointF, false);
  3250. }
  3251. if (this.exceed)
  3252. this.textBox4.Text = this.wText;
  3253. this.wText = this.textBox4.Text;
  3254. this.documentWorkspace.Refresh();
  3255. }
  3256. /// <summary>
  3257. /// 网格间距改变
  3258. /// </summary>
  3259. /// <param name="sender"></param>
  3260. /// <param name="e"></param>
  3261. private void textBox5_TextChanged(object sender, EventArgs e)
  3262. {
  3263. PointF pointF = new PointF(this.drawRectangleF.X, this.drawRectangleF.Y);
  3264. if (string.IsNullOrEmpty(this.textBox5.Text))
  3265. this.textBox5.Text = "0";
  3266. if(this.textBox5.Text.Length > 1 && this.textBox5.Text.Substring(0, 1).Equals("0"))
  3267. this.textBox5.Text = this.textBox5.Text.Substring(1, (this.textBox5.Text.Length - 1));
  3268. if (Convert.ToInt32(this.textBox5.Text) > 100000)
  3269. this.textBox5.Text = "100000";
  3270. this.gridSpacing = Convert.ToInt32(this.textBox5.Text);
  3271. if (selectPicture)
  3272. {
  3273. if (this.wholePicture)
  3274. RefreshGridIntersections(false);
  3275. else
  3276. RefreshDrawRegion(pointF, false);
  3277. }
  3278. if (this.exceed)
  3279. this.textBox5.Text = this.sText;
  3280. //this.p1RectangleFs.Clear();
  3281. //this.p2RectangleFs.Clear();
  3282. foreach (var item in this.p1RectangleFs)
  3283. {
  3284. item.Clear();
  3285. }
  3286. foreach (var item in this.p2RectangleFs)
  3287. {
  3288. item.Clear();
  3289. }
  3290. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  3291. {
  3292. this.dataGridView1.Rows[i].Cells[2].Value = 0;
  3293. this.dataGridView1.Rows[i].Cells[3].Value = 0;
  3294. this.dataGridView1.Rows[i].Cells[5].Value = 0;
  3295. this.dataGridView1.Rows[i].Cells[6].Value = 0;
  3296. this.dataGridView1.Rows[i].Cells[7].Value = 0;
  3297. }
  3298. if (this.dataGridView1.Rows.Count > 0)
  3299. {
  3300. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  3301. {
  3302. this.dataGridView1.Rows[i].Cells[4].Value = this.rectangleFs.Count;
  3303. }
  3304. }
  3305. this.sText = this.textBox5.Text;
  3306. this.documentWorkspace.Refresh();
  3307. }
  3308. /// <summary>
  3309. /// 网格颜色改变
  3310. /// </summary>
  3311. /// <param name="sender"></param>
  3312. /// <param name="e"></param>
  3313. private void panel4_BackColorChanged(object sender, EventArgs e)
  3314. {
  3315. this.gridColor = Convert.ToInt32(this.panel4.BackColor.ToArgb());
  3316. this.documentWorkspace.Refresh();
  3317. }
  3318. /// <summary>
  3319. /// 是否全图
  3320. /// </summary>
  3321. /// <param name="sender"></param>
  3322. /// <param name="e"></param>
  3323. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  3324. {
  3325. PointF pointF = new PointF(this.drawRectangleF.X, this.drawRectangleF.Y);
  3326. if (this.checkBox2.Checked)
  3327. {
  3328. this.label10.Visible = false;
  3329. this.textBox5.Visible = false;
  3330. this.label12.Visible = true;
  3331. this.numericUpDown4.Visible = true;
  3332. }
  3333. else
  3334. {
  3335. this.label10.Visible = true;
  3336. this.textBox5.Visible = true;
  3337. this.label12.Visible = false;
  3338. this.numericUpDown4.Visible = false;
  3339. }
  3340. this.wholePicture = this.checkBox2.Checked;
  3341. if (selectPicture)
  3342. {
  3343. if (this.wholePicture)
  3344. RefreshGridIntersections(false);
  3345. else
  3346. RefreshDrawRegion(pointF, false);
  3347. }
  3348. //this.p1RectangleFs.Clear();
  3349. //this.p2RectangleFs.Clear();
  3350. foreach (var item in this.p1RectangleFs)
  3351. {
  3352. item.Clear();
  3353. }
  3354. foreach (var item in this.p2RectangleFs)
  3355. {
  3356. item.Clear();
  3357. }
  3358. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  3359. {
  3360. this.dataGridView1.Rows[i].Cells[2].Value = 0;
  3361. this.dataGridView1.Rows[i].Cells[3].Value = 0;
  3362. this.dataGridView1.Rows[i].Cells[5].Value = 0;
  3363. this.dataGridView1.Rows[i].Cells[6].Value = 0;
  3364. this.dataGridView1.Rows[i].Cells[7].Value = 0;
  3365. }
  3366. if (this.dataGridView1.Rows.Count > 0)
  3367. {
  3368. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  3369. {
  3370. this.dataGridView1.Rows[i].Cells[4].Value = this.rectangleFs.Count;
  3371. }
  3372. }
  3373. this.documentWorkspace.Refresh();
  3374. }
  3375. /// <summary>
  3376. /// 余白改变
  3377. /// </summary>
  3378. /// <param name="sender"></param>
  3379. /// <param name="e"></param>
  3380. private void numericUpDown4_ValueChanged(object sender, EventArgs e)
  3381. {
  3382. PointF pointF = new PointF(this.drawRectangleF.X, this.drawRectangleF.Y);
  3383. this.blank =(float)Math.Round(Convert.ToInt32(this.numericUpDown4.Value) / unitLength);
  3384. if (selectPicture)
  3385. {
  3386. if (this.wholePicture)
  3387. RefreshGridIntersections(false);
  3388. else
  3389. RefreshDrawRegion(pointF, false);
  3390. }
  3391. //this.p1RectangleFs.Clear();
  3392. //this.p2RectangleFs.Clear();
  3393. foreach (var item in this.p1RectangleFs)
  3394. {
  3395. item.Clear();
  3396. }
  3397. foreach (var item in this.p2RectangleFs)
  3398. {
  3399. item.Clear();
  3400. }
  3401. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  3402. {
  3403. this.dataGridView1.Rows[i].Cells[2].Value = 0;
  3404. this.dataGridView1.Rows[i].Cells[3].Value = 0;
  3405. this.dataGridView1.Rows[i].Cells[5].Value = 0;
  3406. this.dataGridView1.Rows[i].Cells[6].Value = 0;
  3407. this.dataGridView1.Rows[i].Cells[7].Value = 0;
  3408. }
  3409. if (this.dataGridView1.Rows.Count > 0)
  3410. {
  3411. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  3412. {
  3413. this.dataGridView1.Rows[i].Cells[4].Value = this.rectangleFs.Count;
  3414. }
  3415. }
  3416. this.documentWorkspace.Refresh();
  3417. }
  3418. /// <summary>
  3419. /// 另存为按钮
  3420. /// </summary>
  3421. /// <param name="sender"></param>
  3422. /// <param name="e"></param>
  3423. private void button4_Click(object sender, EventArgs e)
  3424. {
  3425. List<string> items;
  3426. if (this.comboBox1.Items != null && this.comboBox1.Items.Count > 0)
  3427. {
  3428. items = new List<string>(this.comboBox1.Items.Count);
  3429. foreach (var item in this.comboBox1.Items)
  3430. {
  3431. items.Add(item.ToString());
  3432. }
  3433. }
  3434. else
  3435. {
  3436. items = null;
  3437. }
  3438. QuantitativeAnalysisGridSaveDialog quantitativeAnalysisGridSaveDialog = new QuantitativeAnalysisGridSaveDialog(items);
  3439. quantitativeAnalysisGridSaveDialog.StartPosition = FormStartPosition.CenterScreen;
  3440. quantitativeAnalysisGridSaveDialog.ShowDialog(this);
  3441. }
  3442. /// <summary>
  3443. /// 切换网格
  3444. /// </summary>
  3445. /// <param name="sender"></param>
  3446. /// <param name="e"></param>
  3447. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  3448. {
  3449. if (this.comboBox1.SelectedIndex > -1)
  3450. {
  3451. if (quantitativeAnalysisModel.GridStyleList != null)
  3452. {
  3453. foreach (var GridStyle in quantitativeAnalysisModel.GridStyleList)
  3454. {
  3455. if (GridStyle.gridName.Equals(this.comboBox1.SelectedItem))
  3456. {
  3457. this.textBox2.Text = GridStyle.hNumber.ToString();
  3458. this.textBox3.Text = GridStyle.vNumber.ToString();
  3459. this.textBox4.Text = GridStyle.gridWidth.ToString();
  3460. this.textBox5.Text = GridStyle.gridSpacing.ToString();
  3461. this.panel4.BackColor = Color.FromArgb(GridStyle.gridColor);
  3462. this.checkBox2.Checked = GridStyle.wholePicture;
  3463. this.numericUpDown4.Value = GridStyle.blank;
  3464. }
  3465. }
  3466. }
  3467. if (this.checkBox2.Checked)
  3468. {
  3469. this.label10.Visible = false;
  3470. this.textBox5.Visible = false;
  3471. this.label12.Visible = true;
  3472. this.numericUpDown4.Visible = true;
  3473. }
  3474. else
  3475. {
  3476. this.label10.Visible = true;
  3477. this.textBox5.Visible = true;
  3478. this.label12.Visible = false;
  3479. this.numericUpDown4.Visible = false;
  3480. }
  3481. //this.p1RectangleFs.Clear();
  3482. //this.p2RectangleFs.Clear();
  3483. foreach (var item in this.p1RectangleFs)
  3484. {
  3485. item.Clear();
  3486. }
  3487. foreach (var item in this.p2RectangleFs)
  3488. {
  3489. item.Clear();
  3490. }
  3491. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  3492. {
  3493. this.dataGridView1.Rows[i].Cells[2].Value = 0;
  3494. this.dataGridView1.Rows[i].Cells[3].Value = 0;
  3495. this.dataGridView1.Rows[i].Cells[5].Value = 0;
  3496. this.dataGridView1.Rows[i].Cells[6].Value = 0;
  3497. this.dataGridView1.Rows[i].Cells[7].Value = 0;
  3498. }
  3499. }
  3500. }
  3501. /// <summary>
  3502. /// 截点1形状改变
  3503. /// </summary>
  3504. /// <param name="sender"></param>
  3505. /// <param name="e"></param>
  3506. private void rb_LeftCircle_CheckedChanged(object sender, EventArgs e)
  3507. {
  3508. this.documentWorkspace.Refresh();
  3509. }
  3510. /// <summary>
  3511. /// 截点1样式改变
  3512. /// </summary>
  3513. /// <param name="sender"></param>
  3514. /// <param name="e"></param>
  3515. private void rb_leftFill_CheckedChanged(object sender, EventArgs e)
  3516. {
  3517. if(this.rb_leftFill.Checked)
  3518. {
  3519. this.label20.Visible = false;
  3520. this.txt_LeftLineWeight.Visible = false;
  3521. }
  3522. else
  3523. {
  3524. this.label20.Visible = true;
  3525. this.txt_LeftLineWeight.Visible = true;
  3526. }
  3527. this.documentWorkspace.Refresh();
  3528. }
  3529. /// <summary>
  3530. /// 截点1大小改变
  3531. /// </summary>
  3532. /// <param name="sender"></param>
  3533. /// <param name="e"></param>
  3534. private void txt_LeftSize_TextChanged(object sender, EventArgs e)
  3535. {
  3536. if (string.IsNullOrEmpty(this.txt_LeftSize.Text))
  3537. this.txt_LeftSize.Text = "0";
  3538. if (this.txt_LeftSize.Text.Length > 1 && this.txt_LeftSize.Text.Substring(0, 1).Equals("0"))
  3539. this.txt_LeftSize.Text = this.txt_LeftSize.Text.Substring(1, (this.txt_LeftSize.Text.Length - 1));
  3540. if (Convert.ToInt32(this.txt_LeftSize.Text) > 100000)
  3541. this.txt_LeftSize.Text = "100000";
  3542. if(p1RectangleFs.Count > 0)
  3543. {
  3544. for (int i = 0; i < this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count; i++)
  3545. {
  3546. RectangleF pointRectangleF = this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i];
  3547. // 绘制点
  3548. PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
  3549. float size = (float)(Convert.ToInt32(this.txt_LeftSize.Text) / unitLength);
  3550. RectangleF rectangleF = new RectangleF(pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  3551. this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i] = rectangleF;
  3552. }
  3553. }
  3554. this.documentWorkspace.Refresh();
  3555. }
  3556. /// <summary>
  3557. /// 截点1线宽改变
  3558. /// </summary>
  3559. /// <param name="sender"></param>
  3560. /// <param name="e"></param>
  3561. private void txt_LeftLineWeight_TextChanged(object sender, EventArgs e)
  3562. {
  3563. if (string.IsNullOrEmpty(this.txt_LeftLineWeight.Text))
  3564. this.txt_LeftLineWeight.Text = "0";
  3565. if (this.txt_LeftLineWeight.Text.Length > 1 && this.txt_LeftLineWeight.Text.Substring(0, 1).Equals("0"))
  3566. this.txt_LeftLineWeight.Text = this.txt_LeftLineWeight.Text.Substring(1, (this.txt_LeftLineWeight.Text.Length - 1));
  3567. if (Convert.ToInt32(this.txt_LeftLineWeight.Text) > 100000)
  3568. this.txt_LeftLineWeight.Text = "100000";
  3569. this.documentWorkspace.Refresh();
  3570. }
  3571. /// <summary>
  3572. /// 截点0.5形状改变
  3573. /// </summary>
  3574. /// <param name="sender"></param>
  3575. /// <param name="e"></param>
  3576. private void rb_RightCircle_CheckedChanged(object sender, EventArgs e)
  3577. {
  3578. this.documentWorkspace.Refresh();
  3579. }
  3580. /// <summary>
  3581. /// 截点0.5样式改变
  3582. /// </summary>
  3583. /// <param name="sender"></param>
  3584. /// <param name="e"></param>
  3585. private void rb_RightFill_CheckedChanged(object sender, EventArgs e)
  3586. {
  3587. if (this.rb_RightFill.Checked)
  3588. {
  3589. this.label15.Visible = false;
  3590. this.txt_RightLineWeight.Visible = false;
  3591. }
  3592. else
  3593. {
  3594. this.label15.Visible = true;
  3595. this.txt_RightLineWeight.Visible = true;
  3596. }
  3597. this.documentWorkspace.Refresh();
  3598. }
  3599. /// <summary>
  3600. /// 截点0.5大小改变
  3601. /// </summary>
  3602. /// <param name="sender"></param>
  3603. /// <param name="e"></param>
  3604. private void txt_RightSize_TextChanged(object sender, EventArgs e)
  3605. {
  3606. if (string.IsNullOrEmpty(this.txt_RightSize.Text))
  3607. this.txt_RightSize.Text = "0";
  3608. if (this.txt_RightSize.Text.Length > 1 && this.txt_RightSize.Text.Substring(0, 1).Equals("0"))
  3609. this.txt_RightSize.Text = this.txt_RightSize.Text.Substring(1, (this.txt_RightSize.Text.Length - 1));
  3610. if (Convert.ToInt32(this.txt_RightSize.Text) > 100000)
  3611. this.txt_RightSize.Text = "100000";
  3612. if(p2RectangleFs.Count > 0)
  3613. {
  3614. for (int i = 0; i < this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count; i++)
  3615. {
  3616. RectangleF pointRectangleF = this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i];
  3617. // 绘制点
  3618. PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
  3619. float size = (float)(Convert.ToInt32(this.txt_RightSize.Text) / unitLength);
  3620. RectangleF rectangleF = new RectangleF(pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
  3621. this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i] = rectangleF;
  3622. }
  3623. }
  3624. this.documentWorkspace.Refresh();
  3625. }
  3626. /// <summary>
  3627. /// 截点0.5线宽改变
  3628. /// </summary>
  3629. /// <param name="sender"></param>
  3630. /// <param name="e"></param>
  3631. private void txt_RightLineWeight_TextChanged(object sender, EventArgs e)
  3632. {
  3633. if (string.IsNullOrEmpty(this.txt_RightLineWeight.Text))
  3634. this.txt_RightLineWeight.Text = "0";
  3635. if (this.txt_RightLineWeight.Text.Length > 1 && this.txt_RightLineWeight.Text.Substring(0, 1).Equals("0"))
  3636. this.txt_RightLineWeight.Text = this.txt_RightLineWeight.Text.Substring(1, (this.txt_RightLineWeight.Text.Length - 1));
  3637. if (Convert.ToInt32(this.txt_RightLineWeight.Text) > 100000)
  3638. this.txt_RightLineWeight.Text = "100000";
  3639. this.documentWorkspace.Refresh();
  3640. }
  3641. /// <summary>
  3642. /// 截点0.5颜色改变
  3643. /// </summary>
  3644. /// <param name="sender"></param>
  3645. /// <param name="e"></param>
  3646. private void panel2_BackColorChanged(object sender, EventArgs e)
  3647. {
  3648. this.documentWorkspace.Refresh();
  3649. }
  3650. /// <summary>
  3651. /// 开始测量
  3652. /// </summary>
  3653. /// <param name="sender"></param>
  3654. /// <param name="e"></param>
  3655. private void button6_Click(object sender, EventArgs e)
  3656. {
  3657. if (this.listView1.SelectedItems.Count > 0)
  3658. {
  3659. this.startText = true;
  3660. this.button6.Visible = false;
  3661. this.button7.Visible = true;
  3662. this.comboBox1.Enabled = false;
  3663. this.button3.Enabled = false;
  3664. this.button4.Enabled = false;
  3665. this.button5.Enabled = false;
  3666. this.groupBox4.Enabled = false;
  3667. this.button7.Focus();
  3668. if (this.dataGridView1.Rows.Count > 0)
  3669. {
  3670. this.dataGridView1.Rows.Clear();
  3671. this.p1RectangleFs.Clear();
  3672. this.p2RectangleFs.Clear();
  3673. this.documentWorkspace.Refresh();
  3674. }
  3675. }
  3676. else
  3677. {
  3678. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  3679. }
  3680. }
  3681. /// <summary>
  3682. /// 停止测量
  3683. /// </summary>
  3684. /// <param name="sender"></param>
  3685. /// <param name="e"></param>
  3686. private void button7_Click(object sender, EventArgs e)
  3687. {
  3688. this.button6.Visible = true;
  3689. this.button7.Visible = false;
  3690. this.comboBox1.Enabled = true;
  3691. this.button3.Enabled = true;
  3692. this.button4.Enabled = true;
  3693. this.button5.Enabled = true;
  3694. this.groupBox4.Enabled = true;
  3695. this.button6.Focus();
  3696. }
  3697. /// <summary>
  3698. /// 截点颜色改变
  3699. /// </summary>
  3700. /// <param name="sender"></param>
  3701. /// <param name="e"></param>
  3702. private void panel1_BackColorChanged(object sender, EventArgs e)
  3703. {
  3704. this.documentWorkspace.Refresh();
  3705. }
  3706. /// <summary>
  3707. /// 保存按钮
  3708. /// </summary>
  3709. /// <param name="sender"></param>
  3710. /// <param name="e"></param>
  3711. private void button3_Click(object sender, EventArgs e)
  3712. {
  3713. if(this.comboBox1.Items.Count == 0)
  3714. {
  3715. QuantitativeAnalysisGridSaveDialog quantitativeAnalysisGridSaveDialog = new QuantitativeAnalysisGridSaveDialog(null);
  3716. quantitativeAnalysisGridSaveDialog.StartPosition = FormStartPosition.CenterScreen;
  3717. quantitativeAnalysisGridSaveDialog.ShowDialog(this);
  3718. }
  3719. else
  3720. {
  3721. RefreshGridItems(null);
  3722. }
  3723. }
  3724. /// <summary>
  3725. /// 删除选中网格
  3726. /// </summary>
  3727. /// <param name="sender"></param>
  3728. /// <param name="e"></param>
  3729. private void button5_Click(object sender, EventArgs e)
  3730. {
  3731. if (this.comboBox1.SelectedIndex > -1 && this.comboBox1.DataSource != null)
  3732. {
  3733. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethegrid.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  3734. if (dr == DialogResult.OK)
  3735. {
  3736. int index = this.comboBox1.SelectedIndex;
  3737. if (this.quantitativeAnalysisModel.GridStyleList != null)
  3738. {
  3739. foreach (var GridStyle in this.quantitativeAnalysisModel.GridStyleList)
  3740. {
  3741. if (GridStyle.gridName.Equals(this.comboBox1.SelectedItem))
  3742. {
  3743. this.quantitativeAnalysisModel.GridStyleList.Remove(GridStyle);
  3744. break;
  3745. }
  3746. }
  3747. }
  3748. ArrayList arrayList = new ArrayList();
  3749. foreach (var GridStyle in quantitativeAnalysisModel.GridStyleList)
  3750. {
  3751. arrayList.Add(GridStyle.gridName);
  3752. }
  3753. this.comboBox1.DataSource = null;
  3754. this.comboBox1.DataSource = arrayList;
  3755. if (this.comboBox1.Items.Count > 0)
  3756. {
  3757. if (index == 0)
  3758. this.comboBox1.SelectedIndex = index;
  3759. else
  3760. this.comboBox1.SelectedIndex = index - 1;
  3761. }
  3762. else
  3763. {
  3764. this.textBox2.Text = "0";
  3765. this.textBox3.Text = "0";
  3766. this.textBox4.Text = "0";
  3767. this.textBox5.Text = "0";
  3768. this.numericUpDown4.Value = 0;
  3769. this.checkBox2.Checked = false;
  3770. this.label10.Visible = true;
  3771. this.textBox5.Visible = true;
  3772. this.label12.Visible = false;
  3773. this.numericUpDown4.Visible = false;
  3774. }
  3775. //以下保存xml文件信息
  3776. string stageModelXml = XmlSerializeHelper.XmlSerialize<QuantitativeAnalysisModel>(quantitativeAnalysisModel);
  3777. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\QuantitativeAnalysisModel.xml";
  3778. FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
  3779. }
  3780. }
  3781. else
  3782. {
  3783. MessageBox.Show(PdnResources.GetString("Menu.Nogrid.text")+"!");
  3784. }
  3785. }
  3786. /// <summary>
  3787. /// 鼠标按下
  3788. /// </summary>
  3789. /// <param name="drawArea"></param>
  3790. /// <param name="e"></param>
  3791. private void OnMouseDown(object sender, MouseEventArgs e)
  3792. {
  3793. // 换算后的点
  3794. PointF point1 = documentWorkspace.GetScalePoint(e.Location);
  3795. if (!this.wholePicture && this.checkBox4.Checked)
  3796. {
  3797. if (e.Button == MouseButtons.Left)
  3798. {
  3799. if (this.drawRectangleF.Contains(point1))
  3800. {
  3801. canMove = true;
  3802. oldLocation = point1;
  3803. selected = true;
  3804. this.documentWorkspace.panel.Focus();
  3805. }
  3806. else
  3807. selected = false;
  3808. }
  3809. }
  3810. if (this.checkBox4.Checked)
  3811. return;
  3812. if (this.button6.Visible)
  3813. {
  3814. MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!");
  3815. return;
  3816. }
  3817. if (this.dataGridView1.SelectedRows.Count == 0)
  3818. {
  3819. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectadaphase.text")+"!");
  3820. return;
  3821. }
  3822. bool canAdd1 = true;
  3823. bool canAdd2 = true;
  3824. if (p2RectangleFs.Count > 0)
  3825. {
  3826. foreach (var rectangleF in p2RectangleFs[this.dataGridView1.SelectedRows[0].Index])
  3827. {
  3828. if (rectangleF.Contains(point1))
  3829. {
  3830. canAdd1 = false;
  3831. if (e.Button == MouseButtons.Left && e.Clicks == 2)
  3832. {
  3833. p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Remove(rectangleF);
  3834. this.saveSuccess = true;
  3835. break;
  3836. }
  3837. }
  3838. }
  3839. }
  3840. if (p1RectangleFs.Count > 0)
  3841. {
  3842. foreach (var rectangleF in p1RectangleFs[this.dataGridView1.SelectedRows[0].Index])
  3843. {
  3844. if (rectangleF.Contains(point1))
  3845. {
  3846. canAdd2 = false;
  3847. if (e.Button == MouseButtons.Left && e.Clicks == 2)
  3848. {
  3849. p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Remove(rectangleF);
  3850. this.saveSuccess = true;
  3851. break;
  3852. }
  3853. }
  3854. }
  3855. }
  3856. if (e.Button == MouseButtons.Left)
  3857. {
  3858. float size = (float)(Convert.ToInt32(this.txt_LeftSize.Text) / unitLength);
  3859. foreach (RectangleF rectangleF in this.rectangleFs)
  3860. {
  3861. if (canAdd1 && canAdd2)
  3862. {
  3863. if (rectangleF.Contains(point1))
  3864. {
  3865. p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Add(new RectangleF(rectangleF.X + (float)rectangleF.Width / 2 - (float)(size / 2)
  3866. , rectangleF.Y + (float)rectangleF.Height / 2 - (float)(size / 2)
  3867. , size, size));
  3868. this.saveSuccess = true;
  3869. }
  3870. }
  3871. }
  3872. }
  3873. if (e.Button == MouseButtons.Right)
  3874. {
  3875. float size = (float)(Convert.ToInt32(this.txt_RightSize.Text) / unitLength);
  3876. foreach (RectangleF rectangleF in this.rectangleFs)
  3877. {
  3878. if (canAdd1 && canAdd2)
  3879. {
  3880. if (rectangleF.Contains(point1))
  3881. {
  3882. p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Add(new RectangleF(rectangleF.X + (float)rectangleF.Width / 2 - (float)(size / 2)
  3883. , rectangleF.Y + (float)rectangleF.Height / 2 - (float)(size / 2)
  3884. , size, size));
  3885. this.saveSuccess = true;
  3886. }
  3887. }
  3888. }
  3889. }
  3890. if (this.p1RectangleFs.Count > 0)
  3891. {
  3892. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[2].Value = p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count;
  3893. }
  3894. else
  3895. {
  3896. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[2].Value = 0;
  3897. }
  3898. if (this.p2RectangleFs.Count > 0)
  3899. {
  3900. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[3].Value = p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count;
  3901. }
  3902. else
  3903. {
  3904. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[3].Value = 0;
  3905. }
  3906. double percentage = 0;
  3907. if (Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[4].Value) > 0)
  3908. {
  3909. percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[2].Value)
  3910. + Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[3].Value) * 0.5))
  3911. / Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[4].Value)) * 100;
  3912. }
  3913. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[5].Value = Math.Round(percentage, Convert.ToInt32(this.numericUpDown1.Value));
  3914. if (this.p1RectangleFs.Count > 0 && p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count > 0)
  3915. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[6].Value = Math.Round((Convert.ToDouble(p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count)
  3916. / (Convert.ToDouble(p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count) + Convert.ToDouble(p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count))) * 100, Convert.ToInt32(this.numericUpDown1.Value));
  3917. else
  3918. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[6].Value = 0;
  3919. if (this.p2RectangleFs.Count > 0 && p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count > 0)
  3920. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[7].Value = Math.Round((Convert.ToDouble(p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count)
  3921. / (Convert.ToDouble(p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count) + Convert.ToDouble(p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count))) * 100, Convert.ToInt32(this.numericUpDown1.Value));
  3922. else
  3923. this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[7].Value = 0;
  3924. this.documentWorkspace.Refresh();
  3925. }
  3926. /// <summary>
  3927. /// 移动
  3928. /// </summary>
  3929. /// <param name="sender"></param>
  3930. /// <param name="e"></param>
  3931. private void onMouseMove(object sender, MouseEventArgs e)
  3932. {
  3933. if (!this.wholePicture && this.checkBox4.Checked)
  3934. {
  3935. // 换算后的点
  3936. PointF point1 = documentWorkspace.GetScalePoint(e.Location);
  3937. if (e.Button == MouseButtons.Left && canMove)
  3938. {
  3939. // 矩形偏移
  3940. this.drawRectangleF.Offset(point1.X - this.oldLocation.X, point1.Y - this.oldLocation.Y);
  3941. if (this.dataGridView1.SelectedRows.Count > 0 && this.p1RectangleFs.Count > 0)
  3942. {
  3943. for (int i = 0; i < this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count; i++)
  3944. {
  3945. RectangleF rectangleF1 = this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i];
  3946. rectangleF1.Offset(point1.X - this.oldLocation.X, point1.Y - this.oldLocation.Y);
  3947. this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i] = rectangleF1;
  3948. }
  3949. }
  3950. if (this.dataGridView1.SelectedRows.Count > 0 && this.p2RectangleFs.Count > 0)
  3951. {
  3952. for (int i = 0; i < this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count; i++)
  3953. {
  3954. RectangleF rectangleF1 = this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i];
  3955. rectangleF1.Offset(point1.X - this.oldLocation.X, point1.Y - this.oldLocation.Y);
  3956. this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i] = rectangleF1;
  3957. }
  3958. }
  3959. this.oldLocation = point1;
  3960. }
  3961. RefreshDrawRegion(this.drawRectangleF.Location, true);
  3962. this.documentWorkspace.Refresh();
  3963. }
  3964. }
  3965. /// <summary>
  3966. /// 鼠标抬起
  3967. /// </summary>
  3968. /// <param name="sender"></param>
  3969. /// <param name="e"></param>
  3970. private void OnMouseUp(object sender, MouseEventArgs e)
  3971. {
  3972. canMove = false;
  3973. }
  3974. /// <summary>
  3975. /// 键盘事件
  3976. /// </summary>
  3977. /// <param name="sender"></param>
  3978. /// <param name="e"></param>
  3979. private void onPreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
  3980. {
  3981. if (this.selected && (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Right))
  3982. {
  3983. PointF pointF = this.drawRectangleF.Location;
  3984. if (e.KeyCode == Keys.Up)
  3985. pointF.Y -= 5;
  3986. else if (e.KeyCode == Keys.Down)
  3987. pointF.Y += 5;
  3988. else if (e.KeyCode == Keys.Left)
  3989. pointF.X -= 5;
  3990. else if (e.KeyCode == Keys.Right)
  3991. pointF.X += 5;
  3992. this.drawRectangleF.Location = pointF;
  3993. if (this.dataGridView1.SelectedRows.Count > 0 && this.p1RectangleFs.Count > 0)
  3994. {
  3995. RectangleF rectangleF = new RectangleF();
  3996. PointF pointF1 = new PointF();
  3997. for (int i = 0; i < this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count; i++)
  3998. {
  3999. rectangleF = this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i];
  4000. pointF1 = this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i].Location;
  4001. if (e.KeyCode == Keys.Up)
  4002. pointF1.Y -= 5;
  4003. else if (e.KeyCode == Keys.Down)
  4004. pointF1.Y += 5;
  4005. else if (e.KeyCode == Keys.Left)
  4006. pointF1.X -= 5;
  4007. else if (e.KeyCode == Keys.Right)
  4008. pointF1.X += 5;
  4009. rectangleF.Location = pointF1;
  4010. this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i] = rectangleF;
  4011. }
  4012. }
  4013. if (this.dataGridView1.SelectedRows.Count > 0 && this.p2RectangleFs.Count > 0)
  4014. {
  4015. RectangleF rectangleF = new RectangleF();
  4016. PointF pointF1 = new PointF();
  4017. for (int i = 0; i < this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count; i++)
  4018. {
  4019. rectangleF = this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i];
  4020. pointF1 = this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i].Location;
  4021. if (e.KeyCode == Keys.Up)
  4022. pointF1.Y -= 5;
  4023. else if (e.KeyCode == Keys.Down)
  4024. pointF1.Y += 5;
  4025. else if (e.KeyCode == Keys.Left)
  4026. pointF1.X -= 5;
  4027. else if (e.KeyCode == Keys.Right)
  4028. pointF1.X += 5;
  4029. rectangleF.Location = pointF1;
  4030. this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i] = rectangleF;
  4031. }
  4032. }
  4033. this.documentWorkspace.Refresh();
  4034. }
  4035. }
  4036. private void dataGridView1_SelectionChanged(object sender, EventArgs e)
  4037. {
  4038. this.documentWorkspace.Refresh();
  4039. }
  4040. /// <summary>
  4041. /// 取消全部显示
  4042. /// </summary>
  4043. /// <param name="sender"></param>
  4044. /// <param name="e"></param>
  4045. private void button16_Click(object sender, EventArgs e)
  4046. {
  4047. this.allShow = false;
  4048. this.button11.Visible = true;
  4049. this.button16.Visible = false;
  4050. if(this.listView2.Items.Count > 0)
  4051. {
  4052. if (this.listView2.SelectedItems.Count > 0)
  4053. {
  4054. List<int> dataTableIndex = new List<int>();
  4055. if (this.pictureDataTables.Count == 0)
  4056. return;
  4057. for (int i = 0; i < this.pictureDataTables.Count; i++)
  4058. {
  4059. foreach (ListViewItem item in this.listView2.SelectedItems)
  4060. {
  4061. if (this.pictureDataTables[i].TableName.Equals(item.Tag))
  4062. dataTableIndex.Add(i);
  4063. }
  4064. }
  4065. this.dataGridView4.Rows.Clear();
  4066. foreach (var item in dataTableIndex)
  4067. {
  4068. if (this.pictureDataTables[item].Rows.Count > 0)
  4069. {
  4070. for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
  4071. {
  4072. DataGridViewRow dgvr = new DataGridViewRow();
  4073. dgvr.Tag = this.pictureDataTables[item].TableName;
  4074. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  4075. {
  4076. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  4077. }
  4078. for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
  4079. {
  4080. if (c == this.pictureDataTables[item].Columns.Count - 1 || c == this.pictureDataTables[item].Columns.Count - 2 || c == this.pictureDataTables[item].Columns.Count - 3)
  4081. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  4082. else
  4083. dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
  4084. }
  4085. this.dataGridView4.Rows.Add(dgvr);
  4086. }
  4087. }
  4088. }
  4089. }
  4090. else
  4091. {
  4092. this.listView2.Items[0].Selected = true;
  4093. if (this.pictureDataTables.Count > 0
  4094. && this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count > 0)
  4095. {
  4096. this.dataGridView4.Rows.Clear();
  4097. for (int r = 0; r < this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count; r++)
  4098. {
  4099. DataGridViewRow dgvr = new DataGridViewRow();
  4100. dgvr.Tag = this.pictureDataTables[this.pictureDataTables.Count - 1].TableName;
  4101. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  4102. {
  4103. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  4104. }
  4105. for (int c = 0; c < this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count; c++)
  4106. {
  4107. 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)
  4108. dgvr.Cells[c].Value =Math.Round((double)Convert.ToDecimal( this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  4109. else
  4110. dgvr.Cells[c].Value =this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c].ToString();
  4111. }
  4112. this.dataGridView4.Rows.Add(dgvr);
  4113. }
  4114. }
  4115. }
  4116. }
  4117. }
  4118. /// <summary>
  4119. /// 分析结果删除
  4120. /// </summary>
  4121. /// <param name="sender"></param>
  4122. /// <param name="e"></param>
  4123. private void button12_Click(object sender, EventArgs e)
  4124. {
  4125. if (this.listView2.Items.Count > 0)
  4126. {
  4127. if (this.listView2.SelectedItems.Count > 0)
  4128. {
  4129. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethisanalysisresult.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  4130. if (dr == DialogResult.OK)
  4131. {
  4132. List<string> detaleName = new List<string>();
  4133. int selectIndex = this.listView2.SelectedItems[0].Index;
  4134. foreach (ListViewItem item in this.listView2.SelectedItems)
  4135. {
  4136. detaleName.Add(item.Tag.ToString());
  4137. this.listView2.Items.Remove(item);
  4138. }
  4139. foreach (string tag in detaleName)
  4140. {
  4141. foreach (DataTable dataTable in this.pictureDataTables)
  4142. {
  4143. if (dataTable.TableName.Equals(tag))
  4144. {
  4145. this.pictureDataTables.Remove(dataTable);
  4146. break;
  4147. }
  4148. }
  4149. for (int i = 0; i < bitDic.Count; i++)
  4150. {
  4151. foreach (var item in bitDic)
  4152. {
  4153. string keyDe = item.Key.Substring(0, item.Key.IndexOf("|"));
  4154. if (tag.Equals(keyDe))
  4155. {
  4156. bitDic.Remove(item.Key);
  4157. break;
  4158. }
  4159. }
  4160. }
  4161. foreach (ExportProjectModel model in this.tempDataModel)
  4162. {
  4163. if (model.tagName.Equals(tag))
  4164. {
  4165. this.tempDataModel.Remove(model);
  4166. break;
  4167. }
  4168. }
  4169. }
  4170. if (this.listView2.Items.Count > 0)
  4171. {
  4172. if (selectIndex == 0)
  4173. this.listView2.Items[0].Selected = true;
  4174. else
  4175. this.listView2.Items[selectIndex - 1].Selected = true;
  4176. RefreshDataGridView4();
  4177. }
  4178. else
  4179. {
  4180. this.dataGridView4.Rows.Clear();
  4181. }
  4182. }
  4183. }
  4184. else
  4185. {
  4186. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheanalysisresulttodelete.text")+"!");
  4187. }
  4188. }
  4189. else
  4190. {
  4191. MessageBox.Show(PdnResources.GetString("Menu.Nodataintheanalysisresults.text")+"!");
  4192. }
  4193. }
  4194. /// <summary>
  4195. /// 刷新分析结果数据
  4196. /// </summary>
  4197. private void RefreshDataGridView4()
  4198. {
  4199. if (!this.allShow)
  4200. {
  4201. if (this.listView2.SelectedItems.Count > 0)
  4202. {
  4203. List<int> dataTableIndex = new List<int>();
  4204. for (int i = 0; i < this.pictureDataTables.Count; i++)
  4205. {
  4206. foreach (ListViewItem item in this.listView2.SelectedItems)
  4207. {
  4208. if (this.pictureDataTables[i].TableName.Equals(item.Tag))
  4209. dataTableIndex.Add(i);
  4210. }
  4211. }
  4212. if (this.pictureDataTables.Count == 0)
  4213. return;
  4214. this.dataGridView4.Rows.Clear();
  4215. foreach (var item in dataTableIndex)
  4216. {
  4217. if (this.pictureDataTables[item].Rows.Count > 0)
  4218. {
  4219. for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
  4220. {
  4221. DataGridViewRow dgvr = new DataGridViewRow();
  4222. dgvr.Tag = this.pictureDataTables[item].TableName;
  4223. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  4224. {
  4225. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  4226. }
  4227. for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
  4228. {
  4229. if (c != this.pictureDataTables[item].Columns.Count - 1 && c != this.pictureDataTables[item].Columns.Count - 2 && c != this.pictureDataTables[item].Columns.Count - 3)
  4230. dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
  4231. else
  4232. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  4233. }
  4234. this.dataGridView4.Rows.Add(dgvr);
  4235. }
  4236. }
  4237. }
  4238. }
  4239. }
  4240. else
  4241. {
  4242. this.dataGridView4.Rows.Clear();
  4243. DataTable dataTable = new DataTable();
  4244. for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
  4245. {
  4246. dataTable = this.pictureDataTables[i];
  4247. for (int r = 0; r < dataTable.Rows.Count; r++)
  4248. {
  4249. DataGridViewRow dgvr = new DataGridViewRow();
  4250. dgvr.Tag = dataTable.TableName;
  4251. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  4252. {
  4253. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  4254. }
  4255. for (int c = 0; c < dataTable.Columns.Count; c++)
  4256. {
  4257. if(c != dataTable.Columns.Count - 1 && c != dataTable.Columns.Count - 2 && c != dataTable.Columns.Count - 3)
  4258. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  4259. else
  4260. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  4261. }
  4262. this.dataGridView4.Rows.Add(dgvr);
  4263. }
  4264. }
  4265. }
  4266. }
  4267. /// <summary>
  4268. /// 切换分析结果
  4269. /// </summary>
  4270. /// <param name="sender"></param>
  4271. /// <param name="e"></param>
  4272. private void listView2_SelectedIndexChanged(object sender, EventArgs e)
  4273. {
  4274. if (!this.allShow)
  4275. {
  4276. if (this.listView2.SelectedItems.Count > 0)
  4277. {
  4278. List<int> dataTableIndex = new List<int>();
  4279. if (this.pictureDataTables.Count == 0)
  4280. return;
  4281. for (int i = 0; i < this.pictureDataTables.Count; i++)
  4282. {
  4283. foreach (ListViewItem item in this.listView2.SelectedItems)
  4284. {
  4285. if (this.pictureDataTables[i].TableName.Equals(item.Tag))
  4286. dataTableIndex.Add(i);
  4287. }
  4288. }
  4289. this.dataGridView4.Rows.Clear();
  4290. foreach (var item in dataTableIndex)
  4291. {
  4292. if (this.pictureDataTables[item].Rows.Count > 0)
  4293. {
  4294. for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
  4295. {
  4296. DataGridViewRow dgvr = new DataGridViewRow();
  4297. dgvr.Tag = this.pictureDataTables[item].TableName;
  4298. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  4299. {
  4300. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  4301. }
  4302. for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
  4303. {
  4304. if (c == this.pictureDataTables[item].Columns.Count - 1 || c == this.pictureDataTables[item].Columns.Count - 2 || c == this.pictureDataTables[item].Columns.Count - 3)
  4305. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  4306. else
  4307. dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
  4308. }
  4309. this.dataGridView4.Rows.Add(dgvr);
  4310. }
  4311. }
  4312. }
  4313. }
  4314. }
  4315. }
  4316. /// <summary>
  4317. /// 未选择分析结果
  4318. /// </summary>
  4319. /// <param name="sender"></param>
  4320. /// <param name="e"></param>
  4321. private void listView2_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
  4322. {
  4323. if (!this.allShow)
  4324. {
  4325. if (this.listView2.SelectedItems.Count == 0)
  4326. this.dataGridView4.Rows.Clear();
  4327. }
  4328. }
  4329. /// <summary>
  4330. /// 全部显示
  4331. /// </summary>
  4332. /// <param name="sender"></param>
  4333. /// <param name="e"></param>
  4334. private void button11_Click(object sender, EventArgs e)
  4335. {
  4336. this.allShow = true;
  4337. this.button11.Visible = false;
  4338. this.button16.Visible = true;
  4339. this.button16.Focus();
  4340. AllShow();
  4341. }
  4342. private void AllShow()
  4343. {
  4344. this.dataGridView4.Rows.Clear();
  4345. DataTable dataTable = new DataTable();
  4346. for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
  4347. {
  4348. dataTable = this.pictureDataTables[i];
  4349. for (int r = 0; r < dataTable.Rows.Count; r++)
  4350. {
  4351. DataGridViewRow dgvr = new DataGridViewRow();
  4352. dgvr.Tag = dataTable.TableName;
  4353. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  4354. {
  4355. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  4356. }
  4357. for (int c = 0; c < dataTable.Columns.Count; c++)
  4358. {
  4359. if (c == dataTable.Columns.Count - 1 || c == dataTable.Columns.Count - 2 || c == dataTable.Columns.Count - 3)
  4360. dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
  4361. else
  4362. dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
  4363. }
  4364. this.dataGridView4.Rows.Add(dgvr);
  4365. }
  4366. }
  4367. }
  4368. /// <summary>
  4369. /// 添加相
  4370. /// </summary>
  4371. /// <param name="sender"></param>
  4372. /// <param name="e"></param>
  4373. private void but_AddPhase_Click(object sender, EventArgs e)
  4374. {
  4375. if(this.button6.Visible)
  4376. {
  4377. MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!");
  4378. return;
  4379. }
  4380. if (this.documentWorkspace.phaseModels.Count == 0 || (this.documentWorkspace.phaseModels.Count != 0 && this.documentWorkspace.phaseModels[0].mat == null))
  4381. {
  4382. MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformbinarizationoperationfirst.text")+"!");
  4383. return;
  4384. }
  4385. DataGridViewRow dgvr = new DataGridViewRow();
  4386. foreach (DataGridViewColumn c in this.dataGridView1.Columns)
  4387. {
  4388. dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
  4389. }
  4390. ArrayList arrayList = new ArrayList();
  4391. for (int i = 0; i < this.dataGridView1.RowCount; i++)
  4392. {
  4393. arrayList.Add(this.dataGridView1.Rows[i].Cells[1].Value.ToString().Replace("相", string.Empty));
  4394. }
  4395. int name = 0;
  4396. foreach (var item in arrayList)
  4397. {
  4398. if (Convert.ToInt32(item) >= name)
  4399. name = Convert.ToInt32(item) + 1;
  4400. }
  4401. dgvr.Cells[0].Value = PdnResources.GetString("Menu.view.text");
  4402. dgvr.Cells[1].Value = PdnResources.GetString("Menu.phase.text") + name;
  4403. dgvr.Cells[2].Value = 0;
  4404. dgvr.Cells[3].Value = 0;
  4405. dgvr.Cells[4].Value = this.rectangleFs.Count;
  4406. dgvr.Cells[5].Value = 0;
  4407. dgvr.Cells[6].Value = 0;
  4408. dgvr.Cells[7].Value = 0;
  4409. this.dataGridView1.Rows.Add(dgvr);
  4410. this.p1RectangleFs.Add(new List<RectangleF>());
  4411. this.p2RectangleFs.Add(new List<RectangleF>());
  4412. if(this.documentWorkspace.PhaseModels[0].mat != null)
  4413. {
  4414. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + name;
  4415. //保存处理后的图片
  4416. double pantographRatio = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  4417. List<Bitmap> tempBit = new List<Bitmap>();
  4418. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  4419. originalBit.Tag = pantographRatio;
  4420. tempBit.Add(originalBit);
  4421. Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
  4422. Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  4423. Graphics graphics = Graphics.FromImage(newBit);
  4424. graphics.DrawImage(processedBit, new PointF(0, 0));
  4425. Draw(graphics);
  4426. newBit.Tag = pantographRatio;
  4427. tempBit.Add(newBit);
  4428. if (bitDic1.ContainsKey(tag))
  4429. bitDic1[tag] = tempBit;
  4430. else
  4431. bitDic1.Add(tag, tempBit);
  4432. }
  4433. this.saveSuccess = true;
  4434. if(this.dataGridView1.Rows.Count > 0)
  4435. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;
  4436. }
  4437. /// <summary>
  4438. /// 删除相
  4439. /// </summary>
  4440. /// <param name="sender"></param>
  4441. /// <param name="e"></param>
  4442. private void But_DelPhase_Click(object sender, EventArgs e)
  4443. {
  4444. if (this.dataGridView1.Rows.Count == 0)
  4445. {
  4446. MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
  4447. return;
  4448. }
  4449. if (this.dataGridView1.SelectedRows.Count == 0)
  4450. {
  4451. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectthedatatobedeleted.text")+"!");
  4452. return;
  4453. }
  4454. DialogResult dt = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretcteddata.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  4455. if (dt == DialogResult.OK)
  4456. {
  4457. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString().Replace("相", string.Empty);
  4458. if (bitDic1.ContainsKey(tag))
  4459. bitDic1.Remove(tag);
  4460. if (this.dataGridView1.Rows.Count > 0)
  4461. {
  4462. this.p1RectangleFs.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
  4463. this.p2RectangleFs.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
  4464. }
  4465. else
  4466. {
  4467. this.p1RectangleFs.RemoveAt(0);
  4468. this.p2RectangleFs.RemoveAt(0);
  4469. }
  4470. this.dataGridView1.Rows.Remove(this.dataGridView1.SelectedRows[0]);
  4471. this.saveSuccess = true;
  4472. this.documentWorkspace.Refresh();
  4473. }
  4474. }
  4475. /// <summary>
  4476. /// 清空相
  4477. /// </summary>
  4478. /// <param name="sender"></param>
  4479. /// <param name="e"></param>
  4480. private void but_Clear_Click(object sender, EventArgs e)
  4481. {
  4482. if (this.dataGridView1.Rows.Count == 0)
  4483. {
  4484. MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
  4485. return;
  4486. }
  4487. 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);
  4488. string key = tag.Substring(0, tag.IndexOf("|"));
  4489. DialogResult dt = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretocleardata?.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  4490. if (dt == DialogResult.OK)
  4491. {
  4492. this.dataGridView1.Rows.Clear();
  4493. this.p1RectangleFs.Clear();
  4494. this.p2RectangleFs.Clear();
  4495. for (int i = 0; i < bitDic1.Count; i++)
  4496. {
  4497. foreach (var item in bitDic1)
  4498. {
  4499. string keyDe = item.Key.Substring(0, item.Key.IndexOf("|"));
  4500. if(key.Equals(keyDe))
  4501. {
  4502. bitDic1.Remove(item.Key);
  4503. break;
  4504. }
  4505. }
  4506. }
  4507. this.documentWorkspace.Refresh();
  4508. }
  4509. }
  4510. /// <summary>
  4511. /// 保存结果
  4512. /// </summary>
  4513. /// <param name="sender"></param>
  4514. /// <param name="e"></param>
  4515. private void button2_Click(object sender, EventArgs e)
  4516. {
  4517. SaveMeasurementResults();
  4518. }
  4519. /// <summary>
  4520. /// 保存结果
  4521. /// </summary>
  4522. private void SaveMeasurementResults()
  4523. {
  4524. if (this.listView1.SelectedItems.Count == 0)
  4525. {
  4526. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
  4527. return;
  4528. }
  4529. string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
  4530. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
  4531. if (this.dataGridView1.Rows.Count == 0)
  4532. {
  4533. MessageBox.Show(PdnResources.GetString("Menu.Pleaseaddaphoto.text")+"!");
  4534. return;
  4535. }
  4536. //int count = 0;
  4537. //foreach (var item in this.p1RectangleFs)
  4538. //{
  4539. // count += item.Count;
  4540. //}
  4541. //foreach (var item in this.p2RectangleFs)
  4542. //{
  4543. // count += item.Count;
  4544. //}
  4545. //if (count == 0)
  4546. //{
  4547. // MessageBox.Show(PdnResources.GetString("Menu.Pleaseadaintercept.Text")+"!");
  4548. // return;
  4549. //}
  4550. DataTable dataTable1 = new DataTable();
  4551. bool replace = false;
  4552. int add = 0;
  4553. foreach (ListViewItem item in this.listView2.Items)
  4554. {
  4555. if (item.Tag.Equals(tag))
  4556. {
  4557. add++;
  4558. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Themeasurementdertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  4559. if (dr == DialogResult.OK)
  4560. {
  4561. replace = true;
  4562. this.listView2.Items.Remove(item);
  4563. }
  4564. break;
  4565. }
  4566. }
  4567. if (replace || this.listView2.Items.Count == 0 || add == 0)
  4568. {
  4569. ListViewItem listViewItem = new ListViewItem();
  4570. listViewItem.SubItems[0].Text = imgName;
  4571. listViewItem.Tag = tag;
  4572. if (this.listView2.Items.Count == 0)
  4573. this.listView2.Items.Add(listViewItem);
  4574. else
  4575. this.listView2.Items.Insert(0, listViewItem);
  4576. dataTable1.TableName = tag;
  4577. this.dataGridView4.Rows.Clear();
  4578. foreach (DataGridViewRow Row in this.dataGridView1.Rows)
  4579. {
  4580. DataGridViewRow dgvr = new DataGridViewRow();
  4581. dgvr.Tag = tag;
  4582. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  4583. {
  4584. dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
  4585. }
  4586. dgvr.Cells[0].Value = imgName;
  4587. dgvr.Cells[1].Value = Row.Cells[0].Value;
  4588. dgvr.Cells[2].Value = Row.Cells[1].Value;
  4589. dgvr.Cells[3].Value = Row.Cells[2].Value;
  4590. dgvr.Cells[4].Value = Row.Cells[3].Value;
  4591. dgvr.Cells[5].Value = Row.Cells[4].Value;
  4592. dgvr.Cells[6].Value = Row.Cells[5].Value;
  4593. dgvr.Cells[7].Value = Row.Cells[6].Value;
  4594. dgvr.Cells[8].Value = Row.Cells[7].Value;
  4595. this.dataGridView4.Rows.Add(dgvr);
  4596. }
  4597. foreach (DataTable dataTable2 in pictureDataTables)
  4598. {
  4599. if (dataTable2.TableName.Equals(dataTable1.TableName))
  4600. {
  4601. pictureDataTables.Remove(dataTable2);
  4602. break;
  4603. }
  4604. }
  4605. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  4606. {
  4607. dataTable1.Columns.Add(c.HeaderText);
  4608. }
  4609. for (int r = 0; r < this.dataGridView1.Rows.Count; r++)
  4610. {
  4611. DataRow dataRow = dataTable1.NewRow();
  4612. for (int c = 0; c < this.dataGridView1.Rows[r].Cells.Count + 1; c++)
  4613. {
  4614. if(c == 0)
  4615. dataRow[this.dataGridView4.Columns[c].HeaderText] = imgName;
  4616. else
  4617. {
  4618. if(c == this.dataGridView1.Rows[r].Cells.Count)
  4619. {
  4620. double percentage = 0;
  4621. if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
  4622. {
  4623. percentage = (Convert.ToDouble(p2RectangleFs[r].Count) / (Convert.ToDouble(p1RectangleFs[r].Count) + Convert.ToDouble(p2RectangleFs[r].Count))) * 100;
  4624. if(double.IsNaN(percentage))
  4625. percentage = 0;
  4626. }
  4627. dataRow[this.dataGridView4.Columns[c].HeaderText] = percentage;
  4628. }
  4629. else if (c == this.dataGridView1.Rows[r].Cells.Count - 1)
  4630. {
  4631. double percentage = 0;
  4632. if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
  4633. {
  4634. percentage = (Convert.ToDouble(p1RectangleFs[r].Count) / (Convert.ToDouble(p1RectangleFs[r].Count) + Convert.ToDouble(p2RectangleFs[r].Count))) * 100;
  4635. if (double.IsNaN(percentage))
  4636. percentage = 0;
  4637. }
  4638. dataRow[this.dataGridView4.Columns[c].HeaderText] = percentage;
  4639. }
  4640. else if (c == this.dataGridView1.Rows[r].Cells.Count - 2)
  4641. {
  4642. double percentage = 0;
  4643. if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
  4644. {
  4645. percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[r].Cells[2].Value)
  4646. + Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[r].Cells[3].Value) * 0.5))
  4647. / Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value)) * 100;
  4648. if (double.IsNaN(percentage))
  4649. percentage = 0;
  4650. }
  4651. dataRow[this.dataGridView4.Columns[c].HeaderText] = percentage;
  4652. }
  4653. else
  4654. dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView1.Rows[r].Cells[c - 1].Value;
  4655. }
  4656. }
  4657. dataTable1.Rows.Add(dataRow);
  4658. }
  4659. this.pictureDataTables.Add(dataTable1);
  4660. this.bitDic.Clear();
  4661. foreach (var item in this.bitDic1)
  4662. {
  4663. this.bitDic.Add(item.Key, item.Value);
  4664. }
  4665. //拼接中间数据
  4666. List<List<string>> dataList = new List<List<string>>();
  4667. List<string> columnName = new List<string>();
  4668. columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
  4669. foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
  4670. {
  4671. columnName.Add(Column.HeaderText);
  4672. }
  4673. dataList.Add(columnName);
  4674. for (int r = 0; r < this.dataGridView1.Rows.Count; r++)
  4675. {
  4676. List<string> strList = new List<string>();
  4677. strList.Add((r + 1).ToString());
  4678. for (int c = 0; c < this.dataGridView1.Rows[r].Cells.Count + 1; c++)
  4679. {
  4680. if (c == 0)
  4681. strList.Add(imgName);
  4682. else
  4683. {
  4684. if (c == this.dataGridView1.Rows[r].Cells.Count)
  4685. {
  4686. double percentage = 0;
  4687. if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
  4688. {
  4689. percentage = (Convert.ToDouble(p2RectangleFs[r].Count) / (Convert.ToDouble(p1RectangleFs[r].Count) + Convert.ToDouble(p2RectangleFs[r].Count))) * 100;
  4690. }
  4691. strList.Add(percentage.ToString());
  4692. }
  4693. else if (c == this.dataGridView1.Rows[r].Cells.Count - 1)
  4694. {
  4695. double percentage = 0;
  4696. if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
  4697. {
  4698. percentage = (Convert.ToDouble(p1RectangleFs[r].Count) / (Convert.ToDouble(p1RectangleFs[r].Count) + Convert.ToDouble(p2RectangleFs[r].Count))) * 100;
  4699. }
  4700. strList.Add(percentage.ToString());
  4701. }
  4702. else if (c == this.dataGridView1.Rows[r].Cells.Count - 2)
  4703. {
  4704. double percentage = 0;
  4705. if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
  4706. {
  4707. percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[r].Cells[2].Value)
  4708. + Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[r].Cells[3].Value) * 0.5))
  4709. / Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value)) * 100;
  4710. }
  4711. strList.Add(percentage.ToString());
  4712. }
  4713. else
  4714. strList.Add(this.dataGridView1.Rows[r].Cells[c - 1].Value.ToString());
  4715. }
  4716. }
  4717. dataList.Add(strList);
  4718. }
  4719. bool isExist = false;//是否已存在进行替换
  4720. int modelIndex = -1;//要替换的下标
  4721. for (int j = 0; j < tempDataModel.Count; j++)
  4722. {
  4723. if (tempDataModel[j].tagName.Equals(tag))
  4724. {
  4725. isExist = true;
  4726. modelIndex = j;
  4727. break;
  4728. }
  4729. }
  4730. if (isExist && modelIndex > -1)
  4731. tempDataModel[modelIndex].dataList = dataList;
  4732. else
  4733. {
  4734. ExportProjectModel newModel = new ExportProjectModel();
  4735. newModel.tagName = tag;
  4736. newModel.picName = imgName;
  4737. newModel.dataList = dataList;
  4738. tempDataModel.Add(newModel);
  4739. }
  4740. if (this.allShow)
  4741. AllShow();
  4742. this.listView2.Items[0].Selected = true;
  4743. this.saveSuccess = false;
  4744. switchImg = true;
  4745. }
  4746. }
  4747. /// <summary>
  4748. /// 导出结果
  4749. /// </summary>
  4750. /// <param name="sender"></param>
  4751. /// <param name="e"></param>
  4752. private void button14_Click(object sender, EventArgs e)
  4753. {
  4754. if (this.listView2.Items.Count > 0)
  4755. {
  4756. SaveFileDialog exe = new SaveFileDialog();
  4757. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  4758. exe.FilterIndex = 0;
  4759. exe.RestoreDirectory = true;
  4760. exe.Title = "Export Excel File";
  4761. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  4762. exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.QuantitativeAnalysis.Text")+ PdnResources.GetString("Menu.Analysisresult.text");
  4763. DialogResult dr = exe.ShowDialog();
  4764. if (dr == DialogResult.OK)
  4765. {
  4766. DataTable dtb = new DataTable();
  4767. foreach (DataGridViewColumn c in this.dataGridView4.Columns)
  4768. {
  4769. dtb.Columns.Add(c.HeaderText);
  4770. }
  4771. for (int r = 0; r < this.dataGridView4.Rows.Count; r++)
  4772. {
  4773. DataRow dataRow = dtb.NewRow();
  4774. for (int c = 0; c < this.dataGridView4.Rows[r].Cells.Count; c++)
  4775. {
  4776. dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView4.Rows[r].Cells[c].Value;
  4777. }
  4778. dtb.Rows.Add(dataRow);
  4779. }
  4780. List<DataTable> list = new List<DataTable>();
  4781. list.Add(dtb);
  4782. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
  4783. }
  4784. }
  4785. else
  4786. {
  4787. MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
  4788. }
  4789. }
  4790. /// <summary>
  4791. /// 不可点击空白区域
  4792. /// </summary>
  4793. /// <param name="sender"></param>
  4794. /// <param name="e"></param>
  4795. private void listView1_MouseUp(object sender, MouseEventArgs e)
  4796. {
  4797. if (e.Button == MouseButtons.Left)
  4798. {
  4799. if (listView1.SelectedItems.Count > 0)
  4800. {
  4801. }
  4802. else if (listView1.SelectedItems.Count <= 0)//点击空白区
  4803. {
  4804. if (this.listView1.FocusedItem != null)
  4805. {
  4806. ListViewItem item = this.listView1.GetItemAt(e.X, e.Y);
  4807. if (item == null)
  4808. {
  4809. this.listView1.FocusedItem.Selected = true;
  4810. }
  4811. }
  4812. }
  4813. }
  4814. }
  4815. /// <summary>
  4816. /// 小数
  4817. /// </summary>
  4818. /// <param name="sender"></param>
  4819. /// <param name="e"></param>
  4820. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  4821. {
  4822. for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
  4823. {
  4824. double percentage = 0;
  4825. if (Convert.ToInt32(this.dataGridView1.Rows[i].Cells[4].Value) > 0)
  4826. {
  4827. percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[i].Cells[2].Value)
  4828. + Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[i].Cells[3].Value) * 0.5))
  4829. / Convert.ToInt32(this.dataGridView1.Rows[i].Cells[4].Value)) * 100;
  4830. if (double.IsNaN(percentage))
  4831. percentage = 0;
  4832. }
  4833. this.dataGridView1.Rows[i].Cells[5].Value = Math.Round(percentage, Convert.ToInt32(this.numericUpDown1.Value));
  4834. 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));
  4835. 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));
  4836. if (double.IsNaN(a))
  4837. this.dataGridView1.Rows[i].Cells[6].Value = 0;
  4838. else
  4839. 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));
  4840. if (double.IsNaN(b))
  4841. this.dataGridView1.Rows[i].Cells[7].Value = 0;
  4842. else
  4843. 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));
  4844. }
  4845. RefreshDataGridView4();
  4846. }
  4847. /// <summary>
  4848. /// 设置
  4849. /// </summary>
  4850. /// <param name="sender"></param>
  4851. /// <param name="e"></param>
  4852. private void button1_Click(object sender, EventArgs e)
  4853. {
  4854. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, template);
  4855. if (recombinationRateSetDialog.hasModule)
  4856. {
  4857. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  4858. recombinationRateSetDialog.ShowDialog();
  4859. }
  4860. else
  4861. {
  4862. recombinationRateSetDialog = null;
  4863. }
  4864. }
  4865. /// <summary>
  4866. /// 生成报告
  4867. /// </summary>
  4868. /// <param name="sender"></param>
  4869. /// <param name="e"></param>
  4870. private void button13_Click(object sender, EventArgs e)
  4871. {
  4872. if (this.checkBox3.Checked)
  4873. {
  4874. AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, template);
  4875. if (recombinationRateSetDialog.hasModule)
  4876. {
  4877. recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
  4878. recombinationRateSetDialog.ShowDialog();
  4879. }
  4880. else
  4881. {
  4882. recombinationRateSetDialog = null;
  4883. }
  4884. }
  4885. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  4886. {
  4887. //获取word书签与excel单元格的关系,以字典方式存储
  4888. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  4889. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  4890. if (mic_module_infos != null && mic_module_infos.Count > 0)
  4891. {
  4892. foreach (mic_module_infos info in mic_module_infos)
  4893. {
  4894. tagInfos.Add(info.tag_name, info.cell_position);
  4895. }
  4896. }
  4897. List<List<string>> analysisContent = new List<List<string>>();
  4898. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  4899. {
  4900. List<string> content1 = new List<string>();
  4901. if (i == 0)
  4902. {
  4903. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  4904. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  4905. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  4906. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  4907. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  4908. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  4909. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  4910. content1.Add(this.dataGridView4.Columns[7].HeaderText);
  4911. content1.Add(this.dataGridView4.Columns[8].HeaderText);
  4912. analysisContent.Add(content1);
  4913. }
  4914. content1 = new List<string>();
  4915. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  4916. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  4917. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  4918. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  4919. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  4920. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  4921. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  4922. content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString());
  4923. content1.Add(this.dataGridView4.Rows[i].Cells[8].Value.ToString());
  4924. analysisContent.Add(content1);
  4925. }
  4926. bitList = new List<Bitmap>();
  4927. if (this.allShow)
  4928. {
  4929. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  4930. {
  4931. bitList.Add(kv.Value[0]);
  4932. bitList.Add(kv.Value[1]);
  4933. }
  4934. }
  4935. else
  4936. {
  4937. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  4938. {
  4939. foreach (DataGridViewRow itemRow in this.dataGridView4.Rows)
  4940. {
  4941. foreach (ListViewItem item in this.listView2.SelectedItems)
  4942. {
  4943. if (bitDic.ContainsKey(item.Tag.ToString() + "|" + itemRow.Cells[2].Value.ToString().Replace("相" ,string.Empty)) && itemRow.Tag.Equals(item.Tag))
  4944. {
  4945. bitList.Add(bitDic[item.Tag.ToString() + "|" + itemRow.Cells[2].Value.ToString().Replace("相", string.Empty)][0]);
  4946. bitList.Add(bitDic[item.Tag.ToString() + "|" + itemRow.Cells[2].Value.ToString().Replace("相", string.Empty)][1]);
  4947. }
  4948. }
  4949. }
  4950. }
  4951. }
  4952. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  4953. }
  4954. else
  4955. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  4956. }
  4957. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  4958. {
  4959. this.documentWorkspace.Refresh();
  4960. }
  4961. private void button8_Click(object sender, EventArgs e)
  4962. {
  4963. try
  4964. {
  4965. if (this.analyzeSettingModel == null)
  4966. {
  4967. MessageBox.Show(PdnResources.GetString("Menu.Settheexporteitemfirst.Text"));
  4968. return;
  4969. }
  4970. //获取项目工程内的文件夹路径
  4971. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.QuantitativeAnalysis.Text", this.analyzeSettingModel.savePath);
  4972. if (item != null)
  4973. {
  4974. //向文件夹内保存图片和报告
  4975. if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  4976. {
  4977. //获取word书签与excel单元格的关系,以字典方式存储
  4978. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  4979. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  4980. if (mic_module_infos != null && mic_module_infos.Count > 0)
  4981. {
  4982. foreach (mic_module_infos info in mic_module_infos)
  4983. {
  4984. tagInfos.Add(info.tag_name, info.cell_position);
  4985. }
  4986. }
  4987. //分析结果
  4988. List<List<string>> analysisContent = new List<List<string>>();
  4989. for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
  4990. {
  4991. List<string> content1 = new List<string>();
  4992. if (i == 0)
  4993. {
  4994. content1.Add(this.dataGridView4.Columns[0].HeaderText);
  4995. content1.Add(this.dataGridView4.Columns[1].HeaderText);
  4996. content1.Add(this.dataGridView4.Columns[2].HeaderText);
  4997. content1.Add(this.dataGridView4.Columns[3].HeaderText);
  4998. content1.Add(this.dataGridView4.Columns[4].HeaderText);
  4999. content1.Add(this.dataGridView4.Columns[5].HeaderText);
  5000. content1.Add(this.dataGridView4.Columns[6].HeaderText);
  5001. content1.Add(this.dataGridView4.Columns[7].HeaderText);
  5002. content1.Add(this.dataGridView4.Columns[8].HeaderText);
  5003. analysisContent.Add(content1);
  5004. }
  5005. content1 = new List<string>();
  5006. content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
  5007. content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
  5008. content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
  5009. content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
  5010. content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
  5011. content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
  5012. content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
  5013. content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString());
  5014. content1.Add(this.dataGridView4.Rows[i].Cells[8].Value.ToString());
  5015. analysisContent.Add(content1);
  5016. }
  5017. bitList = new List<Bitmap>();
  5018. if (this.allShow)
  5019. {
  5020. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  5021. {
  5022. bitList.Add(kv.Value[0]);
  5023. bitList.Add(kv.Value[1]);
  5024. }
  5025. }
  5026. else
  5027. {
  5028. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  5029. {
  5030. foreach (DataGridViewRow itemRow in this.dataGridView4.Rows)
  5031. {
  5032. foreach (ListViewItem itemL2 in this.listView2.SelectedItems)
  5033. {
  5034. if (bitDic.ContainsKey(itemL2.Tag.ToString() + "|" + itemRow.Cells[2].Value.ToString().Replace("相", string.Empty)))
  5035. {
  5036. bitList.Add(bitDic[itemL2.Tag.ToString() + "|" + itemRow.Cells[2].Value.ToString().Replace("相", string.Empty)][0]);
  5037. bitList.Add(bitDic[itemL2.Tag.ToString() + "|" + itemRow.Cells[2].Value.ToString().Replace("相", string.Empty)][1]);
  5038. }
  5039. }
  5040. }
  5041. }
  5042. }
  5043. //中间数据
  5044. if (!this.allShow)
  5045. {
  5046. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  5047. {
  5048. List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
  5049. foreach (ListViewItem rowItem in this.listView2.SelectedItems)
  5050. {
  5051. foreach (ExportProjectModel model in this.tempDataModel)
  5052. {
  5053. if (model.tagName.Equals(rowItem.Tag))
  5054. {
  5055. ExportProjectModel tempModel = new ExportProjectModel();
  5056. tempModel.tagName = model.tagName;
  5057. tempModel.picName = model.picName;
  5058. tempModel.dataList = model.dataList;
  5059. exportModel.Add(tempModel);
  5060. break;
  5061. }
  5062. }
  5063. }
  5064. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);
  5065. }
  5066. }
  5067. else
  5068. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, item.path, item.code);
  5069. }
  5070. else
  5071. {
  5072. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  5073. return;
  5074. }
  5075. //保存项目信息到数据库
  5076. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  5077. }
  5078. }
  5079. catch (Exception)
  5080. {
  5081. }
  5082. }
  5083. private void QuantitativeAnalysisDialog_FormClosing(object sender, FormClosingEventArgs e)
  5084. {
  5085. #region [开启脚本录制]
  5086. if (appWorkspace.startScriptRecording)
  5087. {
  5088. getScriptRecording();
  5089. }
  5090. #endregion
  5091. binaryClass.saveParams();
  5092. this.saveDialogParamValues();
  5093. //xml保存路径
  5094. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  5095. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  5096. foreach (var analysisItem in this.analysisModel.ListParam)
  5097. {
  5098. bool foundItem = false;
  5099. foreach (var item in analysisModelXml.ListParam)
  5100. {
  5101. if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
  5102. {
  5103. item.param_value = analysisItem.param_value;
  5104. foundItem = true;
  5105. break;
  5106. }
  5107. }
  5108. if (!foundItem)
  5109. analysisModelXml.ListParam.Add(analysisItem.cloneModel());
  5110. }
  5111. //按路径和名称保存xml文件
  5112. string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
  5113. //保存xml
  5114. FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
  5115. }
  5116. private void radioButton1_CheckedChanged(object sender, EventArgs e)
  5117. {
  5118. this.documentWorkspace.Refresh();
  5119. }
  5120. private void radioButton2_CheckedChanged(object sender, EventArgs e)
  5121. {
  5122. this.documentWorkspace.Refresh();
  5123. }
  5124. #region 参数保存及提取
  5125. /// <summary>
  5126. /// 保存参数的key,value和type
  5127. /// </summary>
  5128. /// <param name="param_key"></param>
  5129. /// <param name="param_value"></param>
  5130. /// <param name="param_type"></param>
  5131. private void saveParamValue(string param_key, string param_value, int param_type)
  5132. {
  5133. bool foundItem = false;
  5134. foreach (var item in this.analysisModel.ListParam)
  5135. {
  5136. if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
  5137. {
  5138. item.param_value = param_value;
  5139. item.setValue();
  5140. foundItem = true;
  5141. break;
  5142. }
  5143. }
  5144. if (!foundItem)
  5145. {
  5146. GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
  5147. analysisItem.menuId = this.menuId;
  5148. analysisItem.param_key = param_key;
  5149. analysisItem.param_type = param_type;
  5150. analysisItem.param_value = param_value;
  5151. analysisItem.setValue();
  5152. this.analysisModel.ListParam.Add(analysisItem);
  5153. }
  5154. }
  5155. /// <summary>
  5156. /// 保存界面中的参数到model
  5157. /// </summary>
  5158. private void saveDialogParamValues()
  5159. {
  5160. saveParamValue(ParamKey_GridUse, comboBox1.Text, (int)Base.Dtryt.ItemString);//使用网格
  5161. saveParamValue(ParamKey_GridMove, checkBox4.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//网格移动
  5162. saveParamValue(ParamKey_Report, checkBox3.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//报告设置
  5163. saveParamValue(ParamKey_GridStyle, radioButton1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//网格样式
  5164. saveParamValue(ParamKey_GridDefault, radioButton2.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//默认网格
  5165. saveParamValue(ParamKey_OneCircular, rb_LeftCircle.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//1点圆形
  5166. saveParamValue(ParamKey_OneSquare, rb_LeftSquare.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//1点方形
  5167. saveParamValue(ParamKey_OneSolid, rb_leftFill.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//1点实心
  5168. saveParamValue(ParamKey_OneHollow, rb_leftNoFill.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//1点空心
  5169. saveParamValue(ParamKey_OneSize, txt_LeftSize.Text, (int)Base.Dtryt.ItemString);//1点尺寸
  5170. saveParamValue(ParamKey_OneWidth, txt_LeftLineWeight.Text, (int)Base.Dtryt.ItemString);//1点线宽
  5171. saveParamValue(ParamKey_OneColour, panel1.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//1点颜色
  5172. saveParamValue(ParamKey_HalfCircular, rb_RightCircle.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//0.5点圆形
  5173. saveParamValue(ParamKey_HalfSquare, rb_RightSquare.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//0.5点方形
  5174. saveParamValue(ParamKey_HalfSolid, rb_RightFill.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//0.5点实心
  5175. saveParamValue(ParamKey_HalfHollow, rb_RightNoFill.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//0.5点空心
  5176. saveParamValue(ParamKey_HalfSize, txt_RightSize.Text, (int)Base.Dtryt.ItemString);//0.5点尺寸
  5177. saveParamValue(ParamKey_HalfWidth, txt_RightLineWeight.Text, (int)Base.Dtryt.ItemString);//0.5点线宽
  5178. saveParamValue(ParamKey_HalfColour, panel2.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//0.5点颜色
  5179. saveParamValue(ParamKey_DecimalPlace, numericUpDown1 != null ? numericUpDown1.Value.ToString() : "", (int)Base.Dtryt.Decimal);//保留小数位数
  5180. }
  5181. /// <summary>
  5182. /// 获取保存的参数
  5183. /// </summary>
  5184. private void GetListParamModel()
  5185. {
  5186. if (this.analysisModel != null)
  5187. {
  5188. for (int i = 0; i < this.analysisModel.ListParam.Count; i++)
  5189. {
  5190. switch (this.analysisModel.ListParam[i].param_key)
  5191. {
  5192. case ParamKey_GridUse:
  5193. comboBox1.Text = (string)this.analysisModel.ListParam[i].value;
  5194. break;
  5195. case ParamKey_GridMove:
  5196. checkBox4.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  5197. break;
  5198. case ParamKey_Report:
  5199. checkBox3.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  5200. break;
  5201. case ParamKey_GridStyle:
  5202. radioButton1.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  5203. break;
  5204. case ParamKey_GridDefault:
  5205. radioButton2.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  5206. break;
  5207. case ParamKey_OneCircular:
  5208. rb_LeftCircle.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  5209. break;
  5210. case ParamKey_OneSquare:
  5211. rb_LeftSquare.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  5212. break;
  5213. case ParamKey_OneSolid:
  5214. rb_leftFill.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  5215. break;
  5216. case ParamKey_OneHollow:
  5217. rb_leftNoFill.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  5218. break;
  5219. case ParamKey_OneSize:
  5220. txt_LeftSize.Text = (string)this.analysisModel.ListParam[i].value;
  5221. break;
  5222. case ParamKey_OneWidth:
  5223. txt_LeftLineWeight.Text = (string)this.analysisModel.ListParam[i].value;
  5224. break;
  5225. case ParamKey_OneColour:
  5226. panel1.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
  5227. break;
  5228. case ParamKey_HalfCircular:
  5229. rb_RightCircle.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  5230. break;
  5231. case ParamKey_HalfSquare:
  5232. rb_RightSquare.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  5233. break;
  5234. case ParamKey_HalfSolid:
  5235. rb_RightFill.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  5236. break;
  5237. case ParamKey_HalfHollow:
  5238. rb_RightNoFill.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  5239. break;
  5240. case ParamKey_HalfSize:
  5241. txt_RightSize.Text = (string)this.analysisModel.ListParam[i].value;
  5242. break;
  5243. case ParamKey_HalfWidth:
  5244. txt_RightLineWeight.Text = (string)this.analysisModel.ListParam[i].value;
  5245. break;
  5246. case ParamKey_HalfColour:
  5247. panel2.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
  5248. break;
  5249. case ParamKey_DecimalPlace:
  5250. numericUpDown1.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
  5251. break;
  5252. }
  5253. }
  5254. }
  5255. }
  5256. #endregion
  5257. #region [脚本相关]
  5258. private void getValue(string key, object value)
  5259. {
  5260. switch (key)
  5261. {
  5262. case "parameter1":
  5263. comboBox1.SelectedIndex = (int)value;
  5264. break;
  5265. case "parameter2":
  5266. checkBox4.Checked = Convert.ToBoolean(value);
  5267. break;
  5268. case "OpenWhileExportReport":
  5269. checkBox3.Checked = Convert.ToBoolean(value);
  5270. break;
  5271. case "CalculatorDecimalDigits":
  5272. numericUpDown1.Value = Convert.ToDecimal(value);
  5273. break;
  5274. }
  5275. }
  5276. #endregion
  5277. #region [脚本录制]
  5278. private void getScriptRecording()
  5279. {
  5280. string className = InvariantData.path_Action + ".Action" + menuId;
  5281. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  5282. List<Args> args = param.Lists;
  5283. foreach (var item in args)
  5284. {
  5285. item.value = setScriptRecording(item.key);
  5286. }
  5287. //找出二值相关参数 进行赋值
  5288. List<Args> isNullList = args.Where(m => m.value == null).ToList();
  5289. foreach (var item in isNullList)
  5290. {
  5291. item.value = binaryClass.setScriptRecording(item.key);
  5292. }
  5293. appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
  5294. }
  5295. private object setScriptRecording(string key)
  5296. {
  5297. object value = null;
  5298. switch (key)
  5299. {
  5300. case "parameter1":
  5301. value = comboBox1.SelectedIndex;
  5302. break;
  5303. case "parameter2":
  5304. value = checkBox4.Checked;
  5305. break;
  5306. case "OpenWhileExportReport":
  5307. value = checkBox3.Checked;
  5308. break;
  5309. case "CalculatorDecimalDigits":
  5310. value = numericUpDown1.Value;
  5311. break;
  5312. case "ExportResults":
  5313. value = false;
  5314. break;
  5315. case "ExportReports":
  5316. value = false;
  5317. break;
  5318. case "ExportProjects":
  5319. value = false;
  5320. break;
  5321. }
  5322. return value;
  5323. }
  5324. #endregion
  5325. }
  5326. }