BandedTissueDialog.cs 265 KB

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