1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428 |
- using OpenCvSharp;
- using OpenCvSharp.Extensions;
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Base;
- using PaintDotNet.Base.CommTool;
- using PaintDotNet.Base.Enum;
- using PaintDotNet.Base.Functionodel;
- using PaintDotNet.Base.SettingModel;
- using PaintDotNet.CustomControl;
- using PaintDotNet.Data.Param;
- using PaintDotNet.DbOpreate.DbBll;
- using PaintDotNet.DbOpreate.DbModel;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using Point = System.Drawing.Point;
- using static PaintDotNet.Base.DedicatedAnalysis.Inclusions.MethodOfAssessment;
- using PaintDotNet.Annotation;
- using PaintDotNet.Instrument;
- using Metis.ParameterSet;
- namespace PaintDotNet.DedicatedAnalysis.QuantitativeAnalysis
- {
- /// <summary>
- /// 定量分析
- /// </summary>
- internal class QuantitativeAnalysisDialog : PdnBaseForm
- {
- #region 控件
- private GroupBox groupBox1;
- private Button button2;
- private Label label1;
- private Button button6;
- private Button button5;
- private Button button4;
- private Button button3;
- private ComboBox comboBox1;
- private ListView listView1;
- private GroupBox groupBox2;
- private ImageList imageList1;
- private IContainer components;
- private GroupBox groupBox8;
- private ListView listView2;
- private NumericUpDown numericUpDown1;
- private Button button16;
- private Label label5;
- private Button button14;
- private Button button13;
- private Button button12;
- private Button button11;
- private GroupBox groupBox7;
- private GroupBox groupBox4;
- private Label label12;
- private Label label11;
- private Label label10;
- private Label label9;
- private Label label8;
- private Label label7;
- private CheckBox checkBox2;
- private TextBox textBox5;
- private TextBox textBox4;
- private TextBox textBox3;
- private TextBox textBox2;
- private NumericUpDown numericUpDown4;
- private GroupBox groupBox5;
- private Panel panel2;
- private GroupBox groupBox6;
- private Label label13;
- private RadioButton rb_RightNoFill;
- private RadioButton rb_RightFill;
- private Label label14;
- private TextBox txt_RightLineWeight;
- private Label label15;
- private TextBox txt_RightSize;
- private Label label16;
- private RadioButton rb_RightSquare;
- private RadioButton rb_RightCircle;
- private Label label17;
- private GroupBox groupBox10;
- private GroupBox groupBox11;
- private Label label18;
- private RadioButton rb_leftNoFill;
- private RadioButton rb_leftFill;
- private Panel panel1;
- private Label label19;
- private TextBox txt_LeftLineWeight;
- private Label label20;
- private TextBox txt_LeftSize;
- private Label label21;
- private RadioButton rb_LeftSquare;
- private RadioButton rb_LeftCircle;
- private Label label22;
- private GroupBox groupBox9;
- private Button But_DelPhase;
- private Button but_AddPhase;
- private Button but_Clear;
- private DataGridView dataGridView1;
- private Button button1;
- private CheckBox checkBox3;
- private Panel panel4;
- private Button button7;
- #endregion
- /// <summary>
- /// 处理程序
- /// </summary>
- private ParamObject action = new Data.Action.Action1010();
- /// <summary>
- /// 选中图片的mat
- /// </summary>
- private Mat imageMat;
- /// <summary>
- /// 存在视场标记
- /// </summary>
- private bool existViewFlag = false;
- /// <summary>
- /// 是否选择了图片
- /// </summary>
- private bool selectPicture = false;
- /// <summary>
- /// 当前选择的图片
- /// </summary>
- private Mat mat;
- /// <summary>
- /// 主控件
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 数据变化
- /// </summary>
- private bool saveSuccess = false;
- /// <summary>
- /// 中间数据
- /// </summary>
- private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
- /// <summary>
- /// 所有截点
- /// </summary>
- public List<List<RectangleF>> p1RectangleFs = new List<List<RectangleF>>();
- public List<List<RectangleF>> p2RectangleFs = new List<List<RectangleF>>();
- /// <summary>
- /// 图像面板
- /// </summary>
- private DocumentWorkspaceWindow documentWorkspace;
- /// <summary>
- /// 公共控件
- /// </summary>
- private GeneralAnalysisCommonControlButtons commonControlButtons;
- /// <summary>
- /// 调色板
- /// </summary>
- PaintDotNet.ColorsForm colorsForm1;
- /// <summary>
- /// 调色板
- /// </summary>
- PaintDotNet.ColorsForm colorsForm2;
- /// <summary>
- /// 调色板
- /// </summary>
- PaintDotNet.ColorsForm colorsForm3;
- /// <summary>
- /// 调色板
- /// </summary>
- PaintDotNet.ColorsForm colorsForm4;
- #region 网格样式
- /// <summary>
- /// 水平数量
- /// </summary>
- private int hNumber;
- /// <summary>
- /// 垂直数量
- /// </summary>
- private int vNumber;
- /// <summary>
- /// 网格线宽
- /// </summary>
- private int gridWidth;
- /// <summary>
- /// 网格间距
- /// </summary>
- private int gridSpacing;
- /// <summary>
- /// 网格颜色
- /// </summary>
- private int gridColor;
- /// <summary>
- /// 全图 true:全图 false:非全图
- /// </summary>
- private bool wholePicture;
- /// <summary>
- /// 开始测量
- /// </summary>
- private bool startText = false;
- /// <summary>
- /// 余白
- /// </summary>
- private float blank;
- #endregion
- /// <summary>
- /// 网格交点
- /// </summary>
- private List<RectangleF> rectangleFs = new List<RectangleF>();
- /// <summary>
- /// 图片测量记录
- /// </summary>
- private List<DataTable> pictureDataTables = new List<DataTable>();
- /// <summary>
- /// 是否全部显示
- /// </summary>
- private bool allShow = false;
- /// <summary>
- /// 超出尺寸
- /// </summary>
- private bool exceed;
- /// <summary>
- /// 网格Xml
- /// </summary>
- private QuantitativeAnalysisModel quantitativeAnalysisModel;
- /// <summary>
- /// 网格绘制区域
- /// </summary>
- private float minX;
- private float maxX;
- private float minY;
- private float maxY;
- /// <summary>
- /// 保存用于生成报告的图片
- /// </summary>
- private List<Bitmap> bitList;
- /// <summary>
- /// 切换图片
- /// </summary>
- private bool switchImg;
- private bool canMove = false;
- private PointF oldLocation = new PointF();
- private bool selected = false;
- /// <summary>
- /// 是否要调用二值化的算法
- /// </summary>
- private bool toApplyBinary = true;
- /// <summary>
- /// 储存点击保存结果后的所有原图与分析图
- /// </summary>
- private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
- private Dictionary<string, List<Bitmap>> bitDic1 = new Dictionary<string, List<Bitmap>>();
- private CheckBox checkBox4;
- private Button button8;
- private int changeCount;
- /// <summary>
- /// 参数下拉的集合
- /// </summary>
- private List<string> files = new List<string>();
- private BinaryControl bc;
- //二值化集成1
- BinaryClass binaryClass;
- private int menuId;
- private string menuName;
- /// <summary>
- /// 不同标准的模板
- /// </summary>
- private string template;
- private DataGridView dataGridView4;
- private Label label2;
- private RadioButton radioButton2;
- private RadioButton radioButton1;
- private DataGridViewTextBoxColumn Column1;
- private DataGridViewTextBoxColumn Column2;
- private DataGridViewTextBoxColumn Column3;
- private DataGridViewTextBoxColumn Column4;
- private DataGridViewTextBoxColumn Column5;
- private DataGridViewTextBoxColumn Column6;
- private DataGridViewTextBoxColumn Column7;
- private DataGridViewTextBoxColumn Column10;
- private DataGridViewTextBoxColumn Column12;
- private DataGridViewTextBoxColumn Column11;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
- private DataGridViewTextBoxColumn Column8;
- private DataGridViewTextBoxColumn Column9;
- private ToolTip toolTip1;
- /// <summary>
- /// 是否脚本运行
- /// </summary>
- private Boolean initScriptValues = false;
- /// <summary>
- /// 标尺
- /// </summary>
- private double unitLength;
- private int defaultIndex = -1;
- /// <summary>
- /// 保存窗口参数
- /// </summary>
- private GrainSizeAnalysisModel analysisModel;
- private const string ParamKey_GridUse = "gridUse";//使用网格
- private const string ParamKey_GridMove = "gridMove";//网格移动
- private const string ParamKey_Report = "report";//报告设置
- private const string ParamKey_GridStyle = "gridStyle";//网格样式
- private const string ParamKey_GridDefault = "gridDefault";//默认网格
- private const string ParamKey_OneCircular = "oneCircular";//1点圆形
- private const string ParamKey_OneSquare = "oneSquare";//1点方形
- private const string ParamKey_OneSolid = "oneSolid";//1点实心
- private const string ParamKey_OneHollow = "oneHollow";//1点空心
- private const string ParamKey_OneSize = "oneSize";//1点尺寸
- private const string ParamKey_OneWidth = "oneWidth";//1点线宽
- private const string ParamKey_OneColour = "oneColour";//1点颜色
- private const string ParamKey_HalfCircular = "halfCircular";//0.5点圆形
- private const string ParamKey_HalfSquare = "halfSquare";//0.5点方形
- private const string ParamKey_HalfSolid = "halfSolid";//0.5点实心
- private const string ParamKey_HalfHollow = "halfHollow";//0.5点空心
- private const string ParamKey_HalfSize = "halfSize";//0.5点尺寸
- private const string ParamKey_HalfWidth = "halfWidth";//0.5点线宽
- private const string ParamKey_HalfColour = "halfColour";//0.5点颜色
- private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数
- public QuantitativeAnalysisDialog(AppWorkspace appWorkspace, string standardNumber, PdnMenuItem menuItem)
- {
- this.menuId = menuItem.MenuId;
- this.menuName = menuItem.Text;
- binaryClass = new BinaryClass(menuId);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- this.analysisModel = analysisModelXml.cloneListParamModel(this.menuId);
- foreach (var item in this.analysisModel.ListParam)
- item.setValue();
- InitializeComponent();
- InitializeLanguageText();
- this.Text = PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.QuantitativeAnalysis.Text");
- if (standardNumber.Equals("ASTME12452003"))
- {
- this.Text = PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.QuantitativeAnalysis.Text")+"_ASTME1245-2003";
- template = "Template.Manager.item3.RationASTME12452003";
- this.label2.Visible = false;
- this.radioButton1.Visible = false;
- this.radioButton2.Visible = false;
- }
- else if (standardNumber.Equals("ASTME11222002"))
- {
- this.Text = PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.QuantitativeAnalysis.Text")+"_ASTME1122-2002";
- template = "Template.Manager.item3.RationASTME11222002";
- this.label2.Visible = false;
- this.radioButton1.Visible = false;
- this.radioButton2.Visible = false;
- }
- else if (standardNumber.Equals("GBT188762002"))
- {
- this.Text = PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.QuantitativeAnalysis.Text")+"_GBT18876-2002";
- template = "Template.Manager.item3.RationGBT188762002";
- this.label2.Visible = false;
- this.radioButton1.Visible = false;
- this.radioButton2.Visible = false;
- }
- else if (standardNumber.Equals("ASTME56211"))
- {
- this.Text = PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.QuantitativeAnalysis.Text")+"_ASTME56211";
- template = "Template.Manager.item3.RationASTME56211";
- this.label2.Visible = true;
- this.radioButton1.Visible = true;
- this.radioButton2.Visible = true;
- }
- this.button7.Visible = false;
- this.button6.Visible = true;
- this.button11.Visible = true;
- this.button16.Visible = false;
- //调色板
- this.colorsForm1 = new ColorsForm();
- this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
- this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
- //调色板
- this.colorsForm2 = new ColorsForm();
- this.colorsForm2.StartPosition = FormStartPosition.CenterScreen;
- this.colorsForm2.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
- //调色板
- this.colorsForm3 = new ColorsForm();
- this.colorsForm3.StartPosition = FormStartPosition.CenterScreen;
- this.colorsForm3.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
- //调色板
- this.colorsForm4 = new ColorsForm();
- this.colorsForm4.StartPosition = FormStartPosition.CenterScreen;
- this.colorsForm4.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
- //初始化头
- this.listView2.View = View.Details;
- ColumnHeader header0 = new ColumnHeader();
- header0.Text = "";
- header0.Width = 180;
- this.listView2.Columns.Add(header0);
- this.appWorkspace = appWorkspace;
- this.documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
- this.documentWorkspace.Dock = DockStyle.Fill;
- this.documentWorkspace.HookMouseEvents();
- this.documentWorkspace.AuxiliaryLineEnabled = false;
- this.documentWorkspace.Visible = true;
- this.documentWorkspace.panel.Paint += Panel_Paint;
- this.documentWorkspace.panel.MouseDown += OnMouseDown;
- this.documentWorkspace.panel.Paint += Panel_Paint;
- this.documentWorkspace.panel.MouseUp += OnMouseUp;
- this.documentWorkspace.panel.MouseMove += onMouseMove;
- this.documentWorkspace.panel.PreviewKeyDown += onPreviewKeyDown;
- this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
- this.groupBox7.Controls.Add(this.documentWorkspace);
- this.commonControlButtons = new GeneralAnalysisCommonControlButtons();
- this.commonControlButtons.Dock = DockStyle.Top;
- this.commonControlButtons.Height = 30;
- this.commonControlButtons.HideZoomToWindowAndActualSize();
- this.commonControlButtons.trackLabel.Text = PdnResources.GetString("Menu.1point:clicktelete:doubleclick.text");
- this.commonControlButtons.trackLabel.Visible = true;
- this.commonControlButtons.trackLabel.Width = 300;
- this.commonControlButtons.Visible = false;
- this.groupBox7.Controls.Add(commonControlButtons);
- this.radioButton2.Checked = true;
- InitCommonButtonEvent();
- InitGridStyle();
- InitPicList();
- SetAnalyzeModelFromXml(template);
- //二值化集成2
- bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
- binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text"), PdnResources.GetString("Menu.Grainboundarytoreproduce.text") }
- , this.bc, this.appWorkspace, this.documentWorkspace, this.listView1);//初始化相的工作结构
- binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件
- //如果是脚本执行,将参数带入
- if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
- {
- this.initScriptValues = true;//ScriptAutomatic
- //Boolean initScriptValues = true;
- ////在这里反射出对应功能的参数类
- string className = InvariantData.path_Action + ".Action" + menuId;
- ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
- foreach (Args arg in param.Lists)
- {
- Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
- if (param1.value != null)
- arg.Value = param1.value;
- getValue(arg.key, arg.Value);
- }
- appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
- }
- else
- {//读取上次关闭窗口时保存的参数
- GetListParamModel();
- }
- for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
- {
- this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
- }
- for (int i = 0; i < this.dataGridView4.Columns.Count; i++)
- {
- this.dataGridView4.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
- }
- //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength);
- //this.radioButton2.Checked = true;
- }
- //二值化集成3
- #region 二值化相关方法
- private void ShownChoiseItemAndInitData(object sender, EventArgs e)
- {
- binaryClass.RefreshHistogramControl1Values();
- }
- /// <summary>
- /// 添加参数改变的监听
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void QuantitativeAnalysisDialog_Load(object sender, EventArgs e)
- {
- this.binaryClass.loadParams();
- }
- private bool bcBinaryChecked()
- {
- return bc != null && bc.BinaryChecked;
- }
- private bool bcOriginChecked()
- {
- return bc != null && bc.OriginChecked;
- }
- /// <summary>
- /// 参数改变时,重新处理图像
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bClassBinaryImplFinishAction(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 显示原图/原图+二值图
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void bcOriginCheckedChanged(object sender, EventArgs e)
- {
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- this.documentWorkspace.PhaseModels[0].choise = true;
- }
- else
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = false;
- }
- this.documentWorkspace.Refresh();
- }
- #endregion
- private void ShowImgEvent(object sender, EventArgs e)
- {
- listView1.Focus();
- if (this.defaultIndex != -1)
- {
- this.listView1.Items[defaultIndex].Focused = true;
- this.listView1.Items[defaultIndex].Selected = true;
- }
- }
- /// <summary>
- /// 初始化画面数据
- /// </summary>
- private void InitGridStyle()
- {
- quantitativeAnalysisModel = XmlSerializeHelper.DESerializer<QuantitativeAnalysisModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\QuantitativeAnalysisModel.xml", FileMode.Open));
- if (quantitativeAnalysisModel.GridStyleList != null)
- {
- ArrayList arrayList = new ArrayList();
- foreach (var GridStyle in quantitativeAnalysisModel.GridStyleList)
- {
- arrayList.Add(GridStyle.gridName);
- }
- this.comboBox1.DataSource = null;
- this.comboBox1.DataSource = arrayList;
- if(quantitativeAnalysisModel.GridStyleList.Count == 0)
- {
- this.textBox2.Text = "0";
- this.textBox3.Text = "0";
- this.textBox4.Text = "0";
- this.textBox5.Text = "0";
- this.numericUpDown4.Value = 0;
- this.checkBox2.Checked = false;
- this.label10.Visible = true;
- this.textBox5.Visible = true;
- this.label12.Visible = false;
- this.numericUpDown4.Visible = false;
- }
- }
- }
- /// <summary>
- /// 更新辅助线下拉并保存
- /// </summary>
- public void RefreshGridItems(string gridName)
- {
- if (!string.IsNullOrEmpty(gridName))
- {
- QuantitativeAnalysisModel.GridStyle gridStyle = new QuantitativeAnalysisModel.GridStyle();
- gridStyle.gridName = gridName;
- gridStyle.hNumber = Convert.ToInt32(this.textBox2.Text);
- gridStyle.vNumber = Convert.ToInt32(this.textBox3.Text);
- gridStyle.gridWidth = Convert.ToInt32(this.textBox4.Text);
- gridStyle.gridSpacing = Convert.ToInt32(this.textBox5.Text);
- gridStyle.gridColor = Convert.ToInt32(this.panel4.BackColor.ToArgb());
- gridStyle.wholePicture = this.checkBox2.Checked;
- gridStyle.blank = Convert.ToInt32(this.numericUpDown4.Value);
- if (this.quantitativeAnalysisModel.GridStyleList != null)
- this.quantitativeAnalysisModel.GridStyleList.Add(gridStyle);
- ArrayList arrayList = new ArrayList();
- foreach (var GridStyle in quantitativeAnalysisModel.GridStyleList)
- {
- arrayList.Add(GridStyle.gridName);
- }
- this.comboBox1.DataSource = null;
- this.comboBox1.DataSource = arrayList;
- this.comboBox1.SelectedIndex = this.comboBox1.Items.Count - 1;
- }
- else
- {
- if (this.quantitativeAnalysisModel.GridStyleList != null)
- {
- foreach (var GridStyle in this.quantitativeAnalysisModel.GridStyleList)
- {
- if (GridStyle.gridName.Equals(this.comboBox1.SelectedItem))
- {
- GridStyle.hNumber = Convert.ToInt32(this.textBox2.Text);
- GridStyle.vNumber = Convert.ToInt32(this.textBox3.Text);
- GridStyle.gridWidth = Convert.ToInt32(this.textBox4.Text);
- GridStyle.gridSpacing = Convert.ToInt32(this.textBox5.Text);
- GridStyle.gridColor = Convert.ToInt32(this.panel4.BackColor.ToArgb());
- GridStyle.wholePicture = this.checkBox2.Checked;
- GridStyle.blank = Convert.ToInt32(this.numericUpDown4.Value);
- }
- }
- }
- }
- //以下保存xml文件信息
- string stageModelXml = XmlSerializeHelper.XmlSerialize<QuantitativeAnalysisModel>(quantitativeAnalysisModel);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\QuantitativeAnalysisModel.xml";
- FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
- }
- /// <summary>
- /// 初始化图片列表数据
- /// </summary>
- public void InitPicList()
- {
- //初始化图片列表
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- {
- this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
- this.listView1.Items.Add("", i);
- this.listView1.Items[i].ImageIndex = i;
- this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
- if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
- {
- defaultIndex = i;
- }
- }
- this.Shown += ShowImgEvent;
- }
- RectangleF drawRectangleF = new RectangleF();
- /// <summary>
- /// 刷新绘制区域
- /// </summary>
- private void RefreshDrawRegion(PointF pointF, bool moveRec)
- {
- if (this.wholePicture)
- return;
- float hGridSpacingDraw = 0;
- float vGridSpacingDraw = 0;
- if (!this.wholePicture)
- {
- hGridSpacingDraw = (float)Math.Round(this.gridSpacing / unitLength);
- vGridSpacingDraw = (float)Math.Round(this.gridSpacing / unitLength);
- }
- exceed = false;
- ArrayList xs = new ArrayList();
- ArrayList ys = new ArrayList();
- if (this.hNumber > 0)
- {
- if (this.hNumber % 2 == 0)
- {
- float Spacing = hGridSpacingDraw / 2;
- for (int i = 0; i < this.hNumber / 2; i++)
- {
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= 0
- && (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height)
- {
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing);
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += hGridSpacingDraw;
- }
- }
- else
- {
- if (this.hNumber == 1)
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2);
- else
- {
- float Spacing = hGridSpacingDraw;
- for (int i = 0; i < (this.hNumber - 1) / 2; i++)
- {
- if (i == 0)
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2);
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= 0
- && (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height)
- {
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing);
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += hGridSpacingDraw;
- }
- }
- }
- }
- if (this.vNumber > 0)
- {
- if (this.vNumber % 2 == 0)
- {
- float Spacing = vGridSpacingDraw / 2;
- for (int i = 0; i < this.vNumber / 2; i++)
- {
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width)
- {
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing);
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += vGridSpacingDraw;
- }
- }
- else
- {
- if (this.vNumber == 1)
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2);
- else
- {
- float Spacing = vGridSpacingDraw;
- for (int i = 0; i < (this.vNumber - 1) / 2; i++)
- {
- if (i == 0)
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2);
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0)
- {
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing);
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += vGridSpacingDraw;
- }
- }
- }
- }
- // 矩形位置
- float rectangleFx = 0;
- float rectangleFy = 0;
- // 矩形右下角
- float rectangleFrbx = 0;
- float rectangleFrby = 0;
- if (xs.Count > 1)
- {
- rectangleFx = (float)xs[xs.Count - 2];
- rectangleFrbx = (float)xs[xs.Count - 1];
- }
- if (ys.Count > 1)
- {
- rectangleFy = (float)ys[ys.Count - 2];
- rectangleFrby = (float)ys[ys.Count - 1];
- }
- if (pointF.Equals(PointF.Empty) && exceed)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Thegridsizehasexceededtheimage.text") + "!");
- this.textBox5.Text = "0";
- return;
- }
- if (pointF.Equals(PointF.Empty))
- pointF = new PointF(rectangleFx, rectangleFy);
- this.drawRectangleF = new RectangleF(pointF.X, pointF.Y
- , Math.Abs(rectangleFrbx - rectangleFx), Math.Abs(rectangleFrby - rectangleFy));
- RefreshGridIntersections(moveRec);
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 刷新网格矩形
- /// </summary>
- private void RefreshGridIntersections(bool moveRec)
- {
- this.rectangleFs.Clear();
- float hGridSpacingDraw;
- float vGridSpacingDraw;
- if (this.wholePicture)
- {
- hGridSpacingDraw = (float)(this.documentWorkspace.CompositionSurface.Height - 2 * this.blank) / (this.hNumber - 1);
- vGridSpacingDraw = (float)(this.documentWorkspace.CompositionSurface.Width - 2 * this.blank) / (this.vNumber - 1);
- exceed = false;
- ArrayList xs = new ArrayList();
- ArrayList ys = new ArrayList();
- if (this.hNumber > 0)
- {
- if (this.hNumber % 2 == 0)
- {
- float Spacing = hGridSpacingDraw / 2;
- for (int i = 0; i < this.hNumber / 2; i++)
- {
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= 0
- && (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height)
- {
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing);
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += hGridSpacingDraw;
- }
- }
- else
- {
- if (this.hNumber == 1)
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2);
- else
- {
- float Spacing = hGridSpacingDraw;
- for (int i = 0; i < (this.hNumber - 1) / 2; i++)
- {
- if (i == 0)
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2);
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= 0
- && (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height)
- {
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing);
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += hGridSpacingDraw;
- }
- }
- }
- }
- if (this.vNumber > 0)
- {
- if (this.vNumber % 2 == 0)
- {
- float Spacing = vGridSpacingDraw / 2;
- for (int i = 0; i < this.vNumber / 2; i++)
- {
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width)
- {
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing);
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += vGridSpacingDraw;
- }
- }
- else
- {
- if (this.vNumber == 1)
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2);
- else
- {
- float Spacing = vGridSpacingDraw;
- for (int i = 0; i < (this.vNumber - 1) / 2; i++)
- {
- if (i == 0)
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2);
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0)
- {
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing);
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += vGridSpacingDraw;
- }
- }
- }
- }
- if (xs.Count > 1)
- {
- this.minX = (float)xs[xs.Count - 2];
- this.maxX = (float)xs[xs.Count - 1];
- }
- if (ys.Count > 1)
- {
- this.minY = (float)ys[ys.Count - 2];
- this.maxY = (float)ys[ys.Count - 1];
- }
- foreach (var x in xs)
- {
- foreach (var y in ys)
- {
- this.rectangleFs.Add(new RectangleF((float)(Convert.ToDecimal(x) - Convert.ToDecimal((float)this.gridWidth / 2) - 6)
- , (float)(Convert.ToDecimal(y) - Convert.ToDecimal((float)this.gridWidth / 2) - 6), this.gridWidth + 12, this.gridWidth + 12));
- }
- }
- //if (this.wholePicture)
- //{
- // int count = this.rectangleFs.Count;
- // RectangleF rectangleF = new RectangleF(this.blank, this.blank, this.documentWorkspace.CompositionSurface.Width + 1 - 2 * this.blank
- // , this.documentWorkspace.CompositionSurface.Height + 1 - 2 * this.blank);
- // for (int i = count - 1; i >= 0; i--)
- // {
- // if (!rectangleF.Contains(new PointF(this.rectangleFs[i].X + (float)this.gridWidth / 2 + 3, this.rectangleFs[i].Y + (float)this.gridWidth / 2 + 3)))
- // //|| rectangleF.X == this.rectangleFs[i].X || rectangleF.Y == this.rectangleFs[i].Y)
- // {
- // this.rectangleFs.RemoveAt(i);
- // }
- // }
- //}
- }
- else
- {
- hGridSpacingDraw = (float)Math.Round(this.gridSpacing / unitLength);
- vGridSpacingDraw = (float)Math.Round(this.gridSpacing / unitLength);
- exceed = false;
- ArrayList xs = new ArrayList();
- ArrayList ys = new ArrayList();
- if (this.hNumber > 0)
- {
- if (this.hNumber % 2 == 0)
- {
- float Spacing = hGridSpacingDraw / 2;
- for (int i = 0; i < this.hNumber / 2; i++)
- {
- if ((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing >= (float)this.drawRectangleF.Top
- && (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing <= this.drawRectangleF.Bottom)
- {
- ys.Add((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing);
- ys.Add((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += hGridSpacingDraw;
- }
- }
- else
- {
- if (this.hNumber == 1)
- ys.Add((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2);
- else
- {
- float Spacing = hGridSpacingDraw;
- for (int i = 0; i < (this.hNumber - 1) / 2; i++)
- {
- if (i == 0)
- ys.Add((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2);
- if ((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing >= this.drawRectangleF.Top
- && (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing <= this.drawRectangleF.Bottom)
- {
- ys.Add((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing);
- ys.Add((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += hGridSpacingDraw;
- }
- }
- }
- }
- if (this.vNumber > 0)
- {
- if (this.vNumber % 2 == 0)
- {
- float Spacing = vGridSpacingDraw / 2;
- for (int i = 0; i < this.vNumber / 2; i++)
- {
- if ((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing >= this.drawRectangleF.Left
- && (float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing <= this.drawRectangleF.Right)
- {
- xs.Add((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing);
- xs.Add((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += vGridSpacingDraw;
- }
- }
- else
- {
- if (this.vNumber == 1)
- xs.Add((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2);
- else
- {
- float Spacing = vGridSpacingDraw;
- for (int i = 0; i < (this.vNumber - 1) / 2; i++)
- {
- if (i == 0)
- xs.Add((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2);
- if ((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing <= this.drawRectangleF.Right
- && (float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing >= this.drawRectangleF.Left)
- {
- xs.Add((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing);
- xs.Add((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += vGridSpacingDraw;
- }
- }
- }
- }
- if (xs.Count > 1)
- {
- this.minX = (float)xs[xs.Count - 2];
- this.maxX = (float)xs[xs.Count - 1];
- }
- if (ys.Count > 1)
- {
- this.minY = (float)ys[ys.Count - 2];
- this.maxY = (float)ys[ys.Count - 1];
- }
- foreach (var x in xs)
- {
- foreach (var y in ys)
- {
- this.rectangleFs.Add(new RectangleF((float)(Convert.ToDecimal(x) - Convert.ToDecimal((float)this.gridWidth / 2) - 6)
- , (float)(Convert.ToDecimal(y) - Convert.ToDecimal((float)this.gridWidth / 2) - 6), this.gridWidth + 12, this.gridWidth + 12));
- }
- }
- }
-
- if (exceed && !moveRec)
- MessageBox.Show(PdnResources.GetString("Menu.Thegridsizehasexceededtheimage.text")+"!");
- this.documentWorkspace.Refresh();
- }
- #region 初始化
- private void InitializeLanguageText()
- {
- this.bc = new PaintDotNet.CustomControl.BinaryControl();
- //
- // bc
- //
- this.bc.BinaryBackColor = System.Drawing.Color.Red;
- this.bc.BinaryChecked = false;
- this.bc.BinaryStyle = 1;
- this.bc.Location = new System.Drawing.Point(151, 59);
- this.bc.Name = "bc";
- this.bc.OriginChecked = false;
- this.bc.scope1End = 0D;
- this.bc.scope1Start = 0D;
- this.bc.scope2End = 0D;
- this.bc.scope2Start = 0D;
- this.bc.scope3End = 0D;
- this.bc.scope3Start = 0D;
- this.bc.Size = new System.Drawing.Size(360, 292);
- this.bc.TabIndex = 21;
- this.Controls.Add(this.bc);
- this.Controls.SetChildIndex(this.bc, 0);
- this.label2.Text = PdnResources.GetString("Menu.gridstyle.text")+":";
- this.radioButton1.Text = PdnResources.GetString("Menu.Reticularl.text");
- this.radioButton2.Text = PdnResources.GetString("Menu.defaultt.text");
- this.Column12.HeaderText = ".5"+ PdnResources.GetString("Menu.proporttion.text");
- this.Column10.HeaderText = "1"+ PdnResources.GetString("Menu.proporttion.text");
- this.Column9.HeaderText = ".5"+ PdnResources.GetString("Menu.proporttion.text");
- this.Column8.HeaderText = "1"+ PdnResources.GetString("Menu.proporttion.text");
- this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
- this.checkBox4.Text = PdnResources.GetString("Menu.Meshmobility.text");
- this.button7.Text = PdnResources.GetString("Menu.stop.text");
- this.checkBox3.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
- this.button6.Text = PdnResources.GetString("Menu.Started.text");
- this.button5.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.button4.Text = PdnResources.GetString("Menu.File.SaveAs.Text");
- this.button3.Text = PdnResources.GetString("CommonAction.Save");
- this.label1.Text = PdnResources.GetString("Menu.Usegrid.text") + ":";
- this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
- this.button1.Text = PdnResources.GetString("Menu.Setting.Text");
- this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
- this.groupBox8.Text = PdnResources.GetString("Menu.Analysisresult.text");
- this.button8.Text = PdnResources.GetString("Menu.Exportproject.text");
- this.button16.Text = PdnResources.GetString("Menu.Cancelshowall.text");
- this.label5.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
- this.button14.Text = PdnResources.GetString("Menu.Exportresults.text");
- this.button13.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
- this.Column1.HeaderText = PdnResources.GetString("Menu.picture.Text");
- this.Column2.HeaderText = PdnResources.GetString("Menu.view.text");
- this.Column3.HeaderText = PdnResources.GetString("Menu.phase.text");
- this.Column6.HeaderText = PdnResources.GetString("Menu.total.text");
- this.Column7.HeaderText = PdnResources.GetString("Menu.percent.text");
- this.button12.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.button11.Text = PdnResources.GetString("Menu.Showall.text");
- this.groupBox7.Text = PdnResources.GetString("Menu.Preview.text");
- this.groupBox4.Text = PdnResources.GetString("Menu.Setting.GridSetting.Text");
- this.label10.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Gridspacing.text") + ":";
- this.checkBox2.Text = PdnResources.GetString("Menu.thefullimage.text");
- this.label12.Text = PdnResources.GetString("Menu.void.text") + ":";
- this.label11.Text = PdnResources.GetString("Menu.Gridcolor.text") + ":";
- this.label9.Text = PdnResources.GetString("Menu.Numberofvertical.text") + ":";
- this.label8.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Thelevelofthenumber.text") + ":";
- this.label7.Text = PdnResources.GetString("Menu.Gridlinewidth.text") + ":";
- this.groupBox5.Text = PdnResources.GetString("Menu.0.5pointsetting.text");
- this.label13.Text = PdnResources.GetString("Menu.style.text") + ":";
- this.rb_RightNoFill.Text = PdnResources.GetString("Menu.Hollow.text");
- this.rb_RightFill.Text = PdnResources.GetString("Menu.solid.text");
- this.label14.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.label15.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.label16.Text = PdnResources.GetString("Menu.sizeed.text") + ":";
- this.rb_RightSquare.Text = PdnResources.GetString("Menu.Square.text") + ":";
- this.rb_RightCircle.Text = PdnResources.GetString("Menu.circular.Text");
- this.label17.Text = PdnResources.GetString("Menu.shape.text") + ":";
- this.groupBox10.Text = PdnResources.GetString("Menu.1SpotSet.text");
- this.label18.Text = PdnResources.GetString("Menu.style.text") + ":";
- this.rb_leftNoFill.Text = PdnResources.GetString("Menu.Hollow.text");
- this.rb_leftFill.Text = PdnResources.GetString("Menu.solid.text");
- this.label19.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.label20.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.label21.Text = PdnResources.GetString("Menu.sizeed.text") + ":";
- this.rb_LeftSquare.Text = PdnResources.GetString("Menu.Square.text");
- this.rb_LeftCircle.Text = PdnResources.GetString("Menu.circular.Text");
- this.label22.Text = PdnResources.GetString("Menu.shape.text") + ":";
- this.groupBox9.Text = PdnResources.GetString("Menu.Resultspreview.text");
- this.But_DelPhase.Text = PdnResources.GetString("Menu.Deletephase.text");
- this.but_AddPhase.Text = PdnResources.GetString("Menu.Addphase.text");
- this.but_Clear.Text = PdnResources.GetString("Menu.Empty.text");
- this.Column11.HeaderText = PdnResources.GetString("Menu.view.text");
- this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.phase.text");
- this.dataGridViewTextBoxColumn4.HeaderText = PdnResources.GetString("Menu.total.text");
- this.dataGridViewTextBoxColumn5.HeaderText = PdnResources.GetString("Menu.percent.text");
- }
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.checkBox4 = new System.Windows.Forms.CheckBox();
- this.button7 = new System.Windows.Forms.Button();
- this.checkBox3 = new System.Windows.Forms.CheckBox();
- this.button6 = new System.Windows.Forms.Button();
- this.button5 = new System.Windows.Forms.Button();
- this.button4 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.comboBox1 = new System.Windows.Forms.ComboBox();
- this.label1 = new System.Windows.Forms.Label();
- this.button2 = new System.Windows.Forms.Button();
- this.button1 = new System.Windows.Forms.Button();
- this.listView1 = new System.Windows.Forms.ListView();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.groupBox8 = new System.Windows.Forms.GroupBox();
- this.button8 = new System.Windows.Forms.Button();
- this.listView2 = new System.Windows.Forms.ListView();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.button16 = new System.Windows.Forms.Button();
- this.label5 = new System.Windows.Forms.Label();
- this.button14 = new System.Windows.Forms.Button();
- this.button13 = new System.Windows.Forms.Button();
- this.dataGridView4 = new System.Windows.Forms.DataGridView();
- this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.button12 = new System.Windows.Forms.Button();
- this.button11 = new System.Windows.Forms.Button();
- this.groupBox7 = new System.Windows.Forms.GroupBox();
- this.groupBox4 = new System.Windows.Forms.GroupBox();
- this.radioButton2 = new System.Windows.Forms.RadioButton();
- this.radioButton1 = new System.Windows.Forms.RadioButton();
- this.label2 = new System.Windows.Forms.Label();
- this.textBox5 = new System.Windows.Forms.TextBox();
- this.panel4 = new System.Windows.Forms.Panel();
- this.label10 = new System.Windows.Forms.Label();
- this.textBox4 = new System.Windows.Forms.TextBox();
- this.textBox3 = new System.Windows.Forms.TextBox();
- this.textBox2 = new System.Windows.Forms.TextBox();
- this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
- this.checkBox2 = new System.Windows.Forms.CheckBox();
- this.label12 = new System.Windows.Forms.Label();
- this.label11 = new System.Windows.Forms.Label();
- this.label9 = new System.Windows.Forms.Label();
- this.label8 = new System.Windows.Forms.Label();
- this.label7 = new System.Windows.Forms.Label();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.panel2 = new System.Windows.Forms.Panel();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.label13 = new System.Windows.Forms.Label();
- this.rb_RightNoFill = new System.Windows.Forms.RadioButton();
- this.rb_RightFill = new System.Windows.Forms.RadioButton();
- this.label14 = new System.Windows.Forms.Label();
- this.txt_RightLineWeight = new System.Windows.Forms.TextBox();
- this.label15 = new System.Windows.Forms.Label();
- this.txt_RightSize = new System.Windows.Forms.TextBox();
- this.label16 = new System.Windows.Forms.Label();
- this.rb_RightSquare = new System.Windows.Forms.RadioButton();
- this.rb_RightCircle = new System.Windows.Forms.RadioButton();
- this.label17 = new System.Windows.Forms.Label();
- this.groupBox10 = new System.Windows.Forms.GroupBox();
- this.groupBox11 = new System.Windows.Forms.GroupBox();
- this.label18 = new System.Windows.Forms.Label();
- this.rb_leftNoFill = new System.Windows.Forms.RadioButton();
- this.rb_leftFill = new System.Windows.Forms.RadioButton();
- this.panel1 = new System.Windows.Forms.Panel();
- this.label19 = new System.Windows.Forms.Label();
- this.txt_LeftLineWeight = new System.Windows.Forms.TextBox();
- this.label20 = new System.Windows.Forms.Label();
- this.txt_LeftSize = new System.Windows.Forms.TextBox();
- this.label21 = new System.Windows.Forms.Label();
- this.rb_LeftSquare = new System.Windows.Forms.RadioButton();
- this.rb_LeftCircle = new System.Windows.Forms.RadioButton();
- this.label22 = new System.Windows.Forms.Label();
- this.groupBox9 = new System.Windows.Forms.GroupBox();
- this.But_DelPhase = new System.Windows.Forms.Button();
- this.but_AddPhase = new System.Windows.Forms.Button();
- this.but_Clear = new System.Windows.Forms.Button();
- this.dataGridView1 = new System.Windows.Forms.DataGridView();
- this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox8.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).BeginInit();
- this.groupBox4.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
- this.groupBox5.SuspendLayout();
- this.groupBox6.SuspendLayout();
- this.groupBox10.SuspendLayout();
- this.groupBox11.SuspendLayout();
- this.groupBox9.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox1.Controls.Add(this.checkBox4);
- this.groupBox1.Controls.Add(this.button7);
- this.groupBox1.Controls.Add(this.checkBox3);
- this.groupBox1.Controls.Add(this.button6);
- this.groupBox1.Controls.Add(this.button5);
- this.groupBox1.Controls.Add(this.button4);
- this.groupBox1.Controls.Add(this.button3);
- this.groupBox1.Controls.Add(this.comboBox1);
- this.groupBox1.Controls.Add(this.label1);
- this.groupBox1.Controls.Add(this.button2);
- this.groupBox1.Controls.Add(this.button1);
- this.groupBox1.Location = new System.Drawing.Point(14, 3);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(1081, 50);
- this.groupBox1.TabIndex = 2;
- this.groupBox1.TabStop = false;
- //
- // checkBox4
- //
- this.checkBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.checkBox4.AutoSize = true;
- this.checkBox4.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
- this.checkBox4.Location = new System.Drawing.Point(658, 21);
- this.checkBox4.Name = "checkBox4";
- this.checkBox4.Size = new System.Drawing.Size(15, 14);
- this.checkBox4.TabIndex = 23;
- this.checkBox4.UseVisualStyleBackColor = true;
- this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
- //
- // button7
- //
- this.button7.BackColor = System.Drawing.SystemColors.Control;
- this.button7.Location = new System.Drawing.Point(499, 13);
- this.button7.Name = "button7";
- this.button7.Size = new System.Drawing.Size(72, 30);
- this.button7.TabIndex = 22;
- this.button7.UseVisualStyleBackColor = false;
- this.button7.Click += new System.EventHandler(this.button7_Click);
- //
- // checkBox3
- //
- this.checkBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.checkBox3.AutoSize = true;
- this.checkBox3.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
- this.checkBox3.Location = new System.Drawing.Point(829, 22);
- this.checkBox3.Name = "checkBox3";
- this.checkBox3.Size = new System.Drawing.Size(15, 14);
- this.checkBox3.TabIndex = 21;
- this.checkBox3.UseVisualStyleBackColor = true;
- //
- // button6
- //
- this.button6.BackColor = System.Drawing.SystemColors.Control;
- this.button6.Location = new System.Drawing.Point(499, 13);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(72, 30);
- this.button6.TabIndex = 9;
- this.button6.UseVisualStyleBackColor = false;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // button5
- //
- this.button5.BackColor = System.Drawing.SystemColors.Control;
- this.button5.Location = new System.Drawing.Point(421, 13);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(72, 30);
- this.button5.TabIndex = 8;
- this.button5.UseVisualStyleBackColor = false;
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // button4
- //
- this.button4.BackColor = System.Drawing.SystemColors.Control;
- this.button4.Location = new System.Drawing.Point(331, 13);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(84, 30);
- this.button4.TabIndex = 7;
- this.button4.UseVisualStyleBackColor = false;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // button3
- //
- this.button3.BackColor = System.Drawing.SystemColors.Control;
- this.button3.Location = new System.Drawing.Point(253, 13);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(72, 30);
- this.button3.TabIndex = 6;
- this.button3.UseVisualStyleBackColor = false;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // comboBox1
- //
- this.comboBox1.FormattingEnabled = true;
- this.comboBox1.Location = new System.Drawing.Point(78, 19);
- this.comboBox1.Name = "comboBox1";
- this.comboBox1.Size = new System.Drawing.Size(159, 20);
- this.comboBox1.TabIndex = 5;
- this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(18, 23);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(0, 12);
- this.label1.TabIndex = 4;
- //
- // button2
- //
- this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button2.BackColor = System.Drawing.SystemColors.Control;
- this.button2.Location = new System.Drawing.Point(985, 14);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(84, 30);
- this.button2.TabIndex = 3;
- this.button2.UseVisualStyleBackColor = false;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button1.BackColor = System.Drawing.SystemColors.Control;
- this.button1.Location = new System.Drawing.Point(895, 14);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(84, 30);
- this.button1.TabIndex = 0;
- this.button1.UseVisualStyleBackColor = false;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // listView1
- //
- this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.listView1.FullRowSelect = true;
- this.listView1.HideSelection = false;
- this.listView1.LargeImageList = this.imageList1;
- this.listView1.Location = new System.Drawing.Point(5, 17);
- this.listView1.MultiSelect = false;
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(124, 699);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- this.listView1.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView1_ItemSelectionChanged);
- this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
- this.listView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDown);
- this.listView1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseUp);
- //
- // imageList1
- //
- this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- //
- // groupBox2
- //
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox2.Controls.Add(this.listView1);
- this.groupBox2.Location = new System.Drawing.Point(14, 59);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(135, 722);
- this.groupBox2.TabIndex = 3;
- this.groupBox2.TabStop = false;
- //
- // groupBox8
- //
- this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox8.Controls.Add(this.button8);
- this.groupBox8.Controls.Add(this.listView2);
- this.groupBox8.Controls.Add(this.numericUpDown1);
- this.groupBox8.Controls.Add(this.button16);
- this.groupBox8.Controls.Add(this.label5);
- this.groupBox8.Controls.Add(this.button14);
- this.groupBox8.Controls.Add(this.button13);
- this.groupBox8.Controls.Add(this.dataGridView4);
- this.groupBox8.Controls.Add(this.button12);
- this.groupBox8.Controls.Add(this.button11);
- this.groupBox8.Location = new System.Drawing.Point(14, 787);
- this.groupBox8.Name = "groupBox8";
- this.groupBox8.Size = new System.Drawing.Size(1081, 172);
- this.groupBox8.TabIndex = 10;
- this.groupBox8.TabStop = false;
- //
- // button8
- //
- this.button8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button8.BackColor = System.Drawing.SystemColors.Control;
- this.button8.Location = new System.Drawing.Point(941, 102);
- this.button8.Name = "button8";
- this.button8.Size = new System.Drawing.Size(128, 26);
- this.button8.TabIndex = 23;
- this.button8.UseVisualStyleBackColor = false;
- this.button8.Click += new System.EventHandler(this.button8_Click);
- //
- // listView2
- //
- this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.listView2.FullRowSelect = true;
- this.listView2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
- this.listView2.HideSelection = false;
- this.listView2.Location = new System.Drawing.Point(16, 56);
- this.listView2.Name = "listView2";
- this.listView2.Size = new System.Drawing.Size(180, 103);
- this.listView2.TabIndex = 22;
- this.listView2.UseCompatibleStateImageBehavior = false;
- this.listView2.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView2_ItemSelectionChanged);
- this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
- //
- // numericUpDown1
- //
- this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.numericUpDown1.Location = new System.Drawing.Point(998, 138);
- this.numericUpDown1.Maximum = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(56, 21);
- this.numericUpDown1.TabIndex = 21;
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
- //
- // button16
- //
- this.button16.BackColor = System.Drawing.SystemColors.Control;
- this.button16.Location = new System.Drawing.Point(6, 20);
- this.button16.Name = "button16";
- this.button16.Size = new System.Drawing.Size(93, 26);
- this.button16.TabIndex = 20;
- this.button16.UseVisualStyleBackColor = false;
- this.button16.Click += new System.EventHandler(this.button16_Click);
- //
- // label5
- //
- this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.label5.AutoSize = true;
- this.label5.Location = new System.Drawing.Point(959, 144);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(0, 12);
- this.label5.TabIndex = 18;
- //
- // button14
- //
- this.button14.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button14.BackColor = System.Drawing.SystemColors.Control;
- this.button14.Location = new System.Drawing.Point(941, 68);
- this.button14.Name = "button14";
- this.button14.Size = new System.Drawing.Size(128, 26);
- this.button14.TabIndex = 16;
- this.button14.UseVisualStyleBackColor = false;
- this.button14.Click += new System.EventHandler(this.button14_Click);
- //
- // button13
- //
- this.button13.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button13.BackColor = System.Drawing.SystemColors.Control;
- this.button13.Location = new System.Drawing.Point(941, 34);
- this.button13.Name = "button13";
- this.button13.Size = new System.Drawing.Size(128, 26);
- this.button13.TabIndex = 12;
- this.button13.UseVisualStyleBackColor = false;
- this.button13.Click += new System.EventHandler(this.button13_Click);
- //
- // dataGridView4
- //
- this.dataGridView4.AllowUserToAddRows = false;
- this.dataGridView4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.dataGridView4.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView4.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
- dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F);
- dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.dataGridView4.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
- this.dataGridView4.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dataGridView4.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column1,
- this.Column2,
- this.Column3,
- this.Column4,
- this.Column5,
- this.Column6,
- this.Column7,
- this.Column10,
- this.Column12});
- this.dataGridView4.Location = new System.Drawing.Point(228, 20);
- this.dataGridView4.Name = "dataGridView4";
- this.dataGridView4.ReadOnly = true;
- this.dataGridView4.RowHeadersVisible = false;
- this.dataGridView4.RowTemplate.Height = 23;
- this.dataGridView4.ScrollBars = System.Windows.Forms.ScrollBars.None;
- this.dataGridView4.Size = new System.Drawing.Size(693, 139);
- this.dataGridView4.TabIndex = 15;
- //
- // Column1
- //
- dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column1.DefaultCellStyle = dataGridViewCellStyle2;
- this.Column1.HeaderText = "Column1";
- this.Column1.Name = "Column1";
- this.Column1.ReadOnly = true;
- //
- // Column2
- //
- dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column2.DefaultCellStyle = dataGridViewCellStyle3;
- this.Column2.HeaderText = "Column2";
- this.Column2.Name = "Column2";
- this.Column2.ReadOnly = true;
- //
- // Column3
- //
- dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column3.DefaultCellStyle = dataGridViewCellStyle4;
- this.Column3.HeaderText = "Column3";
- this.Column3.Name = "Column3";
- this.Column3.ReadOnly = true;
- //
- // Column4
- //
- dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.Column4.DefaultCellStyle = dataGridViewCellStyle5;
- this.Column4.HeaderText = "1";
- this.Column4.Name = "Column4";
- this.Column4.ReadOnly = true;
- //
- // Column5
- //
- dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.Column5.DefaultCellStyle = dataGridViewCellStyle6;
- this.Column5.HeaderText = ".5";
- this.Column5.Name = "Column5";
- this.Column5.ReadOnly = true;
- //
- // Column6
- //
- dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.Column6.DefaultCellStyle = dataGridViewCellStyle7;
- this.Column6.HeaderText = "Column6";
- this.Column6.Name = "Column6";
- this.Column6.ReadOnly = true;
- //
- // Column7
- //
- dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.Column7.DefaultCellStyle = dataGridViewCellStyle8;
- this.Column7.HeaderText = "Column7";
- this.Column7.Name = "Column7";
- this.Column7.ReadOnly = true;
- //
- // Column10
- //
- dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.Column10.DefaultCellStyle = dataGridViewCellStyle9;
- this.Column10.Name = "Column10";
- this.Column10.ReadOnly = true;
- //
- // Column12
- //
- dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.Column12.DefaultCellStyle = dataGridViewCellStyle10;
- this.Column12.Name = "Column12";
- this.Column12.ReadOnly = true;
- //
- // button12
- //
- this.button12.BackColor = System.Drawing.SystemColors.Control;
- this.button12.Location = new System.Drawing.Point(145, 20);
- this.button12.Name = "button12";
- this.button12.Size = new System.Drawing.Size(52, 26);
- this.button12.TabIndex = 13;
- this.button12.UseVisualStyleBackColor = false;
- this.button12.Click += new System.EventHandler(this.button12_Click);
- //
- // button11
- //
- this.button11.BackColor = System.Drawing.SystemColors.Control;
- this.button11.Location = new System.Drawing.Point(15, 20);
- this.button11.Name = "button11";
- this.button11.Size = new System.Drawing.Size(63, 26);
- this.button11.TabIndex = 12;
- this.button11.UseVisualStyleBackColor = false;
- this.button11.Click += new System.EventHandler(this.button11_Click);
- //
- // groupBox7
- //
- this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox7.Location = new System.Drawing.Point(515, 59);
- this.groupBox7.Name = "groupBox7";
- this.groupBox7.Size = new System.Drawing.Size(580, 722);
- this.groupBox7.TabIndex = 11;
- this.groupBox7.TabStop = false;
- //
- // groupBox4
- //
- this.groupBox4.Controls.Add(this.radioButton2);
- this.groupBox4.Controls.Add(this.radioButton1);
- this.groupBox4.Controls.Add(this.label2);
- this.groupBox4.Controls.Add(this.textBox5);
- this.groupBox4.Controls.Add(this.panel4);
- this.groupBox4.Controls.Add(this.label10);
- this.groupBox4.Controls.Add(this.textBox4);
- this.groupBox4.Controls.Add(this.textBox3);
- this.groupBox4.Controls.Add(this.textBox2);
- this.groupBox4.Controls.Add(this.numericUpDown4);
- this.groupBox4.Controls.Add(this.checkBox2);
- this.groupBox4.Controls.Add(this.label12);
- this.groupBox4.Controls.Add(this.label11);
- this.groupBox4.Controls.Add(this.label9);
- this.groupBox4.Controls.Add(this.label8);
- this.groupBox4.Controls.Add(this.label7);
- this.groupBox4.Location = new System.Drawing.Point(159, 358);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(352, 100);
- this.groupBox4.TabIndex = 13;
- this.groupBox4.TabStop = false;
- //
- // radioButton2
- //
- this.radioButton2.AutoSize = true;
- this.radioButton2.Location = new System.Drawing.Point(195, 79);
- this.radioButton2.Name = "radioButton2";
- this.radioButton2.Size = new System.Drawing.Size(14, 13);
- this.radioButton2.TabIndex = 31;
- this.radioButton2.TabStop = true;
- this.radioButton2.UseVisualStyleBackColor = true;
- this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
- //
- // radioButton1
- //
- this.radioButton1.AutoSize = true;
- this.radioButton1.Location = new System.Drawing.Point(87, 79);
- this.radioButton1.Name = "radioButton1";
- this.radioButton1.Size = new System.Drawing.Size(14, 13);
- this.radioButton1.TabIndex = 30;
- this.radioButton1.TabStop = true;
- this.radioButton1.UseVisualStyleBackColor = true;
- this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged);
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(16, 80);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(0, 12);
- this.label2.TabIndex = 29;
- //
- // textBox5
- //
- this.textBox5.Location = new System.Drawing.Point(288, 46);
- this.textBox5.Name = "textBox5";
- this.textBox5.Size = new System.Drawing.Size(49, 21);
- this.textBox5.TabIndex = 13;
- this.textBox5.TextChanged += new System.EventHandler(this.textBox5_TextChanged);
- this.textBox5.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox5_KeyPress);
- //
- // panel4
- //
- this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.panel4.Location = new System.Drawing.Point(80, 49);
- this.panel4.Name = "panel4";
- this.panel4.Size = new System.Drawing.Size(80, 17);
- this.panel4.TabIndex = 28;
- this.panel4.BackColorChanged += new System.EventHandler(this.panel4_BackColorChanged);
- this.panel4.Click += new System.EventHandler(this.panel4_Click);
- //
- // label10
- //
- this.label10.AutoSize = true;
- this.label10.Location = new System.Drawing.Point(224, 51);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(0, 12);
- this.label10.TabIndex = 5;
- //
- // textBox4
- //
- this.textBox4.Location = new System.Drawing.Point(288, 19);
- this.textBox4.Name = "textBox4";
- this.textBox4.Size = new System.Drawing.Size(35, 21);
- this.textBox4.TabIndex = 12;
- this.textBox4.TextChanged += new System.EventHandler(this.textBox4_TextChanged);
- this.textBox4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox4_KeyPress);
- //
- // textBox3
- //
- this.textBox3.Location = new System.Drawing.Point(176, 19);
- this.textBox3.Name = "textBox3";
- this.textBox3.Size = new System.Drawing.Size(35, 21);
- this.textBox3.TabIndex = 11;
- this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
- this.textBox3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox3_KeyPress);
- //
- // textBox2
- //
- this.textBox2.Location = new System.Drawing.Point(74, 19);
- this.textBox2.Name = "textBox2";
- this.textBox2.Size = new System.Drawing.Size(35, 21);
- this.textBox2.TabIndex = 10;
- this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
- this.textBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox2_KeyPress);
- //
- // numericUpDown4
- //
- this.numericUpDown4.Location = new System.Drawing.Point(262, 46);
- this.numericUpDown4.Maximum = new decimal(new int[] {
- 999999,
- 0,
- 0,
- 0});
- this.numericUpDown4.Name = "numericUpDown4";
- this.numericUpDown4.Size = new System.Drawing.Size(49, 21);
- this.numericUpDown4.TabIndex = 9;
- this.numericUpDown4.ValueChanged += new System.EventHandler(this.numericUpDown4_ValueChanged);
- //
- // checkBox2
- //
- this.checkBox2.AutoSize = true;
- this.checkBox2.Location = new System.Drawing.Point(173, 51);
- this.checkBox2.Name = "checkBox2";
- this.checkBox2.Size = new System.Drawing.Size(15, 14);
- this.checkBox2.TabIndex = 8;
- this.checkBox2.UseVisualStyleBackColor = true;
- this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
- //
- // label12
- //
- this.label12.AutoSize = true;
- this.label12.Location = new System.Drawing.Point(224, 51);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(0, 12);
- this.label12.TabIndex = 7;
- //
- // label11
- //
- this.label11.AutoSize = true;
- this.label11.Location = new System.Drawing.Point(16, 51);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(0, 12);
- this.label11.TabIndex = 6;
- //
- // label9
- //
- this.label9.AutoSize = true;
- this.label9.Location = new System.Drawing.Point(115, 22);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(0, 12);
- this.label9.TabIndex = 4;
- //
- // label8
- //
- this.label8.AutoSize = true;
- this.label8.Location = new System.Drawing.Point(16, 22);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(0, 12);
- this.label8.TabIndex = 3;
- //
- // label7
- //
- this.label7.AutoSize = true;
- this.label7.Location = new System.Drawing.Point(217, 22);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(0, 12);
- this.label7.TabIndex = 2;
- //
- // groupBox5
- //
- this.groupBox5.Controls.Add(this.panel2);
- this.groupBox5.Controls.Add(this.groupBox6);
- this.groupBox5.Controls.Add(this.label14);
- this.groupBox5.Controls.Add(this.txt_RightLineWeight);
- this.groupBox5.Controls.Add(this.label15);
- this.groupBox5.Controls.Add(this.txt_RightSize);
- this.groupBox5.Controls.Add(this.label16);
- this.groupBox5.Controls.Add(this.rb_RightSquare);
- this.groupBox5.Controls.Add(this.rb_RightCircle);
- this.groupBox5.Controls.Add(this.label17);
- this.groupBox5.Location = new System.Drawing.Point(158, 550);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(351, 83);
- this.groupBox5.TabIndex = 19;
- this.groupBox5.TabStop = false;
- //
- // panel2
- //
- this.panel2.BackColor = System.Drawing.Color.Blue;
- this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.panel2.Location = new System.Drawing.Point(262, 55);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(79, 21);
- this.panel2.TabIndex = 26;
- this.panel2.BackColorChanged += new System.EventHandler(this.panel2_BackColorChanged);
- this.panel2.Click += new System.EventHandler(this.panel2_Click);
- //
- // groupBox6
- //
- this.groupBox6.Controls.Add(this.label13);
- this.groupBox6.Controls.Add(this.rb_RightNoFill);
- this.groupBox6.Controls.Add(this.rb_RightFill);
- this.groupBox6.Location = new System.Drawing.Point(164, 8);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(173, 42);
- this.groupBox6.TabIndex = 24;
- this.groupBox6.TabStop = false;
- //
- // label13
- //
- this.label13.AutoSize = true;
- this.label13.Location = new System.Drawing.Point(12, 18);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(0, 12);
- this.label13.TabIndex = 21;
- //
- // rb_RightNoFill
- //
- this.rb_RightNoFill.AutoSize = true;
- this.rb_RightNoFill.Checked = true;
- this.rb_RightNoFill.Location = new System.Drawing.Point(108, 16);
- this.rb_RightNoFill.Name = "rb_RightNoFill";
- this.rb_RightNoFill.Size = new System.Drawing.Size(14, 13);
- this.rb_RightNoFill.TabIndex = 20;
- this.rb_RightNoFill.TabStop = true;
- this.rb_RightNoFill.UseVisualStyleBackColor = true;
- //
- // rb_RightFill
- //
- this.rb_RightFill.AutoSize = true;
- this.rb_RightFill.Location = new System.Drawing.Point(53, 16);
- this.rb_RightFill.Name = "rb_RightFill";
- this.rb_RightFill.Size = new System.Drawing.Size(14, 13);
- this.rb_RightFill.TabIndex = 19;
- this.rb_RightFill.UseVisualStyleBackColor = true;
- this.rb_RightFill.CheckedChanged += new System.EventHandler(this.rb_RightFill_CheckedChanged);
- //
- // label14
- //
- this.label14.AutoSize = true;
- this.label14.Location = new System.Drawing.Point(224, 58);
- this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(0, 12);
- this.label14.TabIndex = 22;
- //
- // txt_RightLineWeight
- //
- this.txt_RightLineWeight.Location = new System.Drawing.Point(158, 55);
- this.txt_RightLineWeight.Name = "txt_RightLineWeight";
- this.txt_RightLineWeight.Size = new System.Drawing.Size(45, 21);
- this.txt_RightLineWeight.TabIndex = 21;
- this.txt_RightLineWeight.Text = "5";
- this.txt_RightLineWeight.TextChanged += new System.EventHandler(this.txt_RightLineWeight_TextChanged);
- this.txt_RightLineWeight.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxRightWidth_KeyPress);
- //
- // label15
- //
- this.label15.AutoSize = true;
- this.label15.Location = new System.Drawing.Point(121, 58);
- this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(0, 12);
- this.label15.TabIndex = 20;
- //
- // txt_RightSize
- //
- this.txt_RightSize.Location = new System.Drawing.Point(62, 55);
- this.txt_RightSize.Name = "txt_RightSize";
- this.txt_RightSize.Size = new System.Drawing.Size(45, 21);
- this.txt_RightSize.TabIndex = 19;
- this.txt_RightSize.Text = "3";
- this.txt_RightSize.TextChanged += new System.EventHandler(this.txt_RightSize_TextChanged);
- this.txt_RightSize.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxRightSize_KeyPress);
- //
- // label16
- //
- this.label16.AutoSize = true;
- this.label16.Location = new System.Drawing.Point(27, 58);
- this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(0, 12);
- this.label16.TabIndex = 18;
- //
- // rb_RightSquare
- //
- this.rb_RightSquare.AutoSize = true;
- this.rb_RightSquare.Location = new System.Drawing.Point(109, 24);
- this.rb_RightSquare.Name = "rb_RightSquare";
- this.rb_RightSquare.Size = new System.Drawing.Size(14, 13);
- this.rb_RightSquare.TabIndex = 14;
- this.rb_RightSquare.TabStop = true;
- this.rb_RightSquare.UseVisualStyleBackColor = true;
- //
- // rb_RightCircle
- //
- this.rb_RightCircle.AutoSize = true;
- this.rb_RightCircle.Checked = true;
- this.rb_RightCircle.Location = new System.Drawing.Point(56, 24);
- this.rb_RightCircle.Name = "rb_RightCircle";
- this.rb_RightCircle.Size = new System.Drawing.Size(14, 13);
- this.rb_RightCircle.TabIndex = 13;
- this.rb_RightCircle.TabStop = true;
- this.rb_RightCircle.UseVisualStyleBackColor = true;
- this.rb_RightCircle.CheckedChanged += new System.EventHandler(this.rb_RightCircle_CheckedChanged);
- //
- // label17
- //
- this.label17.AutoSize = true;
- this.label17.Location = new System.Drawing.Point(19, 26);
- this.label17.Name = "label17";
- this.label17.Size = new System.Drawing.Size(0, 12);
- this.label17.TabIndex = 12;
- //
- // groupBox10
- //
- this.groupBox10.Controls.Add(this.groupBox11);
- this.groupBox10.Controls.Add(this.panel1);
- this.groupBox10.Controls.Add(this.label19);
- this.groupBox10.Controls.Add(this.txt_LeftLineWeight);
- this.groupBox10.Controls.Add(this.label20);
- this.groupBox10.Controls.Add(this.txt_LeftSize);
- this.groupBox10.Controls.Add(this.label21);
- this.groupBox10.Controls.Add(this.rb_LeftSquare);
- this.groupBox10.Controls.Add(this.rb_LeftCircle);
- this.groupBox10.Controls.Add(this.label22);
- this.groupBox10.Location = new System.Drawing.Point(158, 464);
- this.groupBox10.Name = "groupBox10";
- this.groupBox10.Size = new System.Drawing.Size(352, 80);
- this.groupBox10.TabIndex = 18;
- this.groupBox10.TabStop = false;
- //
- // groupBox11
- //
- this.groupBox11.Controls.Add(this.label18);
- this.groupBox11.Controls.Add(this.rb_leftNoFill);
- this.groupBox11.Controls.Add(this.rb_leftFill);
- this.groupBox11.Location = new System.Drawing.Point(170, 8);
- this.groupBox11.Name = "groupBox11";
- this.groupBox11.Size = new System.Drawing.Size(173, 38);
- this.groupBox11.TabIndex = 25;
- this.groupBox11.TabStop = false;
- //
- // label18
- //
- this.label18.AutoSize = true;
- this.label18.Location = new System.Drawing.Point(12, 16);
- this.label18.Name = "label18";
- this.label18.Size = new System.Drawing.Size(0, 12);
- this.label18.TabIndex = 22;
- //
- // rb_leftNoFill
- //
- this.rb_leftNoFill.AutoSize = true;
- this.rb_leftNoFill.Checked = true;
- this.rb_leftNoFill.Location = new System.Drawing.Point(108, 14);
- this.rb_leftNoFill.Name = "rb_leftNoFill";
- this.rb_leftNoFill.Size = new System.Drawing.Size(14, 13);
- this.rb_leftNoFill.TabIndex = 20;
- this.rb_leftNoFill.TabStop = true;
- this.rb_leftNoFill.UseVisualStyleBackColor = true;
- //
- // rb_leftFill
- //
- this.rb_leftFill.AutoSize = true;
- this.rb_leftFill.Location = new System.Drawing.Point(53, 14);
- this.rb_leftFill.Name = "rb_leftFill";
- this.rb_leftFill.Size = new System.Drawing.Size(14, 13);
- this.rb_leftFill.TabIndex = 19;
- this.rb_leftFill.UseVisualStyleBackColor = true;
- this.rb_leftFill.CheckedChanged += new System.EventHandler(this.rb_leftFill_CheckedChanged);
- //
- // panel1
- //
- this.panel1.BackColor = System.Drawing.Color.Yellow;
- this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.panel1.Location = new System.Drawing.Point(262, 51);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(79, 21);
- this.panel1.TabIndex = 25;
- this.panel1.BackColorChanged += new System.EventHandler(this.panel1_BackColorChanged);
- this.panel1.Click += new System.EventHandler(this.panel1_Click);
- //
- // label19
- //
- this.label19.AutoSize = true;
- this.label19.Location = new System.Drawing.Point(224, 54);
- this.label19.Name = "label19";
- this.label19.Size = new System.Drawing.Size(0, 12);
- this.label19.TabIndex = 10;
- //
- // txt_LeftLineWeight
- //
- this.txt_LeftLineWeight.Location = new System.Drawing.Point(158, 51);
- this.txt_LeftLineWeight.Name = "txt_LeftLineWeight";
- this.txt_LeftLineWeight.Size = new System.Drawing.Size(45, 21);
- this.txt_LeftLineWeight.TabIndex = 9;
- this.txt_LeftLineWeight.Text = "2";
- this.txt_LeftLineWeight.TextChanged += new System.EventHandler(this.txt_LeftLineWeight_TextChanged);
- this.txt_LeftLineWeight.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxLeftWidth_KeyPress);
- //
- // label20
- //
- this.label20.AutoSize = true;
- this.label20.Location = new System.Drawing.Point(121, 54);
- this.label20.Name = "label20";
- this.label20.Size = new System.Drawing.Size(0, 12);
- this.label20.TabIndex = 8;
- //
- // txt_LeftSize
- //
- this.txt_LeftSize.Location = new System.Drawing.Point(62, 51);
- this.txt_LeftSize.Name = "txt_LeftSize";
- this.txt_LeftSize.Size = new System.Drawing.Size(45, 21);
- this.txt_LeftSize.TabIndex = 7;
- this.txt_LeftSize.Text = "3";
- this.txt_LeftSize.TextChanged += new System.EventHandler(this.txt_LeftSize_TextChanged);
- this.txt_LeftSize.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxLeftSize_KeyPress);
- //
- // label21
- //
- this.label21.AutoSize = true;
- this.label21.Location = new System.Drawing.Point(27, 54);
- this.label21.Name = "label21";
- this.label21.Size = new System.Drawing.Size(0, 12);
- this.label21.TabIndex = 6;
- //
- // rb_LeftSquare
- //
- this.rb_LeftSquare.AutoSize = true;
- this.rb_LeftSquare.Location = new System.Drawing.Point(115, 22);
- this.rb_LeftSquare.Name = "rb_LeftSquare";
- this.rb_LeftSquare.Size = new System.Drawing.Size(14, 13);
- this.rb_LeftSquare.TabIndex = 2;
- this.rb_LeftSquare.UseVisualStyleBackColor = true;
- //
- // rb_LeftCircle
- //
- this.rb_LeftCircle.AutoSize = true;
- this.rb_LeftCircle.Checked = true;
- this.rb_LeftCircle.Location = new System.Drawing.Point(62, 22);
- this.rb_LeftCircle.Name = "rb_LeftCircle";
- this.rb_LeftCircle.Size = new System.Drawing.Size(14, 13);
- this.rb_LeftCircle.TabIndex = 1;
- this.rb_LeftCircle.TabStop = true;
- this.rb_LeftCircle.UseVisualStyleBackColor = true;
- this.rb_LeftCircle.CheckedChanged += new System.EventHandler(this.rb_LeftCircle_CheckedChanged);
- //
- // label22
- //
- this.label22.AutoSize = true;
- this.label22.Location = new System.Drawing.Point(23, 24);
- this.label22.Name = "label22";
- this.label22.Size = new System.Drawing.Size(0, 12);
- this.label22.TabIndex = 0;
- //
- // groupBox9
- //
- this.groupBox9.Controls.Add(this.But_DelPhase);
- this.groupBox9.Controls.Add(this.but_AddPhase);
- this.groupBox9.Controls.Add(this.but_Clear);
- this.groupBox9.Controls.Add(this.dataGridView1);
- this.groupBox9.Location = new System.Drawing.Point(160, 639);
- this.groupBox9.Name = "groupBox9";
- this.groupBox9.Size = new System.Drawing.Size(351, 142);
- this.groupBox9.TabIndex = 20;
- this.groupBox9.TabStop = false;
- //
- // But_DelPhase
- //
- this.But_DelPhase.BackColor = System.Drawing.SystemColors.Control;
- this.But_DelPhase.Location = new System.Drawing.Point(280, 15);
- this.But_DelPhase.Name = "But_DelPhase";
- this.But_DelPhase.Size = new System.Drawing.Size(63, 23);
- this.But_DelPhase.TabIndex = 3;
- this.But_DelPhase.UseVisualStyleBackColor = false;
- this.But_DelPhase.Click += new System.EventHandler(this.But_DelPhase_Click);
- //
- // but_AddPhase
- //
- this.but_AddPhase.BackColor = System.Drawing.SystemColors.Control;
- this.but_AddPhase.Location = new System.Drawing.Point(215, 15);
- this.but_AddPhase.Name = "but_AddPhase";
- this.but_AddPhase.Size = new System.Drawing.Size(61, 23);
- this.but_AddPhase.TabIndex = 2;
- this.but_AddPhase.UseVisualStyleBackColor = false;
- this.but_AddPhase.Click += new System.EventHandler(this.but_AddPhase_Click);
- //
- // but_Clear
- //
- this.but_Clear.BackColor = System.Drawing.SystemColors.Control;
- this.but_Clear.Location = new System.Drawing.Point(150, 15);
- this.but_Clear.Name = "but_Clear";
- this.but_Clear.Size = new System.Drawing.Size(61, 23);
- this.but_Clear.TabIndex = 1;
- this.but_Clear.UseVisualStyleBackColor = false;
- this.but_Clear.Click += new System.EventHandler(this.but_Clear_Click);
- //
- // dataGridView1
- //
- this.dataGridView1.AllowUserToAddRows = false;
- this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
- dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle11.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11;
- this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column11,
- this.dataGridViewTextBoxColumn1,
- this.dataGridViewTextBoxColumn2,
- this.dataGridViewTextBoxColumn3,
- this.dataGridViewTextBoxColumn4,
- this.dataGridViewTextBoxColumn5,
- this.Column8,
- this.Column9});
- this.dataGridView1.Location = new System.Drawing.Point(6, 44);
- this.dataGridView1.MultiSelect = false;
- this.dataGridView1.Name = "dataGridView1";
- this.dataGridView1.ReadOnly = true;
- this.dataGridView1.RowHeadersVisible = false;
- this.dataGridView1.RowTemplate.Height = 23;
- this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView1.Size = new System.Drawing.Size(337, 92);
- this.dataGridView1.TabIndex = 0;
- this.dataGridView1.SelectionChanged += new System.EventHandler(this.dataGridView1_SelectionChanged);
- //
- // Column11
- //
- dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column11.DefaultCellStyle = dataGridViewCellStyle12;
- this.Column11.FillWeight = 91.0805F;
- this.Column11.HeaderText = "Column11";
- this.Column11.Name = "Column11";
- this.Column11.ReadOnly = true;
- this.Column11.Width = 37;
- //
- // dataGridViewTextBoxColumn1
- //
- dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle13;
- this.dataGridViewTextBoxColumn1.FillWeight = 91.0805F;
- this.dataGridViewTextBoxColumn1.HeaderText = "dataGridViewTextBoxColumn1";
- this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
- this.dataGridViewTextBoxColumn1.ReadOnly = true;
- this.dataGridViewTextBoxColumn1.Width = 37;
- //
- // dataGridViewTextBoxColumn2
- //
- dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle14;
- this.dataGridViewTextBoxColumn2.FillWeight = 162.4365F;
- this.dataGridViewTextBoxColumn2.HeaderText = "1";
- this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
- this.dataGridViewTextBoxColumn2.ReadOnly = true;
- this.dataGridViewTextBoxColumn2.Width = 37;
- //
- // dataGridViewTextBoxColumn3
- //
- dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle15;
- this.dataGridViewTextBoxColumn3.FillWeight = 91.0805F;
- this.dataGridViewTextBoxColumn3.HeaderText = ".5";
- this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
- this.dataGridViewTextBoxColumn3.ReadOnly = true;
- this.dataGridViewTextBoxColumn3.Width = 37;
- //
- // dataGridViewTextBoxColumn4
- //
- dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle16;
- this.dataGridViewTextBoxColumn4.FillWeight = 91.0805F;
- this.dataGridViewTextBoxColumn4.HeaderText = "dataGridViewTextBoxColumn4";
- this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
- this.dataGridViewTextBoxColumn4.ReadOnly = true;
- this.dataGridViewTextBoxColumn4.Width = 37;
- //
- // dataGridViewTextBoxColumn5
- //
- dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle17;
- this.dataGridViewTextBoxColumn5.FillWeight = 91.0805F;
- this.dataGridViewTextBoxColumn5.HeaderText = "dataGridViewTextBoxColumn5";
- this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
- this.dataGridViewTextBoxColumn5.ReadOnly = true;
- this.dataGridViewTextBoxColumn5.Width = 80;
- //
- // Column8
- //
- dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.Column8.DefaultCellStyle = dataGridViewCellStyle18;
- this.Column8.FillWeight = 91.0805F;
- this.Column8.HeaderText = "Column8";
- this.Column8.Name = "Column8";
- this.Column8.ReadOnly = true;
- this.Column8.Width = 80;
- //
- // Column9
- //
- dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.Column9.DefaultCellStyle = dataGridViewCellStyle19;
- this.Column9.FillWeight = 91.0805F;
- this.Column9.HeaderText = "Column9";
- this.Column9.Name = "Column9";
- this.Column9.ReadOnly = true;
- this.Column9.Width = 80;
- //
- // QuantitativeAnalysisDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(1107, 962);
- this.Controls.Add(this.groupBox9);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox10);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox7);
- this.Controls.Add(this.groupBox8);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Name = "QuantitativeAnalysisDialog";
- this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData);
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.QuantitativeAnalysisDialog_FormClosing);
- this.Load += new System.EventHandler(this.QuantitativeAnalysisDialog_Load);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox8, 0);
- this.Controls.SetChildIndex(this.groupBox7, 0);
- this.Controls.SetChildIndex(this.groupBox4, 0);
- this.Controls.SetChildIndex(this.groupBox10, 0);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.Controls.SetChildIndex(this.groupBox9, 0);
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox8.ResumeLayout(false);
- this.groupBox8.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).EndInit();
- this.groupBox4.ResumeLayout(false);
- this.groupBox4.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
- this.groupBox5.ResumeLayout(false);
- this.groupBox5.PerformLayout();
- this.groupBox6.ResumeLayout(false);
- this.groupBox6.PerformLayout();
- this.groupBox10.ResumeLayout(false);
- this.groupBox10.PerformLayout();
- this.groupBox11.ResumeLayout(false);
- this.groupBox11.PerformLayout();
- this.groupBox9.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- #region 公共按钮
- private void InitCommonButtonEvent()
- {
- this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
- this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
- this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
- this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
- this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
- this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
- }
- private void zoomInButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomIn();
- }
- private void zoomOutButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomOut();
- }
- private void zoomToWindowButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
- }
- private void actualSizeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
- this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
- }
- private void pointerButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
- }
- private void mobileModeButton_Click(object sender, EventArgs e)
- {
- this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
- }
- #endregion
- private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
- {
- }
- private void panel1_Click(object sender, EventArgs e)
- {
- this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
- this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.panel1Changed));
- this.colorsForm1.ShowDialog();
- }
- private void panel1Changed(object sender, EventArgs e)
- {
- this.panel1.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();
- this.colorsForm1.Close();
- }
- private void panel2_Click(object sender, EventArgs e)
- {
- this.colorsForm2.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
- this.colorsForm2.setSaveBtn_Click(new System.EventHandler(this.panel2Changed));
- this.colorsForm2.ShowDialog();
- }
- private void panel2Changed(object sender, EventArgs e)
- {
- this.panel2.BackColor = this.colorsForm2.UserPrimaryColor.ToColor();
- this.colorsForm2.Close();
- }
- private void panel4_Click(object sender, EventArgs e)
- {
- this.colorsForm4.UserPrimaryColor = ColorBgra.FromColor(this.panel4.BackColor);
- this.colorsForm4.setSaveBtn_Click(new System.EventHandler(this.panel4Changed));
- this.colorsForm4.ShowDialog();
- }
- private void panel4Changed(object sender, EventArgs e)
- {
- this.panel4.BackColor = this.colorsForm4.UserPrimaryColor.ToColor();
- this.colorsForm4.Close();
- }
- private void listView1_MouseDown(object sender, MouseEventArgs e)
- {
- this.changeCount = 0;
- }
- private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
- {
- bool change = false;
- if (this.changeCount == 0)
- {
- if (this.dataGridView1.Rows.Count > 0)
- {
- if(this.saveSuccess)
- {
- DialogResult dt = MessageBox.Show(PdnResources.GetString("Menu.Whethertosavetherrentpicture.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- if (dt == DialogResult.Yes)
- {
- string imgName = this.appWorkspace.DocumentWorkspaces[e.ItemIndex].GetFriendlyName();
- string tag = this.imageList1.Images.Keys[e.ItemIndex];
- //int count = 0;
- //foreach (var item in this.p1RectangleFs)
- //{
- // count += item.Count;
- //}
- //foreach (var item in this.p2RectangleFs)
- //{
- // count += item.Count;
- //}
- //if (count == 0)
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleaseadaintercept.Text")+"!");
- // this.changeCount++;
- // return;
- //}
- DataTable dataTable1 = new DataTable();
- bool replace = false;
- int add = 0;
- int nameIndex = 0;
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (item.Tag.Equals(tag))
- {
- add++;
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Themeasurementdertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- replace = true;
- nameIndex = item.Index;
- this.listView2.Items.Remove(item);
- }
- break;
- }
- }
- if (replace || this.listView2.Items.Count == 0 || add == 0)
- {
- ListViewItem listViewItem = new ListViewItem();
- listViewItem.SubItems[0].Text = imgName;
- listViewItem.Tag = tag;
- if (this.listView2.Items.Count == 0)
- this.listView2.Items.Add(listViewItem);
- else
- this.listView2.Items.Insert(nameIndex, listViewItem);
- dataTable1.TableName = tag;
- if (this.allShow)
- {
- int upd = 0;
- int updIndex = 0;
- for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
- {
- if (tag.Equals(this.dataGridView4.Rows[i].Tag.ToString()))
- {
- if (upd == 0)
- updIndex = i;
- this.dataGridView4.Rows.RemoveAt(i);
- upd++;
- }
- }
- foreach (DataGridViewRow Row in this.dataGridView1.Rows)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.Tag = tag;
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- dgvr.Cells[0].Value = imgName;
- dgvr.Cells[1].Value = Row.Cells[0].Value;
- dgvr.Cells[2].Value = Row.Cells[1].Value;
- dgvr.Cells[3].Value = Row.Cells[2].Value;
- dgvr.Cells[4].Value = Row.Cells[3].Value;
- dgvr.Cells[5].Value = Row.Cells[4].Value;
- dgvr.Cells[6].Value = Row.Cells[5].Value;
- this.dataGridView4.Rows.Insert(updIndex, dgvr);
- updIndex++;
- }
- }
- else
- {
- this.dataGridView4.Rows.Clear();
- foreach (DataGridViewRow Row in this.dataGridView1.Rows)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.Tag = tag;
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- dgvr.Cells[0].Value = imgName;
- dgvr.Cells[1].Value = Row.Cells[0].Value;
- dgvr.Cells[2].Value = Row.Cells[1].Value;
- dgvr.Cells[3].Value = Row.Cells[2].Value;
- dgvr.Cells[4].Value = Row.Cells[3].Value;
- dgvr.Cells[5].Value = Row.Cells[4].Value;
- dgvr.Cells[6].Value = Row.Cells[5].Value;
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- foreach (DataTable dataTable2 in pictureDataTables)
- {
- if (dataTable2.TableName.Equals(dataTable1.TableName))
- {
- pictureDataTables.Remove(dataTable2);
- break;
- }
- }
- foreach (DataGridViewColumn c in this.dataGridView4.Columns)
- {
- dataTable1.Columns.Add(c.HeaderText);
- }
- for (int r = 0; r < this.dataGridView1.Rows.Count; r++)
- {
- DataRow dataRow = dataTable1.NewRow();
- for (int c = 0; c < this.dataGridView1.Rows[r].Cells.Count + 1; c++)
- {
- if (c == 0)
- dataRow[this.dataGridView4.Columns[c].HeaderText] = imgName;
- else
- {
- if (c == this.dataGridView1.Rows[r].Cells.Count)
- {
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
- {
- percentage = (Convert.ToDouble(p2RectangleFs[r].Count) / (Convert.ToDouble(p1RectangleFs[r].Count) + Convert.ToDouble(p2RectangleFs[r].Count))) * 100;
- if (double.IsNaN(percentage))
- percentage = 0;
- }
- dataRow[this.dataGridView4.Columns[c].HeaderText] = percentage;
- }
- else if (c == this.dataGridView1.Rows[r].Cells.Count - 1)
- {
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
- {
- percentage = (Convert.ToDouble(p1RectangleFs[r].Count) / (Convert.ToDouble(p1RectangleFs[r].Count) + Convert.ToDouble(p2RectangleFs[r].Count))) * 100;
- if (double.IsNaN(percentage))
- percentage = 0;
- }
- dataRow[this.dataGridView4.Columns[c].HeaderText] = percentage;
- }
- else if (c == this.dataGridView1.Rows[r].Cells.Count - 2)
- {
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
- {
- percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[r].Cells[2].Value)
- + Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[r].Cells[3].Value) * 0.5))
- / Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value)) * 100;
- if (double.IsNaN(percentage))
- percentage = 0;
- }
- dataRow[this.dataGridView4.Columns[c].HeaderText] = percentage;
- }
- else
- dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView1.Rows[r].Cells[c - 1].Value;
- }
- }
- dataTable1.Rows.Add(dataRow);
- }
- this.pictureDataTables.Add(dataTable1);
- if (this.allShow)
- AllShow();
- this.bitDic.Clear();
- foreach (var item in this.bitDic1)
- {
- this.bitDic.Add(item.Key, item.Value);
- }
- this.listView2.Items[0].Selected = true;
- }
- }
- }
- }
- }
- else
- {
- if (change)
- SelectedIndexChanged(sender, e);
- }
- this.changeCount++;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 切换图片
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listView1_SelectedIndexChanged(object sender, EventArgs e)
- {
- SelectedIndexChanged(sender, e);
- }
- /// <summary>
- /// 切换图片
- /// </summary>
- private void SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
- {
- this.unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
- existViewFlag = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList.IsExsitView();
- this.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
- if (!existViewFlag)
- mat = imageMat.Clone();
- else
- mat = PaintDotNet.Camera.Tools.ToMat(this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFullSizeWithRegion());
- //二值化集成4
- binaryClass.listView1_SelectedIndexChanged(this.imageMat.Clone());
- binaryClass.applyButtonImpl();
- if (bcOriginChecked())
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = false;
- this.documentWorkspace.Refresh();
- }
-
- this.dataGridView1.Rows.Clear();
- this.p1RectangleFs.Clear();
- this.p2RectangleFs.Clear();
- Init();
- //RefreshGridIntersections();
- if (this.wholePicture)
- RefreshGridIntersections(false);
- else
- RefreshDrawRegion(PointF.Empty, false);
- this.documentWorkspace.Refresh();
- }
- }
- private void Init()
- {
- this.commonControlButtons.Visible = true;
- this.switchImg = false;
- this.selectPicture = true;
- this.dataGridView1.Rows.Clear();
- }
- /// <summary>
- /// 画布绘制
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Panel_Paint(object sender, PaintEventArgs e)
- {
- if (this.documentWorkspace.CompositionSurface != null)
- {
- //
- // 以下是计算绘制图片的位置和大小并绘制图片
- //
- Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
- int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
- int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
- int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
- int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
- //
- // 以下是绘制网格、标注、测量、视场等开始
- //
- e.Graphics.TranslateTransform(x, y);
- e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
- Draw(e.Graphics);
- if(this.listView1.SelectedItems.Count > 0 && this.dataGridView1.SelectedRows.Count > 0 && this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
- {
- string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString().Replace("相", string.Empty);
- //保存处理后的图片
- double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
- List<Bitmap> tempBit = new List<Bitmap>();
- Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- originalBit.Tag = pantographRatio;
- tempBit.Add(originalBit);
- Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
- Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
- Graphics graphics = Graphics.FromImage(newBit);
- graphics.DrawImage(processedBit, new PointF(0, 0));
- Draw(graphics);
- newBit.Tag = pantographRatio;
- tempBit.Add(newBit);
- if(bitDic1.ContainsKey(tag))
- bitDic1[tag] = tempBit;
- }
- e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
- e.Graphics.TranslateTransform(-x, -y);
- }
- }
- /// <summary>
- /// 绘制
- /// </summary>
- /// <param name="graphics"></param>
- private void Draw(Graphics graphics)
- {
- Pen linePen = new Pen(Color.FromArgb(this.gridColor), this.gridWidth);
- if (this.selected && !this.wholePicture)
- linePen.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;
- if (!this.checkBox4.Checked)
- linePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
- float hGridSpacingDraw;
- float vGridSpacingDraw;
- float blankDraw;
- if(rectangleFs.Count > 0)
- if(this.radioButton1.Checked)
- {
- if (this.p1RectangleFs.Count > 0 && this.dataGridView1.SelectedRows.Count > 0)
- {
- int index = -1;
- // 1截点
- foreach (var pointRectangleF in this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index])
- {
- index++;
- // 绘制点
- PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
- float size = (float)(Convert.ToInt32(this.txt_LeftSize.Text) / unitLength);
- // 圆形
- if (this.rb_LeftCircle.Checked)
- {
- // 实心
- if (this.rb_leftFill.Checked)
- graphics.FillEllipse(new SolidBrush(this.panel1.BackColor), pointF.X - (float)size / 2, pointF.Y - (float)size / 2
- , size, size);
- // 空心
- else
- graphics.DrawEllipse(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- }
- // 方形
- else
- {
- // 实心
- if (this.rb_leftFill.Checked)
- graphics.FillRectangle(new SolidBrush(this.panel1.BackColor)
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- // 空心
- else
- graphics.DrawRectangle(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- }
- }
- }
- if (this.p2RectangleFs.Count > 0 && this.dataGridView1.SelectedRows.Count > 0)
- {
- // 0.5截点
- foreach (var pointRectangleF in this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index])
- {
- // 绘制点
- PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
- float size = (float)(Convert.ToInt32(this.txt_RightSize.Text) / unitLength);
- // 圆形
- if (this.rb_RightCircle.Checked)
- {
- // 实心
- if (this.rb_RightFill.Checked)
- graphics.FillEllipse(new SolidBrush(this.panel2.BackColor)
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- // 空心
- else
- graphics.DrawEllipse(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- }
- // 方形
- else
- {
- // 实心
- if (this.rb_RightFill.Checked)
- graphics.FillRectangle(new SolidBrush(this.panel2.BackColor)
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- // 空心
- else
- graphics.DrawRectangle(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- }
- }
- }
- foreach (RectangleF rectangleF in rectangleFs)
- {
- graphics.DrawLine(linePen, new PointF(rectangleF.Left, rectangleF.Y + rectangleF.Height / 2)
- , new PointF(rectangleF.Right, rectangleF.Y + rectangleF.Height / 2));
- graphics.DrawLine(linePen, new PointF(rectangleF.Left + rectangleF.Width / 2, rectangleF.Top)
- , new PointF(rectangleF.Left + rectangleF.Width / 2, rectangleF.Bottom));
- }
- }
- else
- {
- if (this.wholePicture)
- {
- hGridSpacingDraw = (float)(this.documentWorkspace.CompositionSurface.Height - 2 * this.blank) / (this.hNumber - 1);
- vGridSpacingDraw = (float)(this.documentWorkspace.CompositionSurface.Width - 2 * this.blank) / (this.vNumber - 1);
- blankDraw = this.blank;
- if (this.hNumber > 0)
- {
- if (this.hNumber % 2 == 0)
- {
- float Spacing = hGridSpacingDraw / 2;
- for (int i = 0; i < (float)this.hNumber / 2; i++)
- {
- if (this.wholePicture)
- {
- if (this.documentWorkspace.CompositionSurface.Height > 2 * this.blank && this.documentWorkspace.CompositionSurface.Width > 2 * this.blank)
- {
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= blankDraw)
- {
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing)
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height - blankDraw)
- {
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing)
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing));
- }
- }
- }
- Spacing += hGridSpacingDraw;
- }
- }
- else
- {
- if ((float)this.documentWorkspace.CompositionSurface.Width > 2 * blankDraw)
- {
- if (this.hNumber == 1)
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2)
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2));
- else
- {
- float Spacing = hGridSpacingDraw;
- for (int i = 0; i < (this.hNumber - 1) / 2; i++)
- {
- if (this.wholePicture)
- {
- if (this.documentWorkspace.CompositionSurface.Height > 2 * this.blank && this.documentWorkspace.CompositionSurface.Width > 2 * this.blank)
- {
- if (i == 0)
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2)
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2));
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= blankDraw)
- {
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing)
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height - blankDraw)
- {
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing)
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing));
- }
- }
- }
- Spacing += hGridSpacingDraw;
- }
- }
- }
- }
- }
- if (this.vNumber > 0)
- {
- if (this.vNumber % 2 == 0)
- {
- float Spacing = vGridSpacingDraw / 2;
- for (int i = 0; i < (float)this.vNumber / 2; i++)
- {
- if (this.wholePicture)
- {
- if (this.documentWorkspace.CompositionSurface.Height > 2 * this.blank && this.documentWorkspace.CompositionSurface.Width > 2 * this.blank)
- {
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= blankDraw)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width - blankDraw)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- }
- }
- }
- Spacing += vGridSpacingDraw;
- }
- }
- else
- {
- if (this.documentWorkspace.CompositionSurface.Height > 2 * blankDraw)
- {
- if (this.vNumber == 1)
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- else
- {
- float Spacing = vGridSpacingDraw;
- for (int i = 0; i < (this.vNumber - 1) / 2; i++)
- {
- if (this.wholePicture)
- {
- if (this.documentWorkspace.CompositionSurface.Height > 2 * this.blank && this.documentWorkspace.CompositionSurface.Width > 2 * this.blank)
- {
- if (i == 0)
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width
- && this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width - blankDraw)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0 && (float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= blankDraw)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- }
- }
- }
- Spacing += vGridSpacingDraw;
- }
- }
- }
- }
- }
- }
- else
- {
- hGridSpacingDraw = (float)Math.Round(this.gridSpacing / unitLength);
- vGridSpacingDraw = (float)Math.Round(this.gridSpacing / unitLength);
- if (this.hNumber > 0)
- {
- if (this.hNumber % 2 == 0)
- {
- float Spacing = hGridSpacingDraw / 2;
- for (int i = 0; i < (float)this.hNumber / 2; i++)
- {
- if ((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing >= (float)this.drawRectangleF.Top)
- {
- graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing)
- , new PointF((float)(this.drawRectangleF.Right), (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing));
- }
- if ((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing <= this.drawRectangleF.Bottom)
- {
- graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing)
- , new PointF((float)this.drawRectangleF.Right, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing));
- }
- Spacing += hGridSpacingDraw;
- }
- }
- else
- {
- if (this.hNumber == 1)
- graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2)
- , new PointF((float)this.drawRectangleF.Right, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2));
- else
- {
- float Spacing = hGridSpacingDraw;
- for (int i = 0; i < (this.hNumber - 1) / 2; i++)
- {
- if (i == 0)
- graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2)
- , new PointF((float)this.drawRectangleF.Right, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2));
- if ((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing >= this.drawRectangleF.Top)
- {
- graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing)
- , new PointF((float)this.drawRectangleF.Right, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 - Spacing));
- }
- if ((float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing <= this.drawRectangleF.Bottom)
- {
- graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing)
- , new PointF((float)this.drawRectangleF.Right, (float)this.drawRectangleF.Top + (float)this.drawRectangleF.Height / 2 + Spacing));
- }
- Spacing += hGridSpacingDraw;
- }
- }
- }
- }
- if (this.vNumber > 0)
- {
- if (this.vNumber % 2 == 0)
- {
- float Spacing = vGridSpacingDraw / 2;
- for (int i = 0; i < (float)this.vNumber / 2; i++)
- {
- //if ((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing >= 0)
- {
- graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing, (float)this.drawRectangleF.Top)
- , new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing, (float)this.drawRectangleF.Bottom));
- }
- if ((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing <= this.drawRectangleF.Right)
- {
- graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing, (float)this.drawRectangleF.Top)
- , new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing, (float)this.drawRectangleF.Bottom));
- }
- Spacing += vGridSpacingDraw;
- }
- }
- else
- {
- if (this.vNumber == 1)
- graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2, (float)this.drawRectangleF.Top)
- , new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2, (float)this.drawRectangleF.Bottom));
- else
- {
- float Spacing = vGridSpacingDraw;
- for (int i = 0; i < (this.vNumber - 1) / 2; i++)
- {
- if (i == 0)
- graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2, (float)this.drawRectangleF.Top)
- , new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2, (float)this.drawRectangleF.Bottom));
- if ((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing <= this.drawRectangleF.Right)
- {
- graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing, (float)this.drawRectangleF.Top)
- , new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 + Spacing, (float)this.drawRectangleF.Bottom));
- }
- if ((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing >= this.drawRectangleF.Left)
- {
- graphics.DrawLine(linePen, new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing, (float)this.drawRectangleF.Top)
- , new PointF((float)this.drawRectangleF.Left + (float)this.drawRectangleF.Width / 2 - Spacing, (float)this.drawRectangleF.Bottom));
- }
- Spacing += vGridSpacingDraw;
- }
- }
- }
- }
- }
- if (this.p1RectangleFs.Count > 0 && this.dataGridView1.SelectedRows.Count > 0)
- {
- int index = -1;
- // 1截点
- foreach (var pointRectangleF in this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index])
- {
- index++;
- // 绘制点
- PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
- float size = (float)(Convert.ToInt32(this.txt_LeftSize.Text) / unitLength);
- // 圆形
- if (this.rb_LeftCircle.Checked)
- {
- // 实心
- if (this.rb_leftFill.Checked)
- graphics.FillEllipse(new SolidBrush(this.panel1.BackColor), pointF.X - (float)size / 2, pointF.Y - (float)size / 2
- , size, size);
- // 空心
- else
- graphics.DrawEllipse(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- }
- // 方形
- else
- {
- // 实心
- if (this.rb_leftFill.Checked)
- graphics.FillRectangle(new SolidBrush(this.panel1.BackColor)
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- // 空心
- else
- graphics.DrawRectangle(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- }
- }
- }
- if (this.p2RectangleFs.Count > 0 && this.dataGridView1.SelectedRows.Count > 0)
- {
- // 0.5截点
- foreach (var pointRectangleF in this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index])
- {
- // 绘制点
- PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
- float size = (float)(Convert.ToInt32(this.txt_RightSize.Text) / unitLength);
- // 圆形
- if (this.rb_RightCircle.Checked)
- {
- // 实心
- if (this.rb_RightFill.Checked)
- graphics.FillEllipse(new SolidBrush(this.panel2.BackColor)
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- // 空心
- else
- graphics.DrawEllipse(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- }
- // 方形
- else
- {
- // 实心
- if (this.rb_RightFill.Checked)
- graphics.FillRectangle(new SolidBrush(this.panel2.BackColor)
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- // 空心
- else
- graphics.DrawRectangle(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- }
- }
- }
- }
-
- }
- private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBox5_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBoxLeftSize_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBoxLeftWidth_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBoxRightSize_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBoxRightWidth_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- /// <summary>
- /// 水平线值
- /// </summary>
- private string hText;
- /// <summary>
- /// 垂直线值
- /// </summary>
- private string vText;
- /// <summary>
- /// 线宽值
- /// </summary>
- private string wText;
- /// <summary>
- /// 间距值
- /// </summary>
- private string sText;
- /// <summary>
- /// 水平线数量改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void textBox2_TextChanged(object sender, EventArgs e)
- {
- PointF pointF = new PointF(this.drawRectangleF.X, this.drawRectangleF.Y);
- if (string.IsNullOrEmpty(this.textBox2.Text))
- this.textBox2.Text = "0";
- if (this.textBox2.Text.Length > 1 && this.textBox2.Text.Substring(0, 1).Equals("0"))
- this.textBox2.Text = this.textBox2.Text.Substring(1, (this.textBox2.Text.Length - 1));
- if (Convert.ToInt32(this.textBox2.Text) > 100000)
- this.textBox2.Text = "100000";
- if (Convert.ToInt32(this.textBox2.Text) > 0)
- this.hNumber = Convert.ToInt32(this.textBox2.Text) + 1;
- else
- this.hNumber = 0;
- if (selectPicture)
- {
- if (this.wholePicture)
- RefreshGridIntersections(false);
- else
- RefreshDrawRegion(pointF, false);
- }
- //RefreshGridIntersections();
- if (this.exceed)
- this.textBox2.Text = this.hText;
- foreach (var item in this.p1RectangleFs)
- {
- item.Clear();
- }
- foreach (var item in this.p2RectangleFs)
- {
- item.Clear();
- }
- //this.p1RectangleFs.Clear();
- //this.p2RectangleFs.Clear();
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[2].Value = 0;
- this.dataGridView1.Rows[i].Cells[3].Value = 0;
- this.dataGridView1.Rows[i].Cells[5].Value = 0;
- this.dataGridView1.Rows[i].Cells[6].Value = 0;
- this.dataGridView1.Rows[i].Cells[7].Value = 0;
- }
- if (this.dataGridView1.Rows.Count > 0)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[4].Value = this.rectangleFs.Count;
- }
- }
- this.hText = this.textBox2.Text;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 垂线数量改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void textBox3_TextChanged(object sender, EventArgs e)
- {
- PointF pointF = new PointF(this.drawRectangleF.X, this.drawRectangleF.Y);
- if (string.IsNullOrEmpty(this.textBox3.Text))
- this.textBox3.Text = "0";
- if (this.textBox3.Text.Length > 1 && this.textBox3.Text.Substring(0, 1).Equals("0"))
- this.textBox3.Text = this.textBox3.Text.Substring(1, (this.textBox3.Text.Length - 1));
- if (Convert.ToInt32(this.textBox3.Text) > 100000)
- this.textBox3.Text = "100000";
- if (Convert.ToInt32(this.textBox3.Text) > 0)
- this.vNumber = Convert.ToInt32(this.textBox3.Text) + 1;
- else
- this.vNumber = 0;
- if (selectPicture)
- {
- if (this.wholePicture)
- RefreshGridIntersections(false);
- else
- RefreshDrawRegion(pointF, false);
- }
- if (this.exceed)
- this.textBox3.Text = this.vText;
- foreach (var item in this.p1RectangleFs)
- {
- item.Clear();
- }
- foreach (var item in this.p2RectangleFs)
- {
- item.Clear();
- }
- //this.p1RectangleFs.Clear();
- //this.p2RectangleFs.Clear();
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[2].Value = 0;
- this.dataGridView1.Rows[i].Cells[3].Value = 0;
- this.dataGridView1.Rows[i].Cells[5].Value = 0;
- this.dataGridView1.Rows[i].Cells[6].Value = 0;
- this.dataGridView1.Rows[i].Cells[7].Value = 0;
- }
- if (this.dataGridView1.Rows.Count > 0)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[4].Value = this.rectangleFs.Count;
- }
- }
- this.vText = this.textBox3.Text;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 网格线宽改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void textBox4_TextChanged(object sender, EventArgs e)
- {
- PointF pointF = new PointF(this.drawRectangleF.X, this.drawRectangleF.Y);
- if (string.IsNullOrEmpty(this.textBox4.Text))
- this.textBox4.Text = "0";
- if (this.textBox4.Text.Length > 1 && this.textBox4.Text.Substring(0, 1).Equals("0"))
- this.textBox4.Text = this.textBox4.Text.Substring(1, (this.textBox4.Text.Length - 1));
- if (Convert.ToInt32(this.textBox4.Text) > 100000)
- this.textBox4.Text = "100000";
- this.gridWidth = Convert.ToInt32(this.textBox4.Text);
- if (selectPicture)
- {
- if (this.wholePicture)
- RefreshGridIntersections(false);
- else
- RefreshDrawRegion(pointF, false);
- }
- if (this.exceed)
- this.textBox4.Text = this.wText;
- this.wText = this.textBox4.Text;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 网格间距改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void textBox5_TextChanged(object sender, EventArgs e)
- {
- PointF pointF = new PointF(this.drawRectangleF.X, this.drawRectangleF.Y);
- if (string.IsNullOrEmpty(this.textBox5.Text))
- this.textBox5.Text = "0";
- if(this.textBox5.Text.Length > 1 && this.textBox5.Text.Substring(0, 1).Equals("0"))
- this.textBox5.Text = this.textBox5.Text.Substring(1, (this.textBox5.Text.Length - 1));
- if (Convert.ToInt32(this.textBox5.Text) > 100000)
- this.textBox5.Text = "100000";
- this.gridSpacing = Convert.ToInt32(this.textBox5.Text);
- if (selectPicture)
- {
- if (this.wholePicture)
- RefreshGridIntersections(false);
- else
- RefreshDrawRegion(pointF, false);
- }
- if (this.exceed)
- this.textBox5.Text = this.sText;
- //this.p1RectangleFs.Clear();
- //this.p2RectangleFs.Clear();
- foreach (var item in this.p1RectangleFs)
- {
- item.Clear();
- }
- foreach (var item in this.p2RectangleFs)
- {
- item.Clear();
- }
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[2].Value = 0;
- this.dataGridView1.Rows[i].Cells[3].Value = 0;
- this.dataGridView1.Rows[i].Cells[5].Value = 0;
- this.dataGridView1.Rows[i].Cells[6].Value = 0;
- this.dataGridView1.Rows[i].Cells[7].Value = 0;
- }
- if (this.dataGridView1.Rows.Count > 0)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[4].Value = this.rectangleFs.Count;
- }
- }
- this.sText = this.textBox5.Text;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 网格颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void panel4_BackColorChanged(object sender, EventArgs e)
- {
- this.gridColor = Convert.ToInt32(this.panel4.BackColor.ToArgb());
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 是否全图
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- PointF pointF = new PointF(this.drawRectangleF.X, this.drawRectangleF.Y);
- if (this.checkBox2.Checked)
- {
- this.label10.Visible = false;
- this.textBox5.Visible = false;
- this.label12.Visible = true;
- this.numericUpDown4.Visible = true;
- }
- else
- {
- this.label10.Visible = true;
- this.textBox5.Visible = true;
- this.label12.Visible = false;
- this.numericUpDown4.Visible = false;
- }
- this.wholePicture = this.checkBox2.Checked;
- if (selectPicture)
- {
- if (this.wholePicture)
- RefreshGridIntersections(false);
- else
- RefreshDrawRegion(pointF, false);
- }
- //this.p1RectangleFs.Clear();
- //this.p2RectangleFs.Clear();
- foreach (var item in this.p1RectangleFs)
- {
- item.Clear();
- }
- foreach (var item in this.p2RectangleFs)
- {
- item.Clear();
- }
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[2].Value = 0;
- this.dataGridView1.Rows[i].Cells[3].Value = 0;
- this.dataGridView1.Rows[i].Cells[5].Value = 0;
- this.dataGridView1.Rows[i].Cells[6].Value = 0;
- this.dataGridView1.Rows[i].Cells[7].Value = 0;
- }
- if (this.dataGridView1.Rows.Count > 0)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[4].Value = this.rectangleFs.Count;
- }
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 余白改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown4_ValueChanged(object sender, EventArgs e)
- {
- PointF pointF = new PointF(this.drawRectangleF.X, this.drawRectangleF.Y);
- this.blank =(float)Math.Round(Convert.ToInt32(this.numericUpDown4.Value) / unitLength);
- if (selectPicture)
- {
- if (this.wholePicture)
- RefreshGridIntersections(false);
- else
- RefreshDrawRegion(pointF, false);
- }
- //this.p1RectangleFs.Clear();
- //this.p2RectangleFs.Clear();
- foreach (var item in this.p1RectangleFs)
- {
- item.Clear();
- }
- foreach (var item in this.p2RectangleFs)
- {
- item.Clear();
- }
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[2].Value = 0;
- this.dataGridView1.Rows[i].Cells[3].Value = 0;
- this.dataGridView1.Rows[i].Cells[5].Value = 0;
- this.dataGridView1.Rows[i].Cells[6].Value = 0;
- this.dataGridView1.Rows[i].Cells[7].Value = 0;
- }
- if (this.dataGridView1.Rows.Count > 0)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[4].Value = this.rectangleFs.Count;
- }
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 另存为按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- List<string> items;
- if (this.comboBox1.Items != null && this.comboBox1.Items.Count > 0)
- {
- items = new List<string>(this.comboBox1.Items.Count);
- foreach (var item in this.comboBox1.Items)
- {
- items.Add(item.ToString());
- }
- }
- else
- {
- items = null;
- }
- QuantitativeAnalysisGridSaveDialog quantitativeAnalysisGridSaveDialog = new QuantitativeAnalysisGridSaveDialog(items);
- quantitativeAnalysisGridSaveDialog.StartPosition = FormStartPosition.CenterScreen;
- quantitativeAnalysisGridSaveDialog.ShowDialog(this);
- }
- /// <summary>
- /// 切换网格
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.comboBox1.SelectedIndex > -1)
- {
- if (quantitativeAnalysisModel.GridStyleList != null)
- {
- foreach (var GridStyle in quantitativeAnalysisModel.GridStyleList)
- {
- if (GridStyle.gridName.Equals(this.comboBox1.SelectedItem))
- {
- this.textBox2.Text = GridStyle.hNumber.ToString();
- this.textBox3.Text = GridStyle.vNumber.ToString();
- this.textBox4.Text = GridStyle.gridWidth.ToString();
- this.textBox5.Text = GridStyle.gridSpacing.ToString();
- this.panel4.BackColor = Color.FromArgb(GridStyle.gridColor);
- this.checkBox2.Checked = GridStyle.wholePicture;
- this.numericUpDown4.Value = GridStyle.blank;
- }
- }
- }
- if (this.checkBox2.Checked)
- {
- this.label10.Visible = false;
- this.textBox5.Visible = false;
- this.label12.Visible = true;
- this.numericUpDown4.Visible = true;
- }
- else
- {
- this.label10.Visible = true;
- this.textBox5.Visible = true;
- this.label12.Visible = false;
- this.numericUpDown4.Visible = false;
- }
- //this.p1RectangleFs.Clear();
- //this.p2RectangleFs.Clear();
- foreach (var item in this.p1RectangleFs)
- {
- item.Clear();
- }
- foreach (var item in this.p2RectangleFs)
- {
- item.Clear();
- }
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[2].Value = 0;
- this.dataGridView1.Rows[i].Cells[3].Value = 0;
- this.dataGridView1.Rows[i].Cells[5].Value = 0;
- this.dataGridView1.Rows[i].Cells[6].Value = 0;
- this.dataGridView1.Rows[i].Cells[7].Value = 0;
- }
- }
- }
- /// <summary>
- /// 截点1形状改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void rb_LeftCircle_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点1样式改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void rb_leftFill_CheckedChanged(object sender, EventArgs e)
- {
- if(this.rb_leftFill.Checked)
- {
- this.label20.Visible = false;
- this.txt_LeftLineWeight.Visible = false;
- }
- else
- {
- this.label20.Visible = true;
- this.txt_LeftLineWeight.Visible = true;
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点1大小改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_LeftSize_TextChanged(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.txt_LeftSize.Text))
- this.txt_LeftSize.Text = "0";
- if (this.txt_LeftSize.Text.Length > 1 && this.txt_LeftSize.Text.Substring(0, 1).Equals("0"))
- this.txt_LeftSize.Text = this.txt_LeftSize.Text.Substring(1, (this.txt_LeftSize.Text.Length - 1));
- if (Convert.ToInt32(this.txt_LeftSize.Text) > 100000)
- this.txt_LeftSize.Text = "100000";
- if(p1RectangleFs.Count > 0)
- {
- for (int i = 0; i < this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count; i++)
- {
- RectangleF pointRectangleF = this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i];
- // 绘制点
- PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
- float size = (float)(Convert.ToInt32(this.txt_LeftSize.Text) / unitLength);
- RectangleF rectangleF = new RectangleF(pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i] = rectangleF;
- }
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点1线宽改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_LeftLineWeight_TextChanged(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.txt_LeftLineWeight.Text))
- this.txt_LeftLineWeight.Text = "0";
- if (this.txt_LeftLineWeight.Text.Length > 1 && this.txt_LeftLineWeight.Text.Substring(0, 1).Equals("0"))
- this.txt_LeftLineWeight.Text = this.txt_LeftLineWeight.Text.Substring(1, (this.txt_LeftLineWeight.Text.Length - 1));
- if (Convert.ToInt32(this.txt_LeftLineWeight.Text) > 100000)
- this.txt_LeftLineWeight.Text = "100000";
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点0.5形状改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void rb_RightCircle_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点0.5样式改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void rb_RightFill_CheckedChanged(object sender, EventArgs e)
- {
- if (this.rb_RightFill.Checked)
- {
- this.label15.Visible = false;
- this.txt_RightLineWeight.Visible = false;
- }
- else
- {
- this.label15.Visible = true;
- this.txt_RightLineWeight.Visible = true;
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点0.5大小改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_RightSize_TextChanged(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.txt_RightSize.Text))
- this.txt_RightSize.Text = "0";
- if (this.txt_RightSize.Text.Length > 1 && this.txt_RightSize.Text.Substring(0, 1).Equals("0"))
- this.txt_RightSize.Text = this.txt_RightSize.Text.Substring(1, (this.txt_RightSize.Text.Length - 1));
- if (Convert.ToInt32(this.txt_RightSize.Text) > 100000)
- this.txt_RightSize.Text = "100000";
- if(p2RectangleFs.Count > 0)
- {
- for (int i = 0; i < this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count; i++)
- {
- RectangleF pointRectangleF = this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i];
- // 绘制点
- PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
- float size = (float)(Convert.ToInt32(this.txt_RightSize.Text) / unitLength);
- RectangleF rectangleF = new RectangleF(pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i] = rectangleF;
- }
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点0.5线宽改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_RightLineWeight_TextChanged(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.txt_RightLineWeight.Text))
- this.txt_RightLineWeight.Text = "0";
- if (this.txt_RightLineWeight.Text.Length > 1 && this.txt_RightLineWeight.Text.Substring(0, 1).Equals("0"))
- this.txt_RightLineWeight.Text = this.txt_RightLineWeight.Text.Substring(1, (this.txt_RightLineWeight.Text.Length - 1));
- if (Convert.ToInt32(this.txt_RightLineWeight.Text) > 100000)
- this.txt_RightLineWeight.Text = "100000";
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点0.5颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void panel2_BackColorChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 开始测量
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- if (this.listView1.SelectedItems.Count > 0)
- {
- this.startText = true;
- this.button6.Visible = false;
- this.button7.Visible = true;
- this.comboBox1.Enabled = false;
- this.button3.Enabled = false;
- this.button4.Enabled = false;
- this.button5.Enabled = false;
- this.groupBox4.Enabled = false;
- this.button7.Focus();
- if (this.dataGridView1.Rows.Count > 0)
- {
- this.dataGridView1.Rows.Clear();
- this.p1RectangleFs.Clear();
- this.p2RectangleFs.Clear();
- this.documentWorkspace.Refresh();
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- }
- }
- /// <summary>
- /// 停止测量
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button7_Click(object sender, EventArgs e)
- {
- this.button6.Visible = true;
- this.button7.Visible = false;
- this.comboBox1.Enabled = true;
- this.button3.Enabled = true;
- this.button4.Enabled = true;
- this.button5.Enabled = true;
- this.groupBox4.Enabled = true;
- this.button6.Focus();
- }
- /// <summary>
- /// 截点颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void panel1_BackColorChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 保存按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, EventArgs e)
- {
- if(this.comboBox1.Items.Count == 0)
- {
- QuantitativeAnalysisGridSaveDialog quantitativeAnalysisGridSaveDialog = new QuantitativeAnalysisGridSaveDialog(null);
- quantitativeAnalysisGridSaveDialog.StartPosition = FormStartPosition.CenterScreen;
- quantitativeAnalysisGridSaveDialog.ShowDialog(this);
- }
- else
- {
- RefreshGridItems(null);
- }
- }
- /// <summary>
- /// 删除选中网格
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button5_Click(object sender, EventArgs e)
- {
- if (this.comboBox1.SelectedIndex > -1 && this.comboBox1.DataSource != null)
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethegrid.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- int index = this.comboBox1.SelectedIndex;
- if (this.quantitativeAnalysisModel.GridStyleList != null)
- {
- foreach (var GridStyle in this.quantitativeAnalysisModel.GridStyleList)
- {
- if (GridStyle.gridName.Equals(this.comboBox1.SelectedItem))
- {
- this.quantitativeAnalysisModel.GridStyleList.Remove(GridStyle);
- break;
- }
- }
- }
- ArrayList arrayList = new ArrayList();
- foreach (var GridStyle in quantitativeAnalysisModel.GridStyleList)
- {
- arrayList.Add(GridStyle.gridName);
- }
- this.comboBox1.DataSource = null;
- this.comboBox1.DataSource = arrayList;
- if (this.comboBox1.Items.Count > 0)
- {
- if (index == 0)
- this.comboBox1.SelectedIndex = index;
- else
- this.comboBox1.SelectedIndex = index - 1;
- }
- else
- {
- this.textBox2.Text = "0";
- this.textBox3.Text = "0";
- this.textBox4.Text = "0";
- this.textBox5.Text = "0";
- this.numericUpDown4.Value = 0;
- this.checkBox2.Checked = false;
- this.label10.Visible = true;
- this.textBox5.Visible = true;
- this.label12.Visible = false;
- this.numericUpDown4.Visible = false;
- }
- //以下保存xml文件信息
- string stageModelXml = XmlSerializeHelper.XmlSerialize<QuantitativeAnalysisModel>(quantitativeAnalysisModel);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\QuantitativeAnalysisModel.xml";
- FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Nogrid.text")+"!");
- }
- }
- /// <summary>
- /// 鼠标按下
- /// </summary>
- /// <param name="drawArea"></param>
- /// <param name="e"></param>
- private void OnMouseDown(object sender, MouseEventArgs e)
- {
- // 换算后的点
- PointF point1 = documentWorkspace.GetScalePoint(e.Location);
- if (!this.wholePicture && this.checkBox4.Checked)
- {
- if (e.Button == MouseButtons.Left)
- {
- if (this.drawRectangleF.Contains(point1))
- {
- canMove = true;
- oldLocation = point1;
- selected = true;
- this.documentWorkspace.panel.Focus();
- }
- else
- selected = false;
- }
- }
- if (this.checkBox4.Checked)
- return;
- if (this.button6.Visible)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!");
- return;
- }
- if (this.dataGridView1.SelectedRows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectadaphase.text")+"!");
- return;
- }
- bool canAdd1 = true;
- bool canAdd2 = true;
- if (p2RectangleFs.Count > 0)
- {
- foreach (var rectangleF in p2RectangleFs[this.dataGridView1.SelectedRows[0].Index])
- {
- if (rectangleF.Contains(point1))
- {
- canAdd1 = false;
- if (e.Button == MouseButtons.Left && e.Clicks == 2)
- {
- p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Remove(rectangleF);
- this.saveSuccess = true;
- break;
- }
- }
- }
- }
- if (p1RectangleFs.Count > 0)
- {
- foreach (var rectangleF in p1RectangleFs[this.dataGridView1.SelectedRows[0].Index])
- {
- if (rectangleF.Contains(point1))
- {
- canAdd2 = false;
- if (e.Button == MouseButtons.Left && e.Clicks == 2)
- {
- p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Remove(rectangleF);
- this.saveSuccess = true;
- break;
- }
- }
- }
- }
- if (e.Button == MouseButtons.Left)
- {
- float size = (float)(Convert.ToInt32(this.txt_LeftSize.Text) / unitLength);
- foreach (RectangleF rectangleF in this.rectangleFs)
- {
- if (canAdd1 && canAdd2)
- {
- if (rectangleF.Contains(point1))
- {
- p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Add(new RectangleF(rectangleF.X + (float)rectangleF.Width / 2 - (float)(size / 2)
- , rectangleF.Y + (float)rectangleF.Height / 2 - (float)(size / 2)
- , size, size));
- this.saveSuccess = true;
- }
- }
- }
- }
- if (e.Button == MouseButtons.Right)
- {
- float size = (float)(Convert.ToInt32(this.txt_RightSize.Text) / unitLength);
- foreach (RectangleF rectangleF in this.rectangleFs)
- {
- if (canAdd1 && canAdd2)
- {
- if (rectangleF.Contains(point1))
- {
- p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Add(new RectangleF(rectangleF.X + (float)rectangleF.Width / 2 - (float)(size / 2)
- , rectangleF.Y + (float)rectangleF.Height / 2 - (float)(size / 2)
- , size, size));
- this.saveSuccess = true;
- }
- }
- }
- }
- if (this.p1RectangleFs.Count > 0)
- {
- this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[2].Value = p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count;
- }
- else
- {
- this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[2].Value = 0;
- }
- if (this.p2RectangleFs.Count > 0)
- {
- this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[3].Value = p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count;
- }
- else
- {
- this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[3].Value = 0;
- }
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[4].Value) > 0)
- {
- percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[2].Value)
- + Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[3].Value) * 0.5))
- / Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[4].Value)) * 100;
- }
- this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[5].Value = Math.Round(percentage, Convert.ToInt32(this.numericUpDown1.Value));
- if (this.p1RectangleFs.Count > 0 && p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count > 0)
- this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[6].Value = Math.Round((Convert.ToDouble(p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count)
- / (Convert.ToDouble(p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count) + Convert.ToDouble(p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count))) * 100, Convert.ToInt32(this.numericUpDown1.Value));
- else
- this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[6].Value = 0;
- if (this.p2RectangleFs.Count > 0 && p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count > 0)
- this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[7].Value = Math.Round((Convert.ToDouble(p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count)
- / (Convert.ToDouble(p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count) + Convert.ToDouble(p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count))) * 100, Convert.ToInt32(this.numericUpDown1.Value));
- else
- this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[7].Value = 0;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 移动
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMove(object sender, MouseEventArgs e)
- {
- if (!this.wholePicture && this.checkBox4.Checked)
- {
- // 换算后的点
- PointF point1 = documentWorkspace.GetScalePoint(e.Location);
- if (e.Button == MouseButtons.Left && canMove)
- {
- // 矩形偏移
- this.drawRectangleF.Offset(point1.X - this.oldLocation.X, point1.Y - this.oldLocation.Y);
- if (this.dataGridView1.SelectedRows.Count > 0 && this.p1RectangleFs.Count > 0)
- {
- for (int i = 0; i < this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count; i++)
- {
- RectangleF rectangleF1 = this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i];
- rectangleF1.Offset(point1.X - this.oldLocation.X, point1.Y - this.oldLocation.Y);
- this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i] = rectangleF1;
- }
- }
- if (this.dataGridView1.SelectedRows.Count > 0 && this.p2RectangleFs.Count > 0)
- {
- for (int i = 0; i < this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count; i++)
- {
- RectangleF rectangleF1 = this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i];
- rectangleF1.Offset(point1.X - this.oldLocation.X, point1.Y - this.oldLocation.Y);
- this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i] = rectangleF1;
- }
- }
- this.oldLocation = point1;
- }
- RefreshDrawRegion(this.drawRectangleF.Location, true);
- this.documentWorkspace.Refresh();
- }
- }
- /// <summary>
- /// 鼠标抬起
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void OnMouseUp(object sender, MouseEventArgs e)
- {
- canMove = false;
- }
- /// <summary>
- /// 键盘事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onPreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
- {
- if (this.selected && (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down || e.KeyCode == Keys.Left || e.KeyCode == Keys.Right))
- {
- PointF pointF = this.drawRectangleF.Location;
- if (e.KeyCode == Keys.Up)
- pointF.Y -= 5;
- else if (e.KeyCode == Keys.Down)
- pointF.Y += 5;
- else if (e.KeyCode == Keys.Left)
- pointF.X -= 5;
- else if (e.KeyCode == Keys.Right)
- pointF.X += 5;
- this.drawRectangleF.Location = pointF;
- if (this.dataGridView1.SelectedRows.Count > 0 && this.p1RectangleFs.Count > 0)
- {
- RectangleF rectangleF = new RectangleF();
- PointF pointF1 = new PointF();
- for (int i = 0; i < this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count; i++)
- {
- rectangleF = this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i];
- pointF1 = this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i].Location;
- if (e.KeyCode == Keys.Up)
- pointF1.Y -= 5;
- else if (e.KeyCode == Keys.Down)
- pointF1.Y += 5;
- else if (e.KeyCode == Keys.Left)
- pointF1.X -= 5;
- else if (e.KeyCode == Keys.Right)
- pointF1.X += 5;
- rectangleF.Location = pointF1;
- this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index][i] = rectangleF;
- }
- }
- if (this.dataGridView1.SelectedRows.Count > 0 && this.p2RectangleFs.Count > 0)
- {
- RectangleF rectangleF = new RectangleF();
- PointF pointF1 = new PointF();
- for (int i = 0; i < this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count; i++)
- {
- rectangleF = this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i];
- pointF1 = this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i].Location;
- if (e.KeyCode == Keys.Up)
- pointF1.Y -= 5;
- else if (e.KeyCode == Keys.Down)
- pointF1.Y += 5;
- else if (e.KeyCode == Keys.Left)
- pointF1.X -= 5;
- else if (e.KeyCode == Keys.Right)
- pointF1.X += 5;
- rectangleF.Location = pointF1;
- this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index][i] = rectangleF;
- }
- }
- this.documentWorkspace.Refresh();
- }
- }
- private void dataGridView1_SelectionChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 取消全部显示
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button16_Click(object sender, EventArgs e)
- {
- this.allShow = false;
- this.button11.Visible = true;
- this.button16.Visible = false;
- if(this.listView2.Items.Count > 0)
- {
- if (this.listView2.SelectedItems.Count > 0)
- {
- List<int> dataTableIndex = new List<int>();
- if (this.pictureDataTables.Count == 0)
- return;
- for (int i = 0; i < this.pictureDataTables.Count; i++)
- {
- foreach (ListViewItem item in this.listView2.SelectedItems)
- {
- if (this.pictureDataTables[i].TableName.Equals(item.Tag))
- dataTableIndex.Add(i);
- }
- }
- this.dataGridView4.Rows.Clear();
- foreach (var item in dataTableIndex)
- {
- if (this.pictureDataTables[item].Rows.Count > 0)
- {
- for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.Tag = this.pictureDataTables[item].TableName;
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
- {
- if (c == this.pictureDataTables[item].Columns.Count - 1 || c == this.pictureDataTables[item].Columns.Count - 2 || c == this.pictureDataTables[item].Columns.Count - 3)
- dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
- else
- dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
- }
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- }
- }
- else
- {
- this.listView2.Items[0].Selected = true;
- if (this.pictureDataTables.Count > 0
- && this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count > 0)
- {
- this.dataGridView4.Rows.Clear();
- for (int r = 0; r < this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count; r++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.Tag = this.pictureDataTables[this.pictureDataTables.Count - 1].TableName;
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count; c++)
- {
- if(c == this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count - 1 || c == this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count - 2 || c == this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count - 3)
- dgvr.Cells[c].Value =Math.Round((double)Convert.ToDecimal( this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
- else
- dgvr.Cells[c].Value =this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c].ToString();
- }
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- }
- }
- }
- /// <summary>
- /// 分析结果删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button12_Click(object sender, EventArgs e)
- {
- if (this.listView2.Items.Count > 0)
- {
- if (this.listView2.SelectedItems.Count > 0)
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethisanalysisresult.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- List<string> detaleName = new List<string>();
- int selectIndex = this.listView2.SelectedItems[0].Index;
- foreach (ListViewItem item in this.listView2.SelectedItems)
- {
- detaleName.Add(item.Tag.ToString());
- this.listView2.Items.Remove(item);
- }
- foreach (string tag in detaleName)
- {
- foreach (DataTable dataTable in this.pictureDataTables)
- {
- if (dataTable.TableName.Equals(tag))
- {
- this.pictureDataTables.Remove(dataTable);
- break;
- }
- }
- for (int i = 0; i < bitDic.Count; i++)
- {
- foreach (var item in bitDic)
- {
- string keyDe = item.Key.Substring(0, item.Key.IndexOf("|"));
- if (tag.Equals(keyDe))
- {
- bitDic.Remove(item.Key);
- break;
- }
- }
- }
- foreach (ExportProjectModel model in this.tempDataModel)
- {
- if (model.tagName.Equals(tag))
- {
- this.tempDataModel.Remove(model);
- break;
- }
- }
- }
- if (this.listView2.Items.Count > 0)
- {
- if (selectIndex == 0)
- this.listView2.Items[0].Selected = true;
- else
- this.listView2.Items[selectIndex - 1].Selected = true;
- RefreshDataGridView4();
- }
- else
- {
- this.dataGridView4.Rows.Clear();
- }
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheanalysisresulttodelete.text")+"!");
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Nodataintheanalysisresults.text")+"!");
- }
- }
- /// <summary>
- /// 刷新分析结果数据
- /// </summary>
- private void RefreshDataGridView4()
- {
- if (!this.allShow)
- {
- if (this.listView2.SelectedItems.Count > 0)
- {
- List<int> dataTableIndex = new List<int>();
- for (int i = 0; i < this.pictureDataTables.Count; i++)
- {
- foreach (ListViewItem item in this.listView2.SelectedItems)
- {
- if (this.pictureDataTables[i].TableName.Equals(item.Tag))
- dataTableIndex.Add(i);
- }
- }
- if (this.pictureDataTables.Count == 0)
- return;
- this.dataGridView4.Rows.Clear();
- foreach (var item in dataTableIndex)
- {
- if (this.pictureDataTables[item].Rows.Count > 0)
- {
- for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.Tag = this.pictureDataTables[item].TableName;
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
- {
- if (c != this.pictureDataTables[item].Columns.Count - 1 && c != this.pictureDataTables[item].Columns.Count - 2 && c != this.pictureDataTables[item].Columns.Count - 3)
- dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
- else
- dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
- }
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- }
- }
- }
- else
- {
- this.dataGridView4.Rows.Clear();
- DataTable dataTable = new DataTable();
- for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
- {
- dataTable = this.pictureDataTables[i];
- for (int r = 0; r < dataTable.Rows.Count; r++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.Tag = dataTable.TableName;
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < dataTable.Columns.Count; c++)
- {
- if(c != dataTable.Columns.Count - 1 && c != dataTable.Columns.Count - 2 && c != dataTable.Columns.Count - 3)
- dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
- else
- dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
- }
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- }
- }
- /// <summary>
- /// 切换分析结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listView2_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (!this.allShow)
- {
- if (this.listView2.SelectedItems.Count > 0)
- {
- List<int> dataTableIndex = new List<int>();
- if (this.pictureDataTables.Count == 0)
- return;
- for (int i = 0; i < this.pictureDataTables.Count; i++)
- {
- foreach (ListViewItem item in this.listView2.SelectedItems)
- {
- if (this.pictureDataTables[i].TableName.Equals(item.Tag))
- dataTableIndex.Add(i);
- }
-
- }
- this.dataGridView4.Rows.Clear();
- foreach (var item in dataTableIndex)
- {
- if (this.pictureDataTables[item].Rows.Count > 0)
- {
- for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.Tag = this.pictureDataTables[item].TableName;
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
- {
- if (c == this.pictureDataTables[item].Columns.Count - 1 || c == this.pictureDataTables[item].Columns.Count - 2 || c == this.pictureDataTables[item].Columns.Count - 3)
- dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
- else
- dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
- }
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- }
- }
- }
- }
- /// <summary>
- /// 未选择分析结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listView2_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
- {
- if (!this.allShow)
- {
- if (this.listView2.SelectedItems.Count == 0)
- this.dataGridView4.Rows.Clear();
- }
- }
- /// <summary>
- /// 全部显示
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button11_Click(object sender, EventArgs e)
- {
- this.allShow = true;
- this.button11.Visible = false;
- this.button16.Visible = true;
- this.button16.Focus();
- AllShow();
- }
- private void AllShow()
- {
- this.dataGridView4.Rows.Clear();
- DataTable dataTable = new DataTable();
- for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
- {
- dataTable = this.pictureDataTables[i];
- for (int r = 0; r < dataTable.Rows.Count; r++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.Tag = dataTable.TableName;
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < dataTable.Columns.Count; c++)
- {
- if (c == dataTable.Columns.Count - 1 || c == dataTable.Columns.Count - 2 || c == dataTable.Columns.Count - 3)
- dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
- else
- dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
- }
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- }
- /// <summary>
- /// 添加相
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void but_AddPhase_Click(object sender, EventArgs e)
- {
- if(this.button6.Visible)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!");
- return;
- }
- if (this.documentWorkspace.phaseModels.Count == 0 || (this.documentWorkspace.phaseModels.Count != 0 && this.documentWorkspace.phaseModels[0].mat == null))
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformbinarizationoperationfirst.text")+"!");
- return;
- }
- DataGridViewRow dgvr = new DataGridViewRow();
- foreach (DataGridViewColumn c in this.dataGridView1.Columns)
- {
- dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
- }
- ArrayList arrayList = new ArrayList();
- for (int i = 0; i < this.dataGridView1.RowCount; i++)
- {
- arrayList.Add(this.dataGridView1.Rows[i].Cells[1].Value.ToString().Replace("相", string.Empty));
- }
- int name = 0;
- foreach (var item in arrayList)
- {
- if (Convert.ToInt32(item) >= name)
- name = Convert.ToInt32(item) + 1;
- }
- dgvr.Cells[0].Value = PdnResources.GetString("Menu.view.text");
- dgvr.Cells[1].Value = PdnResources.GetString("Menu.phase.text") + name;
- dgvr.Cells[2].Value = 0;
- dgvr.Cells[3].Value = 0;
- dgvr.Cells[4].Value = this.rectangleFs.Count;
- dgvr.Cells[5].Value = 0;
- dgvr.Cells[6].Value = 0;
- dgvr.Cells[7].Value = 0;
- this.dataGridView1.Rows.Add(dgvr);
- this.p1RectangleFs.Add(new List<RectangleF>());
- this.p2RectangleFs.Add(new List<RectangleF>());
- if(this.documentWorkspace.PhaseModels[0].mat != null)
- {
- string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + name;
- //保存处理后的图片
- double pantographRatio = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
- List<Bitmap> tempBit = new List<Bitmap>();
- Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- originalBit.Tag = pantographRatio;
- tempBit.Add(originalBit);
- Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
- Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
- Graphics graphics = Graphics.FromImage(newBit);
- graphics.DrawImage(processedBit, new PointF(0, 0));
- Draw(graphics);
- newBit.Tag = pantographRatio;
- tempBit.Add(newBit);
- if (bitDic1.ContainsKey(tag))
- bitDic1[tag] = tempBit;
- else
- bitDic1.Add(tag, tempBit);
- }
- this.saveSuccess = true;
- if(this.dataGridView1.Rows.Count > 0)
- this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;
- }
- /// <summary>
- /// 删除相
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void But_DelPhase_Click(object sender, EventArgs e)
- {
- if (this.dataGridView1.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
- return;
- }
- if (this.dataGridView1.SelectedRows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectthedatatobedeleted.text")+"!");
- return;
- }
- DialogResult dt = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretcteddata.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dt == DialogResult.OK)
- {
- string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString().Replace("相", string.Empty);
- if (bitDic1.ContainsKey(tag))
- bitDic1.Remove(tag);
- if (this.dataGridView1.Rows.Count > 0)
- {
- this.p1RectangleFs.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
- this.p2RectangleFs.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
- }
- else
- {
- this.p1RectangleFs.RemoveAt(0);
- this.p2RectangleFs.RemoveAt(0);
- }
- this.dataGridView1.Rows.Remove(this.dataGridView1.SelectedRows[0]);
- this.saveSuccess = true;
- this.documentWorkspace.Refresh();
- }
- }
- /// <summary>
- /// 清空相
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void but_Clear_Click(object sender, EventArgs e)
- {
- if (this.dataGridView1.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
- return;
- }
- string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString().Replace(PdnResources.GetString("Menu.phase.text"), string.Empty);
- string key = tag.Substring(0, tag.IndexOf("|"));
- DialogResult dt = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretocleardata?.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dt == DialogResult.OK)
- {
- this.dataGridView1.Rows.Clear();
- this.p1RectangleFs.Clear();
- this.p2RectangleFs.Clear();
- for (int i = 0; i < bitDic1.Count; i++)
- {
- foreach (var item in bitDic1)
- {
- string keyDe = item.Key.Substring(0, item.Key.IndexOf("|"));
- if(key.Equals(keyDe))
- {
- bitDic1.Remove(item.Key);
- break;
- }
- }
- }
- this.documentWorkspace.Refresh();
- }
- }
- /// <summary>
- /// 保存结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- SaveMeasurementResults();
- }
- /// <summary>
- /// 保存结果
- /// </summary>
- private void SaveMeasurementResults()
- {
- if (this.listView1.SelectedItems.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- return;
- }
- string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
- string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
- if (this.dataGridView1.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseaddaphoto.text")+"!");
- return;
- }
- //int count = 0;
- //foreach (var item in this.p1RectangleFs)
- //{
- // count += item.Count;
- //}
- //foreach (var item in this.p2RectangleFs)
- //{
- // count += item.Count;
- //}
- //if (count == 0)
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleaseadaintercept.Text")+"!");
- // return;
- //}
- DataTable dataTable1 = new DataTable();
- bool replace = false;
- int add = 0;
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (item.Tag.Equals(tag))
- {
- add++;
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Themeasurementdertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- replace = true;
- this.listView2.Items.Remove(item);
- }
- break;
- }
- }
- if (replace || this.listView2.Items.Count == 0 || add == 0)
- {
- ListViewItem listViewItem = new ListViewItem();
- listViewItem.SubItems[0].Text = imgName;
- listViewItem.Tag = tag;
- if (this.listView2.Items.Count == 0)
- this.listView2.Items.Add(listViewItem);
- else
- this.listView2.Items.Insert(0, listViewItem);
- dataTable1.TableName = tag;
- this.dataGridView4.Rows.Clear();
- foreach (DataGridViewRow Row in this.dataGridView1.Rows)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.Tag = tag;
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- dgvr.Cells[0].Value = imgName;
- dgvr.Cells[1].Value = Row.Cells[0].Value;
- dgvr.Cells[2].Value = Row.Cells[1].Value;
- dgvr.Cells[3].Value = Row.Cells[2].Value;
- dgvr.Cells[4].Value = Row.Cells[3].Value;
- dgvr.Cells[5].Value = Row.Cells[4].Value;
- dgvr.Cells[6].Value = Row.Cells[5].Value;
- dgvr.Cells[7].Value = Row.Cells[6].Value;
- dgvr.Cells[8].Value = Row.Cells[7].Value;
- this.dataGridView4.Rows.Add(dgvr);
- }
- foreach (DataTable dataTable2 in pictureDataTables)
- {
- if (dataTable2.TableName.Equals(dataTable1.TableName))
- {
- pictureDataTables.Remove(dataTable2);
- break;
- }
- }
- foreach (DataGridViewColumn c in this.dataGridView4.Columns)
- {
- dataTable1.Columns.Add(c.HeaderText);
- }
- for (int r = 0; r < this.dataGridView1.Rows.Count; r++)
- {
- DataRow dataRow = dataTable1.NewRow();
- for (int c = 0; c < this.dataGridView1.Rows[r].Cells.Count + 1; c++)
- {
- if(c == 0)
- dataRow[this.dataGridView4.Columns[c].HeaderText] = imgName;
- else
- {
- if(c == this.dataGridView1.Rows[r].Cells.Count)
- {
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
- {
- percentage = (Convert.ToDouble(p2RectangleFs[r].Count) / (Convert.ToDouble(p1RectangleFs[r].Count) + Convert.ToDouble(p2RectangleFs[r].Count))) * 100;
- if(double.IsNaN(percentage))
- percentage = 0;
- }
- dataRow[this.dataGridView4.Columns[c].HeaderText] = percentage;
- }
- else if (c == this.dataGridView1.Rows[r].Cells.Count - 1)
- {
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
- {
- percentage = (Convert.ToDouble(p1RectangleFs[r].Count) / (Convert.ToDouble(p1RectangleFs[r].Count) + Convert.ToDouble(p2RectangleFs[r].Count))) * 100;
- if (double.IsNaN(percentage))
- percentage = 0;
- }
- dataRow[this.dataGridView4.Columns[c].HeaderText] = percentage;
- }
- else if (c == this.dataGridView1.Rows[r].Cells.Count - 2)
- {
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
- {
- percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[r].Cells[2].Value)
- + Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[r].Cells[3].Value) * 0.5))
- / Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value)) * 100;
- if (double.IsNaN(percentage))
- percentage = 0;
- }
- dataRow[this.dataGridView4.Columns[c].HeaderText] = percentage;
- }
- else
- dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView1.Rows[r].Cells[c - 1].Value;
- }
- }
- dataTable1.Rows.Add(dataRow);
- }
- this.pictureDataTables.Add(dataTable1);
- this.bitDic.Clear();
- foreach (var item in this.bitDic1)
- {
- this.bitDic.Add(item.Key, item.Value);
- }
- //拼接中间数据
- List<List<string>> dataList = new List<List<string>>();
- List<string> columnName = new List<string>();
- columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- columnName.Add(Column.HeaderText);
- }
- dataList.Add(columnName);
- for (int r = 0; r < this.dataGridView1.Rows.Count; r++)
- {
- List<string> strList = new List<string>();
- strList.Add((r + 1).ToString());
- for (int c = 0; c < this.dataGridView1.Rows[r].Cells.Count + 1; c++)
- {
- if (c == 0)
- strList.Add(imgName);
- else
- {
- if (c == this.dataGridView1.Rows[r].Cells.Count)
- {
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
- {
- percentage = (Convert.ToDouble(p2RectangleFs[r].Count) / (Convert.ToDouble(p1RectangleFs[r].Count) + Convert.ToDouble(p2RectangleFs[r].Count))) * 100;
- }
- strList.Add(percentage.ToString());
- }
- else if (c == this.dataGridView1.Rows[r].Cells.Count - 1)
- {
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
- {
- percentage = (Convert.ToDouble(p1RectangleFs[r].Count) / (Convert.ToDouble(p1RectangleFs[r].Count) + Convert.ToDouble(p2RectangleFs[r].Count))) * 100;
- }
- strList.Add(percentage.ToString());
- }
- else if (c == this.dataGridView1.Rows[r].Cells.Count - 2)
- {
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
- {
- percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[r].Cells[2].Value)
- + Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[r].Cells[3].Value) * 0.5))
- / Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value)) * 100;
- }
- strList.Add(percentage.ToString());
- }
- else
- strList.Add(this.dataGridView1.Rows[r].Cells[c - 1].Value.ToString());
- }
- }
- dataList.Add(strList);
- }
- bool isExist = false;//是否已存在进行替换
- int modelIndex = -1;//要替换的下标
- for (int j = 0; j < tempDataModel.Count; j++)
- {
- if (tempDataModel[j].tagName.Equals(tag))
- {
- isExist = true;
- modelIndex = j;
- break;
- }
- }
- if (isExist && modelIndex > -1)
- tempDataModel[modelIndex].dataList = dataList;
- else
- {
- ExportProjectModel newModel = new ExportProjectModel();
- newModel.tagName = tag;
- newModel.picName = imgName;
- newModel.dataList = dataList;
- tempDataModel.Add(newModel);
- }
- if (this.allShow)
- AllShow();
- this.listView2.Items[0].Selected = true;
- this.saveSuccess = false;
- switchImg = true;
- }
- }
- /// <summary>
- /// 导出结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button14_Click(object sender, EventArgs e)
- {
- if (this.listView2.Items.Count > 0)
- {
- SaveFileDialog exe = new SaveFileDialog();
- exe.Filter = "Execl files (*.xlsx)|*.xlsx";
- exe.FilterIndex = 0;
- exe.RestoreDirectory = true;
- exe.Title = "Export Excel File";
- exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.QuantitativeAnalysis.Text")+ PdnResources.GetString("Menu.Analysisresult.text");
- DialogResult dr = exe.ShowDialog();
- if (dr == DialogResult.OK)
- {
- DataTable dtb = new DataTable();
- foreach (DataGridViewColumn c in this.dataGridView4.Columns)
- {
- dtb.Columns.Add(c.HeaderText);
- }
- for (int r = 0; r < this.dataGridView4.Rows.Count; r++)
- {
- DataRow dataRow = dtb.NewRow();
- for (int c = 0; c < this.dataGridView4.Rows[r].Cells.Count; c++)
- {
- dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView4.Rows[r].Cells[c].Value;
- }
- dtb.Rows.Add(dataRow);
- }
- List<DataTable> list = new List<DataTable>();
- list.Add(dtb);
- this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
- }
- }
- /// <summary>
- /// 不可点击空白区域
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listView1_MouseUp(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Left)
- {
- if (listView1.SelectedItems.Count > 0)
- {
- }
- else if (listView1.SelectedItems.Count <= 0)//点击空白区
- {
- if (this.listView1.FocusedItem != null)
- {
- ListViewItem item = this.listView1.GetItemAt(e.X, e.Y);
- if (item == null)
- {
- this.listView1.FocusedItem.Selected = true;
- }
- }
- }
- }
- }
- /// <summary>
- /// 小数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[i].Cells[4].Value) > 0)
- {
- percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[i].Cells[2].Value)
- + Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[i].Cells[3].Value) * 0.5))
- / Convert.ToInt32(this.dataGridView1.Rows[i].Cells[4].Value)) * 100;
- if (double.IsNaN(percentage))
- percentage = 0;
- }
- this.dataGridView1.Rows[i].Cells[5].Value = Math.Round(percentage, Convert.ToInt32(this.numericUpDown1.Value));
- double a = Math.Round((Convert.ToDouble(this.p1RectangleFs[i].Count) / (Convert.ToDouble(this.p1RectangleFs[i].Count) + Convert.ToDouble(this.p2RectangleFs[i].Count))) * 100, Convert.ToInt32(this.numericUpDown1.Value));
- double b = Math.Round((Convert.ToDouble(this.p2RectangleFs[i].Count) / (Convert.ToDouble(this.p1RectangleFs[i].Count) + Convert.ToDouble(this.p2RectangleFs[i].Count))) * 100, Convert.ToInt32(this.numericUpDown1.Value));
- if (double.IsNaN(a))
- this.dataGridView1.Rows[i].Cells[6].Value = 0;
- else
- this.dataGridView1.Rows[i].Cells[6].Value = Math.Round((Convert.ToDouble(this.p1RectangleFs[i].Count) / (Convert.ToDouble(this.p1RectangleFs[i].Count) + Convert.ToDouble(this.p2RectangleFs[i].Count))) * 100, Convert.ToInt32(this.numericUpDown1.Value));
- if (double.IsNaN(b))
- this.dataGridView1.Rows[i].Cells[7].Value = 0;
- else
- this.dataGridView1.Rows[i].Cells[7].Value = Math.Round((Convert.ToDouble(this.p2RectangleFs[i].Count) / (Convert.ToDouble(this.p1RectangleFs[i].Count) + Convert.ToDouble(this.p2RectangleFs[i].Count))) * 100, Convert.ToInt32(this.numericUpDown1.Value));
- }
- RefreshDataGridView4();
- }
- /// <summary>
- /// 设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, template);
- if (recombinationRateSetDialog.hasModule)
- {
- recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
- recombinationRateSetDialog.ShowDialog();
- }
- else
- {
- recombinationRateSetDialog = null;
- }
- }
- /// <summary>
- /// 生成报告
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button13_Click(object sender, EventArgs e)
- {
- if (this.checkBox3.Checked)
- {
- AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, template);
- if (recombinationRateSetDialog.hasModule)
- {
- recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
- recombinationRateSetDialog.ShowDialog();
- }
- else
- {
- recombinationRateSetDialog = null;
- }
- }
- if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- List<List<string>> analysisContent = new List<List<string>>();
- for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
- {
- List<string> content1 = new List<string>();
- if (i == 0)
- {
- content1.Add(this.dataGridView4.Columns[0].HeaderText);
- content1.Add(this.dataGridView4.Columns[1].HeaderText);
- content1.Add(this.dataGridView4.Columns[2].HeaderText);
- content1.Add(this.dataGridView4.Columns[3].HeaderText);
- content1.Add(this.dataGridView4.Columns[4].HeaderText);
- content1.Add(this.dataGridView4.Columns[5].HeaderText);
- content1.Add(this.dataGridView4.Columns[6].HeaderText);
- content1.Add(this.dataGridView4.Columns[7].HeaderText);
- content1.Add(this.dataGridView4.Columns[8].HeaderText);
- analysisContent.Add(content1);
- }
- content1 = new List<string>();
- content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[8].Value.ToString());
- analysisContent.Add(content1);
- }
- bitList = new List<Bitmap>();
- if (this.allShow)
- {
- foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
- {
- bitList.Add(kv.Value[0]);
- bitList.Add(kv.Value[1]);
- }
- }
- else
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- foreach (DataGridViewRow itemRow in this.dataGridView4.Rows)
- {
- foreach (ListViewItem item in this.listView2.SelectedItems)
- {
- if (bitDic.ContainsKey(item.Tag.ToString() + "|" + itemRow.Cells[2].Value.ToString().Replace("相" ,string.Empty)) && itemRow.Tag.Equals(item.Tag))
- {
- bitList.Add(bitDic[item.Tag.ToString() + "|" + itemRow.Cells[2].Value.ToString().Replace("相", string.Empty)][0]);
- bitList.Add(bitDic[item.Tag.ToString() + "|" + itemRow.Cells[2].Value.ToString().Replace("相", string.Empty)][1]);
- }
- }
- }
- }
- }
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
- }
- private void checkBox4_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- private void button8_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.analyzeSettingModel == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Settheexporteitemfirst.Text"));
- return;
- }
- //获取项目工程内的文件夹路径
- ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.QuantitativeAnalysis.Text", this.analyzeSettingModel.savePath);
- if (item != null)
- {
- //向文件夹内保存图片和报告
- if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- //分析结果
- List<List<string>> analysisContent = new List<List<string>>();
- for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
- {
- List<string> content1 = new List<string>();
- if (i == 0)
- {
- content1.Add(this.dataGridView4.Columns[0].HeaderText);
- content1.Add(this.dataGridView4.Columns[1].HeaderText);
- content1.Add(this.dataGridView4.Columns[2].HeaderText);
- content1.Add(this.dataGridView4.Columns[3].HeaderText);
- content1.Add(this.dataGridView4.Columns[4].HeaderText);
- content1.Add(this.dataGridView4.Columns[5].HeaderText);
- content1.Add(this.dataGridView4.Columns[6].HeaderText);
- content1.Add(this.dataGridView4.Columns[7].HeaderText);
- content1.Add(this.dataGridView4.Columns[8].HeaderText);
- analysisContent.Add(content1);
- }
- content1 = new List<string>();
- content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[8].Value.ToString());
- analysisContent.Add(content1);
- }
- bitList = new List<Bitmap>();
- if (this.allShow)
- {
- foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
- {
- bitList.Add(kv.Value[0]);
- bitList.Add(kv.Value[1]);
- }
- }
- else
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- foreach (DataGridViewRow itemRow in this.dataGridView4.Rows)
- {
- foreach (ListViewItem itemL2 in this.listView2.SelectedItems)
- {
- if (bitDic.ContainsKey(itemL2.Tag.ToString() + "|" + itemRow.Cells[2].Value.ToString().Replace("相", string.Empty)))
- {
- bitList.Add(bitDic[itemL2.Tag.ToString() + "|" + itemRow.Cells[2].Value.ToString().Replace("相", string.Empty)][0]);
- bitList.Add(bitDic[itemL2.Tag.ToString() + "|" + itemRow.Cells[2].Value.ToString().Replace("相", string.Empty)][1]);
- }
- }
- }
- }
- }
- //中间数据
- if (!this.allShow)
- {
- if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
- {
- List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
- foreach (ListViewItem rowItem in this.listView2.SelectedItems)
- {
- foreach (ExportProjectModel model in this.tempDataModel)
- {
- if (model.tagName.Equals(rowItem.Tag))
- {
- ExportProjectModel tempModel = new ExportProjectModel();
- tempModel.tagName = model.tagName;
- tempModel.picName = model.picName;
- tempModel.dataList = model.dataList;
- exportModel.Add(tempModel);
- break;
- }
- }
- }
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);
- }
- }
- else
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, item.path, item.code);
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
- return;
- }
- //保存项目信息到数据库
- this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
- }
- }
- catch (Exception)
- {
- }
- }
- private void QuantitativeAnalysisDialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- #region [开启脚本录制]
- if (appWorkspace.startScriptRecording)
- {
- getScriptRecording();
- }
- #endregion
- binaryClass.saveParams();
- this.saveDialogParamValues();
- //xml保存路径
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- foreach (var analysisItem in this.analysisModel.ListParam)
- {
- bool foundItem = false;
- foreach (var item in analysisModelXml.ListParam)
- {
- if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
- {
- item.param_value = analysisItem.param_value;
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- analysisModelXml.ListParam.Add(analysisItem.cloneModel());
- }
- //按路径和名称保存xml文件
- string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
- //保存xml
- FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
- }
- private void radioButton1_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- private void radioButton2_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- #region 参数保存及提取
- /// <summary>
- /// 保存参数的key,value和type
- /// </summary>
- /// <param name="param_key"></param>
- /// <param name="param_value"></param>
- /// <param name="param_type"></param>
- private void saveParamValue(string param_key, string param_value, int param_type)
- {
- bool foundItem = false;
- foreach (var item in this.analysisModel.ListParam)
- {
- if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
- {
- item.param_value = param_value;
- item.setValue();
- foundItem = true;
- break;
- }
- }
- if (!foundItem)
- {
- GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
- analysisItem.menuId = this.menuId;
- analysisItem.param_key = param_key;
- analysisItem.param_type = param_type;
- analysisItem.param_value = param_value;
- analysisItem.setValue();
- this.analysisModel.ListParam.Add(analysisItem);
- }
- }
- /// <summary>
- /// 保存界面中的参数到model
- /// </summary>
- private void saveDialogParamValues()
- {
- saveParamValue(ParamKey_GridUse, comboBox1.Text, (int)Base.Dtryt.ItemString);//使用网格
- saveParamValue(ParamKey_GridMove, checkBox4.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//网格移动
- saveParamValue(ParamKey_Report, checkBox3.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//报告设置
- saveParamValue(ParamKey_GridStyle, radioButton1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//网格样式
- saveParamValue(ParamKey_GridDefault, radioButton2.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//默认网格
- saveParamValue(ParamKey_OneCircular, rb_LeftCircle.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//1点圆形
- saveParamValue(ParamKey_OneSquare, rb_LeftSquare.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//1点方形
- saveParamValue(ParamKey_OneSolid, rb_leftFill.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//1点实心
- saveParamValue(ParamKey_OneHollow, rb_leftNoFill.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//1点空心
- saveParamValue(ParamKey_OneSize, txt_LeftSize.Text, (int)Base.Dtryt.ItemString);//1点尺寸
- saveParamValue(ParamKey_OneWidth, txt_LeftLineWeight.Text, (int)Base.Dtryt.ItemString);//1点线宽
- saveParamValue(ParamKey_OneColour, panel1.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//1点颜色
- saveParamValue(ParamKey_HalfCircular, rb_RightCircle.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//0.5点圆形
- saveParamValue(ParamKey_HalfSquare, rb_RightSquare.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//0.5点方形
- saveParamValue(ParamKey_HalfSolid, rb_RightFill.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//0.5点实心
- saveParamValue(ParamKey_HalfHollow, rb_RightNoFill.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//0.5点空心
- saveParamValue(ParamKey_HalfSize, txt_RightSize.Text, (int)Base.Dtryt.ItemString);//0.5点尺寸
- saveParamValue(ParamKey_HalfWidth, txt_RightLineWeight.Text, (int)Base.Dtryt.ItemString);//0.5点线宽
- saveParamValue(ParamKey_HalfColour, panel2.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//0.5点颜色
- saveParamValue(ParamKey_DecimalPlace, numericUpDown1 != null ? numericUpDown1.Value.ToString() : "", (int)Base.Dtryt.Decimal);//保留小数位数
- }
- /// <summary>
- /// 获取保存的参数
- /// </summary>
- private void GetListParamModel()
- {
- if (this.analysisModel != null)
- {
- for (int i = 0; i < this.analysisModel.ListParam.Count; i++)
- {
- switch (this.analysisModel.ListParam[i].param_key)
- {
- case ParamKey_GridUse:
- comboBox1.Text = (string)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_GridMove:
- checkBox4.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Report:
- checkBox3.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_GridStyle:
- radioButton1.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_GridDefault:
- radioButton2.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_OneCircular:
- rb_LeftCircle.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_OneSquare:
- rb_LeftSquare.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_OneSolid:
- rb_leftFill.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_OneHollow:
- rb_leftNoFill.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_OneSize:
- txt_LeftSize.Text = (string)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_OneWidth:
- txt_LeftLineWeight.Text = (string)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_OneColour:
- panel1.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_HalfCircular:
- rb_RightCircle.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_HalfSquare:
- rb_RightSquare.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_HalfSolid:
- rb_RightFill.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_HalfHollow:
- rb_RightNoFill.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_HalfSize:
- txt_RightSize.Text = (string)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_HalfWidth:
- txt_RightLineWeight.Text = (string)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_HalfColour:
- panel2.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
- break;
- case ParamKey_DecimalPlace:
- numericUpDown1.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
- break;
- }
- }
- }
- }
- #endregion
- #region [脚本相关]
- private void getValue(string key, object value)
- {
- switch (key)
- {
- case "parameter1":
- comboBox1.SelectedIndex = (int)value;
- break;
- case "parameter2":
- checkBox4.Checked = Convert.ToBoolean(value);
- break;
- case "OpenWhileExportReport":
- checkBox3.Checked = Convert.ToBoolean(value);
- break;
- case "CalculatorDecimalDigits":
- numericUpDown1.Value = Convert.ToDecimal(value);
- break;
- }
- }
- #endregion
- #region [脚本录制]
- private void getScriptRecording()
- {
- string className = InvariantData.path_Action + ".Action" + menuId;
- ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
- List<Args> args = param.Lists;
- foreach (var item in args)
- {
- item.value = setScriptRecording(item.key);
- }
- //找出二值相关参数 进行赋值
- List<Args> isNullList = args.Where(m => m.value == null).ToList();
- foreach (var item in isNullList)
- {
- item.value = binaryClass.setScriptRecording(item.key);
- }
- appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
- }
- private object setScriptRecording(string key)
- {
- object value = null;
- switch (key)
- {
- case "parameter1":
- value = comboBox1.SelectedIndex;
- break;
- case "parameter2":
- value = checkBox4.Checked;
- break;
- case "OpenWhileExportReport":
- value = checkBox3.Checked;
- break;
- case "CalculatorDecimalDigits":
- value = numericUpDown1.Value;
- break;
- case "ExportResults":
- value = false;
- break;
- case "ExportReports":
- value = false;
- break;
- case "ExportProjects":
- value = false;
- break;
- }
- return value;
- }
- #endregion
- }
- }
|