123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397 |
- 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 Application = System.Windows.Forms.Application;
- using Button = System.Windows.Forms.Button;
- using CheckBox = System.Windows.Forms.CheckBox;
- using DataTable = System.Data.DataTable;
- using GroupBox = System.Windows.Forms.GroupBox;
- using Label = System.Windows.Forms.Label;
- using Rectangle = System.Drawing.Rectangle;
- using TextBox = System.Windows.Forms.TextBox;
- using Microsoft.Office.Interop.Excel;
- using PaintDotNet.Instrument;
- using Metis.ParameterSet;
- namespace PaintDotNet.DedicatedAnalysis.QuantitativeAnalysis
- {
- /// <summary>
- /// 显微结构带状物
- /// </summary>
- internal class MicrostructureBandDialog : 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 DataGridView dataGridView4;
- 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 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 DataGridView dataGridView1;
- private Button button1;
- private CheckBox checkBox3;
- private Panel panel4;
- private Button button7;
- #endregion
- /// <summary>
- /// 切换图片
- /// </summary>
- private bool init = true;
- /// <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 List<string> files = new List<string>();
- /// <summary>
- /// 当前选择的图片
- /// </summary>
- private Mat mat;
- /// <summary>
- /// 主控件
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 中间数据
- /// </summary>
- private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
- /// <summary>
- /// 结果数据
- /// </summary>
- DataTable tableResult = new DataTable();
- /// <summary>
- /// 数据变化
- /// </summary>
- private bool saveSuccess = false;
- /// <summary>
- /// 所有截点
- /// </summary>
- public List<RectangleF> p1RectangleFs = new 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;
- /// <summary>
- /// 垂线截点数
- /// </summary>
- private int vPointCount = 0;
- /// <summary>
- /// 水平线截点数
- /// </summary>
- private int hPointCount = 0;
- #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> vRectangleFs = new List<RectangleF>();
- /// <summary>
- /// 水平测量线
- /// </summary>
- private List<RectangleF> hRectangleFs = 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 MicrostructureBandModel microstructureBandModel ;
- /// <summary>
- /// 网格绘制区域
- /// </summary>
- private float minX;
- private float maxX;
- private float minY;
- private float maxY;
- /// <summary>
- /// 保存用于生成报告的图片
- /// </summary>
- private List<Bitmap> bitList;
- /// <summary>
- /// 是否要调用二值化的算法
- /// </summary>
- private bool toApplyBinary = true;
- /// <summary>
- /// 切换图片
- /// </summary>
- private bool switchImg;
- private bool canMove = false;
- private PointF oldLocation = new PointF();
- private bool selected = false;
- /// <summary>
- /// 储存点击保存结果后的所有原图与分析图
- /// </summary>
- private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
- //二值化集成1
- BinaryClass binaryClass;
- private int menuId;
- private string menuName;
- private GroupBox groupBox12;
- private CheckBox checkBox4;
- private DataGridViewTextBoxColumn Column11;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
- private DataGridView dataGridView2;
- private DataGridViewTextBoxColumn Column13;
- private DataGridViewTextBoxColumn Column14;
- private DataGridViewTextBoxColumn Column15;
- private DataGridViewTextBoxColumn Column16;
- private DataGridViewTextBoxColumn Column17;
- private DataGridViewTextBoxColumn Column18;
- private DataGridView dataGridView3;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn8;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn9;
- private DataGridViewTextBoxColumn Column12;
- private DataGridViewTextBoxColumn Column1;
- private DataGridViewTextBoxColumn Column2;
- private DataGridViewTextBoxColumn Column3;
- private DataGridViewTextBoxColumn Column4;
- private DataGridViewTextBoxColumn Column5;
- private DataGridViewTextBoxColumn Column6;
- private DataGridViewTextBoxColumn Column7;
- private DataGridViewTextBoxColumn Column8;
- private DataGridViewTextBoxColumn Column9;
- private DataGridViewTextBoxColumn Column10;
- private CheckBox checkBox5;
- private Button button8;
- private int changeCount;
- private BinaryControl bc;
- /// <summary>
- /// 初始系统参数配置值
- /// </summary>
- private BinaryExtractionModel binaryExtractionModel;
- private ToolTip toolTip1;
- /// <summary>
- /// 标尺
- /// </summary>
- private double unitLength;
- private int defaultIndex = -1;
- /// <summary>
- /// 是否脚本运行
- /// </summary>
- private Boolean initScriptValues = false;
- // <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_Circular = "circular";//圆形
- private const string ParamKey_Square = "square";//方形
- private const string ParamKey_Solid = "solid";//实心
- private const string ParamKey_Hollow = "hollow";//空心
- private const string ParamKey_Size = "size";//尺寸
- private const string ParamKey_Width = "width";//线宽
- private const string ParamKey_Colour = "colour";//颜色
- private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数
- public MicrostructureBandDialog(AppWorkspace appWorkspace, 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.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 = false;
- 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.icktheleftmousebuttontod.text");
- this.commonControlButtons.trackLabel.Visible = true;
- this.commonControlButtons.trackLabel.Width = 300;
- this.commonControlButtons.Visible = false;
- this.groupBox7.Controls.Add(commonControlButtons);
- foreach (DataGridViewColumn column in dataGridView4.Columns)
- { column.SortMode = DataGridViewColumnSortMode.NotSortable; }
- InitCommonButtonEvent();
- InitGridStyle();
- InitPicList();
- SetAnalyzeModelFromXml("Template.Manager.item3.MicrostructureBan_ASTME1268");
- //二值化集成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.dataGridView2.Columns.Count; i++)
- {
- this.dataGridView2.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
- }
- for (int i = 0; i < this.dataGridView3.Columns.Count; i++)
- {
- this.dataGridView3.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);
- }
- //二值化集成3
- #region 二值化相关方法
- private void InclusionsStandardDialog_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 ShownChoiseItemAndInitData(object sender, EventArgs e)
- {
- binaryClass.RefreshHistogramControl1Values();
- }
- /// <summary>
- /// 添加参数改变的监听
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void MicrostructureBandDialog_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)
- {
- if (this.checkBox4.Checked)
- {
- GetNumberOfGrains();
- RefreshResultsData();
- }
- 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()
- {
- microstructureBandModel = XmlSerializeHelper.DESerializer<MicrostructureBandModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MicrostructureBandModel.xml", FileMode.Open));
- if (microstructureBandModel.GridStyleList != null)
- {
- ArrayList arrayList = new ArrayList();
- foreach (var GridStyle in microstructureBandModel.GridStyleList)
- {
- arrayList.Add(GridStyle.gridName);
- }
- this.comboBox1.DataSource = null;
- this.comboBox1.DataSource = arrayList;
- if (microstructureBandModel.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))
- {
- MicrostructureBandModel.GridStyle gridStyle = new MicrostructureBandModel.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.microstructureBandModel.GridStyleList != null)
- this.microstructureBandModel.GridStyleList.Add(gridStyle);
- ArrayList arrayList = new ArrayList();
- foreach (var GridStyle in microstructureBandModel.GridStyleList)
- {
- arrayList.Add(GridStyle.gridName);
- }
- this.comboBox1.DataSource = null;
- this.comboBox1.DataSource = arrayList;
- }
- else
- {
- if (this.microstructureBandModel.GridStyleList != null)
- {
- foreach (var GridStyle in this.microstructureBandModel.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<MicrostructureBandModel>(microstructureBandModel);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MicrostructureBandModel.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;
- }
- internal class DocumentItem
- {
- public Bitmap bitmap;
- public GraphicsList graphicsList;
- public List<PhaseModel> phaseModels;
- public AnalysisResult analysisResult;
- public DocumentItem(Bitmap bitmap, GraphicsList graphicsList, List<PhaseModel> phaseModels)
- {
- this.bitmap = bitmap;
- this.graphicsList = graphicsList;
- this.phaseModels = phaseModels;
- }
- }
- 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)(this.gridSpacing / unitLength);
- vGridSpacingDraw = (float)(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.vRectangleFs.Clear();
- this.hRectangleFs.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 - Math.Round(Spacing, 2) >= 0
- && (float)this.documentWorkspace.CompositionSurface.Height / 2 + Math.Round(Spacing, 2) <= this.documentWorkspace.CompositionSurface.Height)
- {
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 - Math.Round(Spacing, 2));
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 + Math.Round(Spacing, 2));
- }
- else
- {
- if (!this.wholePicture)
- 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 - Math.Round(Spacing, 2) >= 0
- && (float)this.documentWorkspace.CompositionSurface.Height / 2 + Math.Round(Spacing, 2) <= this.documentWorkspace.CompositionSurface.Height)
- {
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 - Math.Round(Spacing, 2));
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 + Math.Round(Spacing, 2));
- }
- else
- {
- if (!this.wholePicture)
- 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 - Math.Round(Spacing, 2) >= 0
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 + Math.Round(Spacing, 2) <= this.documentWorkspace.CompositionSurface.Width)
- {
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 - Math.Round(Spacing, 2));
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 + Math.Round(Spacing, 2));
- }
- else
- {
- if (!this.wholePicture)
- 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 + Math.Round(Spacing, 2) <= this.documentWorkspace.CompositionSurface.Width
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 - Math.Round(Spacing, 2) >= 0)
- {
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 - Math.Round(Spacing, 2));
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 + Math.Round(Spacing, 2));
- }
- else
- {
- if (!this.wholePicture)
- exceed = true;
- }
- Spacing += vGridSpacingDraw;
- }
- }
- }
- }
- if (xs.Count > 1)
- {
- this.minX = (float)Convert.ToDecimal(xs[xs.Count - 2]);
- this.maxX = (float)Convert.ToDecimal(xs[xs.Count - 1]);
- }
- if (ys.Count > 1)
- {
- this.minY = (float)Convert.ToDecimal(ys[ys.Count - 2]);
- this.maxY = (float)Convert.ToDecimal(ys[ys.Count - 1]);
- }
- foreach (var x in xs)
- {
- this.vRectangleFs.Add(new RectangleF((float)(Convert.ToDecimal(x) - Convert.ToDecimal((float)this.gridWidth / 2) - 3)
- , (float)(Convert.ToDecimal(this.minY) - Convert.ToDecimal((float)this.gridWidth / 2) - 3), this.gridWidth + 6, (this.maxY - this.minY) + 6));
- }
- foreach (var y in ys)
- {
- this.hRectangleFs.Add(new RectangleF((float)(Convert.ToDecimal(this.minX) - Convert.ToDecimal((float)this.gridWidth / 2) - 3)
- , (float)(Convert.ToDecimal(y) - Convert.ToDecimal((float)this.gridWidth / 2) - 3), (this.maxX - this.minX) + 6, this.gridWidth + 6));
- }
- }
- else
- {
- hGridSpacingDraw = (float)(this.gridSpacing / unitLength);
- vGridSpacingDraw = (float)(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
- {
- if (!this.wholePicture)
- 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
- {
- if (!this.wholePicture)
- exceed = true;
- }
- Spacing += vGridSpacingDraw;
- }
- }
- }
- }
- if (xs.Count > 1)
- {
- this.minX = (float)Convert.ToDecimal(xs[xs.Count - 2]);
- this.maxX = (float)Convert.ToDecimal(xs[xs.Count - 1]);
- }
- if (ys.Count > 1)
- {
- this.minY = (float)Convert.ToDecimal(ys[ys.Count - 2]);
- this.maxY = (float)Convert.ToDecimal(ys[ys.Count - 1]);
- }
- foreach (var x in xs)
- {
- this.vRectangleFs.Add(new RectangleF((float)(Convert.ToDecimal(x) - Convert.ToDecimal((float)this.gridWidth / 2) - 3)
- , (float)(Convert.ToDecimal(this.minY) - Convert.ToDecimal((float)this.gridWidth / 2) - 3), this.gridWidth + 6, (this.maxY - this.minY) + 6));
- }
- foreach (var y in ys)
- {
- this.hRectangleFs.Add(new RectangleF((float)(Convert.ToDecimal(this.minX) - Convert.ToDecimal((float)this.gridWidth / 2) - 3)
- , (float)(Convert.ToDecimal(y) - Convert.ToDecimal((float)this.gridWidth / 2) - 3), (this.maxX - this.minX) + 6, this.gridWidth + 6));
- }
- }
- 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(150, 57);
- 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 = 22;
- this.Controls.Add(this.bc);
- this.Controls.SetChildIndex(this.bc, 0);
- this.groupBox1.Text = PdnResources.GetString("Menu.operation.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.Column13.HeaderText = PdnResources.GetString("Menu.picture.Text");
- this.Column14.HeaderText = PdnResources.GetString("Menu.view.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.Column12.HeaderText = PdnResources.GetString("Menu.params.text");
- this.Column1.HeaderText = "NL⊥" + PdnResources.GetString("Menu.Image.Average.Text") + "(No./mm)";
- this.Column2.HeaderText = "NL∥" + PdnResources.GetString("Menu.Image.Average.Text") + "No./mm)";
- this.Column3.HeaderText = "AI(NL⊥" + PdnResources.GetString("Menu.Image.Average.Text") + "/NL∥" + PdnResources.GetString("Menu.Image.Average.Text") + ")";
- this.Column5.HeaderText = "PL⊥" + PdnResources.GetString("Menu.Image.Average.Text") + "(No./mm)";
- this.Column6.HeaderText = "PL∥" + PdnResources.GetString("Menu.Image.Average.Text") + "(No./mm)";
- this.Column7.HeaderText = "AI(PL⊥" + PdnResources.GetString("Menu.Image.Average.Text") + "/PL∥" + PdnResources.GetString("Menu.Image.Average.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.groupBox10.Text = PdnResources.GetString("Menu.Cutoffpointset.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.dataGridViewTextBoxColumn5.HeaderText = PdnResources.GetString("Menu.view.text");
- this.Column11.HeaderText = PdnResources.GetString("Menu.view.text");
- this.groupBox12.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.autoadd.text");
- this.checkBox5.Text = PdnResources.GetString("Menu.Thegridmobile.text");
- this.checkBox4.Text = PdnResources.GetString("Menu.autoaddsection.text");
- this.Text = PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.BandedStructure.Text") + "_ASTM_E1268-01";
- }
- 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();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- 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.dataGridView2 = new System.Windows.Forms.DataGridView();
- this.Column13 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column14 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column15 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column16 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column17 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column18 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- 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.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- 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.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column10 = 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.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.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.dataGridView3 = new System.Windows.Forms.DataGridView();
- this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- 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.groupBox12 = new System.Windows.Forms.GroupBox();
- this.checkBox5 = new System.Windows.Forms.CheckBox();
- this.checkBox4 = new System.Windows.Forms.CheckBox();
- this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox8.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).BeginInit();
- this.groupBox4.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
- this.groupBox10.SuspendLayout();
- this.groupBox11.SuspendLayout();
- this.groupBox9.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
- this.groupBox12.SuspendLayout();
- 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.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;
- //
- // 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.AutoEllipsis = true;
- this.checkBox3.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
- this.checkBox3.Location = new System.Drawing.Point(621, 19);
- this.checkBox3.Name = "checkBox3";
- this.checkBox3.Size = new System.Drawing.Size(236, 20);
- 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.AutoEllipsis = true;
- this.label1.Location = new System.Drawing.Point(18, 23);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(50, 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, 609);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- 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.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, 634);
- 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.dataGridView2);
- 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, 699);
- this.groupBox8.Name = "groupBox8";
- this.groupBox8.Size = new System.Drawing.Size(1081, 234);
- 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 = 24;
- this.button8.UseVisualStyleBackColor = false;
- this.button8.Click += new System.EventHandler(this.button8_Click);
- //
- // dataGridView2
- //
- this.dataGridView2.AllowUserToAddRows = false;
- this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView2.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, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- 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.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
- this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column13,
- this.Column14,
- this.Column15,
- this.Column16,
- this.Column17,
- this.Column18});
- this.dataGridView2.Location = new System.Drawing.Point(228, 11);
- this.dataGridView2.MultiSelect = false;
- this.dataGridView2.Name = "dataGridView2";
- this.dataGridView2.ReadOnly = true;
- this.dataGridView2.RowHeadersVisible = false;
- this.dataGridView2.RowTemplate.Height = 23;
- this.dataGridView2.Size = new System.Drawing.Size(693, 97);
- this.dataGridView2.TabIndex = 23;
- //
- // Column13
- //
- dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column13.DefaultCellStyle = dataGridViewCellStyle2;
- this.Column13.Name = "Column13";
- this.Column13.ReadOnly = true;
- //
- // Column14
- //
- dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column14.DefaultCellStyle = dataGridViewCellStyle3;
- this.Column14.Name = "Column14";
- this.Column14.ReadOnly = true;
- //
- // Column15
- //
- dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column15.DefaultCellStyle = dataGridViewCellStyle4;
- this.Column15.HeaderText = "NL⊥";
- this.Column15.Name = "Column15";
- this.Column15.ReadOnly = true;
- //
- // Column16
- //
- dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column16.DefaultCellStyle = dataGridViewCellStyle5;
- this.Column16.HeaderText = "NL∥";
- this.Column16.Name = "Column16";
- this.Column16.ReadOnly = true;
- //
- // Column17
- //
- dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column17.DefaultCellStyle = dataGridViewCellStyle6;
- this.Column17.HeaderText = "PL⊥";
- this.Column17.Name = "Column17";
- this.Column17.ReadOnly = true;
- //
- // Column18
- //
- dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column18.DefaultCellStyle = dataGridViewCellStyle7;
- this.Column18.HeaderText = "PL∥";
- this.Column18.Name = "Column18";
- this.Column18.ReadOnly = true;
- //
- // 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, 171);
- 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(985, 176);
- 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.Value = new decimal(new int[] {
- 4,
- 0,
- 0,
- 0});
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
- //
- // button16
- //
- this.button16.BackColor = System.Drawing.SystemColors.Control;
- this.button16.Location = new System.Drawing.Point(15, 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(946, 182);
- 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;
- dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 9F);
- dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.dataGridView4.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8;
- this.dataGridView4.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dataGridView4.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column12,
- this.Column1,
- this.Column2,
- this.Column3,
- this.Column4,
- this.Column5,
- this.Column6,
- this.Column7,
- this.Column8,
- this.Column9,
- this.Column10});
- this.dataGridView4.Location = new System.Drawing.Point(228, 114);
- this.dataGridView4.Name = "dataGridView4";
- this.dataGridView4.ReadOnly = true;
- this.dataGridView4.RowHeadersVisible = false;
- this.dataGridView4.RowTemplate.Height = 23;
- this.dataGridView4.Size = new System.Drawing.Size(693, 113);
- this.dataGridView4.TabIndex = 15;
- //
- // Column12
- //
- dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column12.DefaultCellStyle = dataGridViewCellStyle9;
- this.Column12.Name = "Column12";
- this.Column12.ReadOnly = true;
- //
- // Column1
- //
- dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column1.DefaultCellStyle = dataGridViewCellStyle10;
- this.Column1.Name = "Column1";
- this.Column1.ReadOnly = true;
- //
- // Column2
- //
- dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column2.DefaultCellStyle = dataGridViewCellStyle11;
- this.Column2.Name = "Column2";
- this.Column2.ReadOnly = true;
- //
- // Column3
- //
- dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column3.DefaultCellStyle = dataGridViewCellStyle12;
- this.Column3.Name = "Column3";
- this.Column3.ReadOnly = true;
- //
- // Column4
- //
- dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column4.DefaultCellStyle = dataGridViewCellStyle13;
- this.Column4.HeaderText = "Ω12(N)";
- this.Column4.Name = "Column4";
- this.Column4.ReadOnly = true;
- //
- // Column5
- //
- dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column5.DefaultCellStyle = dataGridViewCellStyle14;
- this.Column5.Name = "Column5";
- this.Column5.ReadOnly = true;
- //
- // Column6
- //
- dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column6.DefaultCellStyle = dataGridViewCellStyle15;
- this.Column6.Name = "Column6";
- this.Column6.ReadOnly = true;
- //
- // Column7
- //
- dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column7.DefaultCellStyle = dataGridViewCellStyle16;
- this.Column7.Name = "Column7";
- this.Column7.ReadOnly = true;
- //
- // Column8
- //
- dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column8.DefaultCellStyle = dataGridViewCellStyle17;
- this.Column8.HeaderText = "Ω12(P)";
- this.Column8.Name = "Column8";
- this.Column8.ReadOnly = true;
- //
- // Column9
- //
- dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column9.DefaultCellStyle = dataGridViewCellStyle18;
- this.Column9.HeaderText = "SB⊥(mm)";
- this.Column9.Name = "Column9";
- this.Column9.ReadOnly = true;
- //
- // Column10
- //
- dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- this.Column10.DefaultCellStyle = dataGridViewCellStyle19;
- this.Column10.HeaderText = "λ⊥(mm)";
- this.Column10.Name = "Column10";
- this.Column10.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, 634);
- this.groupBox7.TabIndex = 11;
- this.groupBox7.TabStop = false;
- //
- // groupBox4
- //
- 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(156, 352);
- this.groupBox4.Name = "groupBox4";
- this.groupBox4.Size = new System.Drawing.Size(352, 73);
- this.groupBox4.TabIndex = 13;
- this.groupBox4.TabStop = false;
- //
- // 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(83, 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(284, 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;
- //
- // 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(156, 433);
- this.groupBox10.Name = "groupBox10";
- this.groupBox10.Size = new System.Drawing.Size(352, 82);
- 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(171, 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(112, 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, 54);
- 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, 57);
- 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, 54);
- 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, 57);
- 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, 54);
- 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, 57);
- 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(25, 24);
- this.label22.Name = "label22";
- this.label22.Size = new System.Drawing.Size(0, 12);
- this.label22.TabIndex = 0;
- //
- // groupBox9
- //
- this.groupBox9.Controls.Add(this.dataGridView3);
- this.groupBox9.Controls.Add(this.dataGridView1);
- this.groupBox9.Location = new System.Drawing.Point(156, 570);
- this.groupBox9.Name = "groupBox9";
- this.groupBox9.Size = new System.Drawing.Size(351, 123);
- this.groupBox9.TabIndex = 20;
- this.groupBox9.TabStop = false;
- //
- // dataGridView3
- //
- this.dataGridView3.AllowUserToAddRows = false;
- this.dataGridView3.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView3.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
- dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle20.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle20.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- dataGridViewCellStyle20.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle20.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle20.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle20.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.dataGridView3.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle20;
- this.dataGridView3.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dataGridView3.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.dataGridViewTextBoxColumn5,
- this.dataGridViewTextBoxColumn6,
- this.dataGridViewTextBoxColumn7,
- this.dataGridViewTextBoxColumn8,
- this.dataGridViewTextBoxColumn9});
- this.dataGridView3.Location = new System.Drawing.Point(8, 20);
- this.dataGridView3.MultiSelect = false;
- this.dataGridView3.Name = "dataGridView3";
- this.dataGridView3.ReadOnly = true;
- this.dataGridView3.RowHeadersVisible = false;
- this.dataGridView3.RowTemplate.Height = 23;
- this.dataGridView3.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView3.Size = new System.Drawing.Size(337, 94);
- this.dataGridView3.TabIndex = 1;
- this.dataGridView3.Visible = false;
- //
- // dataGridViewTextBoxColumn5
- //
- dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle21;
- this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
- this.dataGridViewTextBoxColumn5.ReadOnly = true;
- //
- // dataGridViewTextBoxColumn6
- //
- dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.dataGridViewTextBoxColumn6.DefaultCellStyle = dataGridViewCellStyle22;
- this.dataGridViewTextBoxColumn6.HeaderText = "NL⊥";
- this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
- this.dataGridViewTextBoxColumn6.ReadOnly = true;
- //
- // dataGridViewTextBoxColumn7
- //
- dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.dataGridViewTextBoxColumn7.DefaultCellStyle = dataGridViewCellStyle23;
- this.dataGridViewTextBoxColumn7.HeaderText = "NL//";
- this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
- this.dataGridViewTextBoxColumn7.ReadOnly = true;
- //
- // dataGridViewTextBoxColumn8
- //
- dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.dataGridViewTextBoxColumn8.DefaultCellStyle = dataGridViewCellStyle24;
- this.dataGridViewTextBoxColumn8.HeaderText = "PL⊥";
- this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
- this.dataGridViewTextBoxColumn8.ReadOnly = true;
- //
- // dataGridViewTextBoxColumn9
- //
- dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.dataGridViewTextBoxColumn9.DefaultCellStyle = dataGridViewCellStyle25;
- this.dataGridViewTextBoxColumn9.HeaderText = "PL//";
- this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9";
- this.dataGridViewTextBoxColumn9.ReadOnly = true;
- //
- // dataGridView1
- //
- this.dataGridView1.AllowUserToAddRows = false;
- this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
- dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle26.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle26.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- dataGridViewCellStyle26.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle26.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle26.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle26.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle26;
- 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.dataGridView1.Location = new System.Drawing.Point(8, 20);
- 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, 94);
- this.dataGridView1.TabIndex = 0;
- this.dataGridView1.SelectionChanged += new System.EventHandler(this.dataGridView1_SelectionChanged);
- //
- // Column11
- //
- dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column11.DefaultCellStyle = dataGridViewCellStyle27;
- this.Column11.Name = "Column11";
- this.Column11.ReadOnly = true;
- //
- // dataGridViewTextBoxColumn1
- //
- dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle28;
- this.dataGridViewTextBoxColumn1.HeaderText = "NL⊥";
- this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
- this.dataGridViewTextBoxColumn1.ReadOnly = true;
- //
- // dataGridViewTextBoxColumn2
- //
- dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle29;
- this.dataGridViewTextBoxColumn2.HeaderText = "NL//";
- this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
- this.dataGridViewTextBoxColumn2.ReadOnly = true;
- //
- // dataGridViewTextBoxColumn3
- //
- dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle30;
- this.dataGridViewTextBoxColumn3.HeaderText = "PL⊥";
- this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
- this.dataGridViewTextBoxColumn3.ReadOnly = true;
- //
- // dataGridViewTextBoxColumn4
- //
- dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
- this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle31;
- this.dataGridViewTextBoxColumn4.HeaderText = "PL//";
- this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
- this.dataGridViewTextBoxColumn4.ReadOnly = true;
- //
- // groupBox12
- //
- this.groupBox12.Controls.Add(this.checkBox5);
- this.groupBox12.Controls.Add(this.checkBox4);
- this.groupBox12.Location = new System.Drawing.Point(157, 521);
- this.groupBox12.Name = "groupBox12";
- this.groupBox12.Size = new System.Drawing.Size(351, 43);
- this.groupBox12.TabIndex = 21;
- this.groupBox12.TabStop = false;
- //
- // checkBox5
- //
- this.checkBox5.AutoSize = true;
- this.checkBox5.Location = new System.Drawing.Point(125, 18);
- this.checkBox5.Name = "checkBox5";
- this.checkBox5.Size = new System.Drawing.Size(15, 14);
- this.checkBox5.TabIndex = 1;
- this.checkBox5.UseVisualStyleBackColor = true;
- this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
- //
- // checkBox4
- //
- this.checkBox4.AutoSize = true;
- this.checkBox4.Location = new System.Drawing.Point(15, 18);
- this.checkBox4.Name = "checkBox4";
- this.checkBox4.Size = new System.Drawing.Size(15, 14);
- this.checkBox4.TabIndex = 0;
- this.checkBox4.UseVisualStyleBackColor = true;
- this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
- //
- // MicrostructureBandDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(1107, 942);
- this.Controls.Add(this.groupBox12);
- this.Controls.Add(this.groupBox9);
- 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 = "MicrostructureBandDialog";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InclusionsStandardDialog_FormClosing);
- this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData);
- this.Load += new System.EventHandler(this.MicrostructureBandDialog_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.groupBox9, 0);
- this.Controls.SetChildIndex(this.groupBox12, 0);
- this.groupBox1.ResumeLayout(false);
- this.groupBox2.ResumeLayout(false);
- this.groupBox8.ResumeLayout(false);
- this.groupBox8.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
- ((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.groupBox10.ResumeLayout(false);
- this.groupBox10.PerformLayout();
- this.groupBox11.ResumeLayout(false);
- this.groupBox11.PerformLayout();
- this.groupBox9.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
- this.groupBox12.ResumeLayout(false);
- this.groupBox12.PerformLayout();
- 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 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;
- }
- /// <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 = this.imageMat.Clone();
- else
- mat = PaintDotNet.Camera.Tools.ToMat(this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFullSizeWithRegion());
- //二值化集成4
- binaryClass.listView1_SelectedIndexChanged(this.imageMat.Clone());
- if (bcOriginChecked())
- {
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.PhaseModels[1].choise = false;
- this.documentWorkspace.Refresh();
- }
-
- this.dataGridView1.Rows.Clear();
- this.dataGridView3.Rows.Clear();
- this.p1RectangleFs.Clear();
- this.vPointCount = 0;
- this.hPointCount = 0;
- if (this.wholePicture)
- RefreshGridIntersections(false);
- else
- RefreshDrawRegion(PointF.Empty, false);
- if (this.button6.Visible)
- Init();
- if (!this.button6.Visible && this.documentWorkspace.phaseModels.Count != 0 && this.checkBox4.Checked)
- {
- GetNumberOfGrains();
- RefreshResultsData();
- }
- this.documentWorkspace.Refresh();
- }
- }
- private void Init()
- {
- this.init = false;
- this.checkBox4.Checked = false;
- this.commonControlButtons.Visible = true;
- this.switchImg = false;
- this.selectPicture = true;
- this.dataGridView1.Rows.Clear();
- this.dataGridView3.Rows.Clear();
- this.init = true;
- }
- /// <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);
-
- 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.checkBox5.Checked)
- linePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
- float hGridSpacingDraw;
- float vGridSpacingDraw;
- float blankDraw;
- 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.documentWorkspace.CompositionSurface.Height > 2 * this.blank && this.documentWorkspace.CompositionSurface.Width > 2 * this.blank)
- {
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Math.Round(Spacing, 2) >= blankDraw)
- {
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 - (float)Math.Round(Spacing, 2))
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 + Math.Round(Spacing, 2) <= this.documentWorkspace.CompositionSurface.Height - blankDraw)
- {
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 + (float)Math.Round(Spacing, 2))
- , 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.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 - Math.Round(Spacing, 2) >= blankDraw)
- {
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 - (float)Math.Round(Spacing, 2))
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 + Math.Round(Spacing, 2) <= this.documentWorkspace.CompositionSurface.Height - blankDraw)
- {
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 + (float)Math.Round(Spacing, 2))
- , 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.documentWorkspace.CompositionSurface.Height > 2 * this.blank && this.documentWorkspace.CompositionSurface.Width > 2 * this.blank)
- {
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Math.Round(Spacing, 2) >= 0
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 - Math.Round(Spacing, 2) >= blankDraw)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - (float)Math.Round(Spacing, 2), blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - (float)Math.Round(Spacing, 2), (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 + Math.Round(Spacing, 2) <= this.documentWorkspace.CompositionSurface.Width
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 + Math.Round(Spacing, 2) <= this.documentWorkspace.CompositionSurface.Width - blankDraw)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + (float)Math.Round(Spacing, 2), blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + (float)Math.Round(Spacing, 2), (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.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 + Math.Round(Spacing, 2) <= this.documentWorkspace.CompositionSurface.Width
- && this.documentWorkspace.CompositionSurface.Width / 2 + Math.Round(Spacing, 2) <= this.documentWorkspace.CompositionSurface.Width - blankDraw)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + (float)Math.Round(Spacing, 2), blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + (float)Math.Round(Spacing, 2), (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Math.Round(Spacing, 2) >= 0 && (float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= blankDraw)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - (float)Math.Round(Spacing, 2), blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - (float)Math.Round(Spacing, 2), (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- }
- }
- Spacing += vGridSpacingDraw;
- }
- }
- }
- }
- }
- }
- else
- {
- hGridSpacingDraw = (float)(this.gridSpacing / unitLength);
- vGridSpacingDraw = (float)(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)
- {
- // 1截点
- foreach (var pointRectangleF in this.p1RectangleFs)
- {
- // 绘制点
- 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);
- }
- }
- }
- }
- 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.Equals("0"))
- this.textBox2.Text = "1";
- 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 = 1;
- if (selectPicture)
- {
- if (this.wholePicture)
- RefreshGridIntersections(false);
- else
- RefreshDrawRegion(pointF, false);
- }
- if (this.exceed)
- this.textBox2.Text = this.hText;
- this.p1RectangleFs.Clear();
- this.vPointCount = 0;
- this.hPointCount = 0;
- 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.Equals("0"))
- this.textBox3.Text = "1";
- 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 = 1;
- if (selectPicture)
- {
- if (this.wholePicture)
- RefreshGridIntersections(false);
- else
- RefreshDrawRegion(pointF, false);
- }
- if (this.exceed)
- this.textBox3.Text = this.vText;
- this.p1RectangleFs.Clear();
- this.vPointCount = 0;
- this.hPointCount = 0;
- 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.vPointCount = 0;
- this.hPointCount = 0;
- 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.vPointCount = 0;
- this.hPointCount = 0;
- 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)(Convert.ToInt32(this.numericUpDown4.Value)/ unitLength);
- if (selectPicture)
- {
- if (this.wholePicture)
- RefreshGridIntersections(false);
- else
- RefreshDrawRegion(pointF, false);
- }
- this.p1RectangleFs.Clear();
- this.vPointCount = 0;
- this.hPointCount = 0;
- 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;
- }
- MicrostructureBandSaveDialog microstructureBandSaveDialog = new MicrostructureBandSaveDialog(items);
- microstructureBandSaveDialog.StartPosition = FormStartPosition.CenterScreen;
- microstructureBandSaveDialog.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 (microstructureBandModel.GridStyleList != null)
- {
- foreach (var GridStyle in microstructureBandModel.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.vPointCount = 0;
- this.hPointCount = 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.Count; i++)
- {
- RectangleF pointRectangleF = this.p1RectangleFs[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[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>
- /// 开始测量
- /// </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.dataGridView3.Rows.Clear();
- this.p1RectangleFs.Clear();
- this.vPointCount = 0;
- this.hPointCount = 0;
- this.documentWorkspace.Refresh();
- }
- if (!this.button6.Visible && this.listView1.FocusedItem != null && this.documentWorkspace.phaseModels.Count != 0 && this.checkBox4.Checked)
- {
- GetNumberOfGrains();
- RefreshResultsData();
- }
- //}
- //else
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- //}
- this.documentWorkspace.Refresh();
- }
- /// <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)
- {
- MicrostructureBandSaveDialog microstructureBandSaveDialog = new MicrostructureBandSaveDialog(null);
- microstructureBandSaveDialog.StartPosition = FormStartPosition.CenterScreen;
- microstructureBandSaveDialog.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.microstructureBandModel.GridStyleList != null)
- {
- foreach (var GridStyle in this.microstructureBandModel.GridStyleList)
- {
- if (GridStyle.gridName.Equals(this.comboBox1.SelectedItem))
- {
- this.microstructureBandModel.GridStyleList.Remove(GridStyle);
- break;
- }
- }
- }
- ArrayList arrayList = new ArrayList();
- foreach (var GridStyle in microstructureBandModel.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;
- this.dataGridView1.Rows.Clear();
- this.dataGridView3.Rows.Clear();
- }
- //以下保存xml文件信息
- string stageModelXml = XmlSerializeHelper.XmlSerialize<MicrostructureBandModel>(microstructureBandModel);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MicrostructureBandModel.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.checkBox5.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.checkBox5.Checked)
- return;
- 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;
- }
- bool canAdd1 = true;
- if (p1RectangleFs.Count > 0)
- {
- bool deleteP = false;
- PointF deletePoint = new PointF();
- foreach (var rectangleF in p1RectangleFs)
- {
- if (rectangleF.Contains(point1))
- {
- canAdd1 = false;
- deletePoint = new PointF(rectangleF.X + rectangleF.Width / 2, rectangleF.Y + rectangleF.Height / 2);
- if (e.Button == MouseButtons.Left && e.Clicks == 2)
- {
- deleteP = true;
- p1RectangleFs.Remove(rectangleF);
- this.saveSuccess = true;
- break;
- }
- }
- }
- if (deleteP)
- {
- foreach (RectangleF rectangleF in this.vRectangleFs)
- {
- if (rectangleF.Contains(deletePoint))
- {
- this.vPointCount--;
- RefreshResultsData();
- return;
- }
- }
- foreach (RectangleF rectangleF in this.hRectangleFs)
- {
- if (rectangleF.Contains(deletePoint))
- {
- this.hPointCount--;
- RefreshResultsData();
- return;
- }
- }
- }
- }
- if (e.Button == MouseButtons.Left)
- {
- float size = (float)(Convert.ToInt32(this.txt_LeftSize.Text) / unitLength);
- foreach (RectangleF rectangleF in this.vRectangleFs)
- {
- if (canAdd1)
- {
- if (rectangleF.Contains(point1))
- {
- p1RectangleFs.Add(new RectangleF(rectangleF.X + (float)rectangleF.Width / 2 - (float)(size / 2)
- , point1.Y - (float)(size / 2)
- , size, size));
- this.saveSuccess = true;
- this.vPointCount++;
- RefreshResultsData();
- return;
- }
- }
- }
- foreach (RectangleF rectangleF in this.hRectangleFs)
- {
- if (canAdd1)
- {
- if (rectangleF.Contains(point1))
- {
- p1RectangleFs.Add(new RectangleF(point1.X - (float)(size / 2)
- , rectangleF.Y + (float)rectangleF.Height / 2 - (float)(size / 2)
- , size, size));
- this.saveSuccess = true;
- this.hPointCount++;
- RefreshResultsData();
- return;
- }
- }
- }
- }
- }
- /// <summary>
- /// 移动
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMove(object sender, MouseEventArgs e)
- {
- if (!this.wholePicture && this.checkBox5.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.p1RectangleFs.Count > 0)
- {
- for (int i = 0; i < this.p1RectangleFs.Count; i++)
- {
- RectangleF rectangleF1 = this.p1RectangleFs[i];
- rectangleF1.Offset(point1.X - this.oldLocation.X, point1.Y - this.oldLocation.Y);
- this.p1RectangleFs[i] = rectangleF1;
- }
- }
- this.oldLocation = point1;
- RefreshDrawRegion(this.drawRectangleF.Location, true);
- if (checkBox4.Checked)
- {
- GetNumberOfGrains();
- RefreshResultsData();
- }
- 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.p1RectangleFs.Count > 0)
- {
- RectangleF rectangleF = new RectangleF();
- PointF pointF1 = new PointF();
- for (int i = 0; i < this.p1RectangleFs.Count; i++)
- {
- rectangleF = this.p1RectangleFs[i];
- pointF1 = this.p1RectangleFs[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[i] = rectangleF;
- }
- }
- }
- RefreshDrawRegion(this.drawRectangleF.Location, true);
- GetNumberOfGrains();
- RefreshResultsData();
- 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.dataGridView2.Rows.Clear();
- foreach (int 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.dataGridView2.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
- {
- if (c > 1)
- 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.dataGridView2.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.dataGridView2.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.dataGridView2.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 > 1)
- 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.dataGridView2.Rows.Add(dgvr);
- }
- }
- }
- ResultCalculation();
- }
- }
- /// <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 item in detaleName)
- {
- foreach (DataTable dataTable in this.pictureDataTables)
- {
- if (dataTable.TableName.Equals(item))
- {
- this.pictureDataTables.Remove(dataTable);
- break;
- }
- }
- if (bitDic.ContainsKey(item))
- bitDic.Remove(item);
- foreach (ExportProjectModel model in this.tempDataModel)
- {
- if (model.tagName.Equals(item))
- {
- 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.dataGridView2.Rows.Clear();
- }
- ResultCalculation();
- }
- }
- 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.dataGridView2.Rows.Clear();
- foreach (int 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.dataGridView2.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
- {
- if (c < 2)
- 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.dataGridView2.Rows.Add(dgvr);
- }
- }
- }
- }
- }
- else
- {
- this.dataGridView2.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.dataGridView2.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < dataTable.Columns.Count; c++)
- {
- if (c < 2)
- 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.dataGridView2.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.dataGridView2.Rows.Clear();
- foreach (int 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.dataGridView2.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
- {
- if (c > 1)
- 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.dataGridView2.Rows.Add(dgvr);
- }
- }
- }
- }
- }
- ResultCalculation();
- }
- /// <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.dataGridView2.Rows.Clear();
- 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();
- ResultCalculation();
- }
- private void AllShow()
- {
- this.dataGridView2.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.dataGridView2.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < dataTable.Columns.Count; c++)
- {
- if (c > 1)
- 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.dataGridView2.Rows.Add(dgvr);
- }
- }
- }
- /// <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;
- }
- if (this.dataGridView1.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noresultdata,pleaseaddsection.text")+"!");
- return;
- }
- string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
- string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
- 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.dataGridView2.Rows.Clear();
- foreach (DataGridViewRow Row in this.dataGridView1.Rows)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.Tag = tag;
- foreach (DataGridViewColumn Column in this.dataGridView2.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;
- this.dataGridView2.Rows.Add(dgvr);
- }
- foreach (DataTable dataTable2 in pictureDataTables)
- {
- if (dataTable2.TableName.Equals(dataTable1.TableName))
- {
- pictureDataTables.Remove(dataTable2);
- break;
- }
- }
- foreach (DataGridViewColumn c in this.dataGridView2.Columns)
- {
- dataTable1.Columns.Add(c.HeaderText);
- }
- for (int r = 0; r < this.dataGridView3.Rows.Count; r++)
- {
- DataRow dataRow = dataTable1.NewRow();
- for (int c = 0; c < this.dataGridView3.Rows[r].Cells.Count + 1; c++)
- {
- if (c == 0)
- dataRow[this.dataGridView2.Columns[c].HeaderText] = imgName;
- else
- dataRow[this.dataGridView2.Columns[c].HeaderText] = this.dataGridView3.Rows[r].Cells[c - 1].Value;
- }
- dataTable1.Rows.Add(dataRow);
- }
- this.pictureDataTables.Add(dataTable1);
- if (this.allShow)
- AllShow();
- this.listView2.Items[0].Selected = true;
- this.saveSuccess = false;
- switchImg = true;
- if(this.documentWorkspace.PhaseModels[0].mat !=null)
- {
- //保存处理后的图片
- 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 (bitDic.ContainsKey(tag))
- bitDic[tag] = tempBit;
- else
- bitDic.Add(tag, tempBit);
- }
- double unitLength;
- this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Millimeter, out unitLength);
- decimal lv = 0;
- decimal lh = 0;
- if (this.vRectangleFs.Count > 0)
- lv = ((decimal)this.vRectangleFs[0].Height - 6) * this.vNumber;
- if (this.hRectangleFs.Count > 0)
- lh = ((decimal)this.hRectangleFs[0].Width - 6) * this.hNumber;
- //拼接中间数据
- List<List<string>> dataList = new List<List<string>>();
- List<string> columnName = new List<string>();
- columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
- columnName.Add(PdnResources.GetString("Menu.Thenumberofpointsonaverticalline.text"));
- columnName.Add(PdnResources.GetString("Menu.Pointsonparallellines.text"));
- columnName.Add(PdnResources.GetString("Menu.Verticallength.text"));
- columnName.Add(PdnResources.GetString("Menu.VerticalThelengthofparallellinesength.text"));
- dataList.Add(columnName);
- List<string> strList = new List<string>();
- strList.Add("1");
- strList.Add(this.vPointCount.ToString());
- strList.Add(this.hPointCount.ToString());
- strList.Add(((decimal)lv * (decimal)unitLength).ToString());
- strList.Add(((decimal)lh * (decimal)unitLength).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);
- }
- }
- }
- /// <summary>
- /// 结果计算
- /// </summary>
- private void ResultCalculation()
- {
- if (this.pictureDataTables.Count == 0)
- return;
- if (!this.allShow && this.listView2.SelectedItems.Count == 0)
- return;
- // 视场数n
- int n = 0;
- if (this.allShow)
- n = this.listView2.Items.Count;
- else
- n = this.listView2.SelectedItems.Count;
- List<string> selectItems = new List<string>();
- if (this.allShow)
- {
- foreach (ListViewItem item in this.listView2.Items)
- {
- selectItems.Add(item.Tag.ToString());
- }
- }
- else
- {
- foreach (ListViewItem item in this.listView2.SelectedItems)
- {
- selectItems.Add(item.Tag.ToString());
- }
- }
- //
- // 特征截线数和特征截点数(多视场平均值)
- //
- double totalNlv = 0;
- double totalNlh = 0;
- double totalPlv = 0;
- double totalPlh = 0;
- foreach (DataTable item in this.pictureDataTables)
- {
- if (selectItems.Contains(item.TableName))
- {
- totalNlv += (double)Convert.ToDecimal(item.Rows[0][2]);
- totalNlh += (double)Convert.ToDecimal(item.Rows[0][3]);
- totalPlv += (double)Convert.ToDecimal(item.Rows[0][4]);
- totalPlh += (double)Convert.ToDecimal(item.Rows[0][5]);
- }
- }
- // 垂直截线数
- double nlvAve = totalNlv / n;
- // 水平截线数
- double nlhAve = totalNlh / n;
- // 垂直截点数
- double plvAve = totalPlv / n;
- // 水平截点数
- double plhAve = totalPlh / n;
- //计算标准误差s(4个)
- double sNlv;
- double sNlh;
- double sPlv;
- double sPlh;
- double sumNlv = 0;
- double sumNlh = 0;
- double sumPlv = 0;
- double sumPlh = 0;
- foreach (DataTable item in this.pictureDataTables)
- {
- if (selectItems.Contains(item.TableName))
- {
- sumNlv += ((double)Convert.ToDecimal(item.Rows[0][2]) - nlvAve) * ((double)Convert.ToDecimal(item.Rows[0][2]) - nlvAve);
- sumNlh += ((double)Convert.ToDecimal(item.Rows[0][3]) - nlhAve) * ((double)Convert.ToDecimal(item.Rows[0][3]) - nlhAve);
- sumPlv += ((double)Convert.ToDecimal(item.Rows[0][4]) - plvAve) * ((double)Convert.ToDecimal(item.Rows[0][4]) - plvAve);
- sumPlh += ((double)Convert.ToDecimal(item.Rows[0][5]) - plhAve) * ((double)Convert.ToDecimal(item.Rows[0][5]) - plhAve);
- }
- }
- sNlv = Math.Sqrt(sumNlv / (n - 1));
- sNlh = Math.Sqrt(sumNlh / (n - 1));
- sPlv = Math.Sqrt(sumPlv / (n - 1));
- sPlh = Math.Sqrt(sumPlh / (n - 1));
- //
- // 计算95%置信区间(95%CI)
- //
- // 计算与市场相关系数t
- double t = 0;
- if (n - 1 == 2) t = 4.303;
- if (n - 1 == 3) t = 3.182;
- if (n - 1 == 4) t = 2.776;
- if (n - 1 == 5) t = 2.571;
- if (n - 1 == 6) t = 2.447;
- if (n - 1 == 7) t = 2.365;
- if (n - 1 == 8) t = 2.306;
- if (n - 1 == 9) t = 2.262;
- if (n - 1 == 10) t = 2.228;
- double ciNlv = 0;
- double ciNlh = 0;
- double ciPlv = 0;
- double ciPlh = 0;
- // 垂直截线数95%CI
- ciNlv = t * sNlv / Math.Sqrt(n);
- // 水平截线数95%CI
- ciNlh = t * sNlh / Math.Sqrt(n);
- // 垂直截点数95%CI
- ciPlv = t * sPlv / Math.Sqrt(n);
- // 水平截点数95%CI
- ciPlh = t * sPlh / Math.Sqrt(n);
- //
- // 计算相对精度百分数(%RA)
- //
- double raNlv = 0;
- double raNlh = 0;
- double raPlv = 0;
- double raPlh = 0;
- // 垂直截线数%RA
- raNlv = ciNlv / nlvAve * 100;
- // 水平截线数%RA
- raNlh = ciNlh / nlhAve * 100;
- // 垂直截点数%RA
- raPlv = ciPlv / plvAve * 100;
- // 水平截点数%RA
- raPlh = ciPlh / plhAve * 100;
- //
- // 计算带状平均间距SB⊥
- //
- double sbV = 1 / nlvAve;
- //
- // 计算平均自由程λ⊥
- //
- // 带状组织体积分数
- double v = 0;
- double lmtV = (1 - v) / nlvAve;
- //
- // 计算各向异性指数AI
- //
- double aiNlv = nlvAve / nlhAve;
- double aiPlv = plvAve / plhAve;
- //
- // 计算取向度Ω12
- //
- double omgN12 = (nlvAve - nlhAve) / (nlvAve + 0.571 * nlhAve);
- double omgP12 = (plvAve - plhAve) / (plvAve + 0.571 * plhAve);
- this.dataGridView4.Rows.Clear();
- DataGridViewRow dataGridViewRow = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dataGridViewRow.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- int dec = Convert.ToInt32(this.numericUpDown1.Value);
- dataGridViewRow.Cells[0].Value = "X";
- if (double.IsNaN(nlvAve))
- dataGridViewRow.Cells[1].Value = "-";
- else
- dataGridViewRow.Cells[1].Value = Math.Round(nlvAve, dec);
- if (double.IsNaN(nlhAve))
- dataGridViewRow.Cells[2].Value = "-";
- else
- dataGridViewRow.Cells[2].Value = Math.Round(nlhAve, dec);
- if (double.IsNaN(aiNlv))
- dataGridViewRow.Cells[3].Value = "-";
- else
- dataGridViewRow.Cells[3].Value = Math.Round(aiNlv, dec);
- if (double.IsNaN(omgN12))
- dataGridViewRow.Cells[4].Value = "-";
- else
- dataGridViewRow.Cells[4].Value = Math.Round(omgN12, dec);
- if (double.IsNaN(plvAve))
- dataGridViewRow.Cells[5].Value = "-";
- else
- dataGridViewRow.Cells[5].Value = Math.Round(plvAve, dec);
- if (double.IsNaN(plhAve))
- dataGridViewRow.Cells[6].Value = "-";
- else
- dataGridViewRow.Cells[6].Value = Math.Round(plhAve, dec);
- if (double.IsNaN(aiPlv))
- dataGridViewRow.Cells[7].Value = "-";
- else
- dataGridViewRow.Cells[7].Value = Math.Round(aiPlv, dec);
- if (double.IsNaN(omgP12))
- dataGridViewRow.Cells[8].Value = "-";
- else
- dataGridViewRow.Cells[8].Value = Math.Round(omgP12, dec);
- if (double.IsNaN(sbV))
- dataGridViewRow.Cells[9].Value = "-";
- else
- dataGridViewRow.Cells[9].Value = Math.Round(sbV, dec);
- if (double.IsNaN(lmtV))
- dataGridViewRow.Cells[10].Value = "-";
- else
- dataGridViewRow.Cells[10].Value = Math.Round(lmtV, dec);
- this.dataGridView4.Rows.Add(dataGridViewRow);
- dataGridViewRow = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dataGridViewRow.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- dataGridViewRow.Cells[0].Value = "s";
- if (double.IsNaN(sNlv))
- dataGridViewRow.Cells[1].Value = "-";
- else
- dataGridViewRow.Cells[1].Value = Math.Round(sNlv, dec);
- if (double.IsNaN(sNlh))
- dataGridViewRow.Cells[2].Value = "-";
- else
- dataGridViewRow.Cells[2].Value = Math.Round(sNlh, dec);
- dataGridViewRow.Cells[3].Value = "-";
- dataGridViewRow.Cells[4].Value = "-";
- if (double.IsNaN(sPlv))
- dataGridViewRow.Cells[5].Value = "-";
- else
- dataGridViewRow.Cells[5].Value = Math.Round(sPlv, dec);
- if (double.IsNaN(sPlh))
- dataGridViewRow.Cells[6].Value = "-";
- else
- dataGridViewRow.Cells[6].Value = Math.Round(sPlh, dec);
- dataGridViewRow.Cells[7].Value = "-";
- dataGridViewRow.Cells[8].Value = "-";
- dataGridViewRow.Cells[9].Value = "-";
- dataGridViewRow.Cells[10].Value = "-";
- this.dataGridView4.Rows.Add(dataGridViewRow);
- dataGridViewRow = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dataGridViewRow.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- dataGridViewRow.Cells[0].Value = "95%CI";
- if (double.IsNaN(ciNlv))
- dataGridViewRow.Cells[1].Value = "-";
- else
- dataGridViewRow.Cells[1].Value = "±" + Math.Round(ciNlv, dec);
- if (double.IsNaN(ciNlh))
- dataGridViewRow.Cells[2].Value = "-";
- else
- dataGridViewRow.Cells[2].Value = "±" + Math.Round(ciNlh, dec);
- dataGridViewRow.Cells[3].Value = "-";
- dataGridViewRow.Cells[4].Value = "-";
- if (double.IsNaN(ciPlv))
- dataGridViewRow.Cells[5].Value = "-";
- else
- dataGridViewRow.Cells[5].Value = "±" + Math.Round(ciPlv, dec);
- if (double.IsNaN(ciPlh))
- dataGridViewRow.Cells[6].Value = "-";
- else
- dataGridViewRow.Cells[6].Value = "±" + Math.Round(ciPlh, dec);
- dataGridViewRow.Cells[7].Value = "-";
- dataGridViewRow.Cells[8].Value = "-";
- dataGridViewRow.Cells[9].Value = "-";
- dataGridViewRow.Cells[10].Value = "-";
- this.dataGridView4.Rows.Add(dataGridViewRow);
- dataGridViewRow = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dataGridViewRow.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- dataGridViewRow.Cells[0].Value = "%RA";
- if (double.IsNaN(raNlv))
- dataGridViewRow.Cells[1].Value = "-";
- else
- dataGridViewRow.Cells[1].Value = Math.Round(raNlv, dec);
- if (double.IsNaN(raNlh))
- dataGridViewRow.Cells[2].Value = "-";
- else
- dataGridViewRow.Cells[2].Value = Math.Round(raNlh, dec);
- dataGridViewRow.Cells[3].Value = "-";
- dataGridViewRow.Cells[4].Value = "-";
- if (double.IsNaN(raPlv))
- dataGridViewRow.Cells[5].Value = "-";
- else
- dataGridViewRow.Cells[5].Value = Math.Round(raPlv, dec);
- if (double.IsNaN(raPlh))
- dataGridViewRow.Cells[6].Value = "-";
- else
- dataGridViewRow.Cells[6].Value = Math.Round(raPlh, dec);
- dataGridViewRow.Cells[7].Value = "-";
- dataGridViewRow.Cells[8].Value = "-";
- dataGridViewRow.Cells[9].Value = "-";
- dataGridViewRow.Cells[10].Value = "-";
- this.dataGridView4.Rows.Add(dataGridViewRow);
- dataGridViewRow = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dataGridViewRow.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- dataGridViewRow.Cells[0].Value = "n";
- dataGridViewRow.Cells[1].Value = n;
- dataGridViewRow.Cells[2].Value = "-";
- dataGridViewRow.Cells[3].Value = "-";
- dataGridViewRow.Cells[4].Value = "-";
- dataGridViewRow.Cells[5].Value = "-";
- dataGridViewRow.Cells[6].Value = "-";
- dataGridViewRow.Cells[7].Value = "-";
- dataGridViewRow.Cells[8].Value = "-";
- dataGridViewRow.Cells[9].Value = "-";
- dataGridViewRow.Cells[10].Value = "-";
- this.dataGridView4.Rows.Add(dataGridViewRow);
- tableResult = new DataTable();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- tableResult.Columns.Add(Column.HeaderText);
- }
- DataRow dataRow = tableResult.NewRow();
- dataRow[0] = "X";
- dataRow[1] = nlvAve;
- dataRow[2] = nlhAve;
- dataRow[3] = aiNlv;
- dataRow[4] = omgN12;
- dataRow[5] = plvAve;
- dataRow[6] = plhAve;
- dataRow[7] = aiPlv;
- dataRow[8] = omgP12;
- dataRow[9] = sbV;
- dataRow[10] = lmtV;
- tableResult.Rows.Add(dataRow);
- dataRow = tableResult.NewRow();
- dataRow[0] = "s";
- if (double.IsNaN(sNlv))
- dataRow[1] = "-";
- else
- dataRow[1] = sNlv;
- if (double.IsNaN(sNlh))
- dataRow[2] = "-";
- else
- dataRow[2] = sNlh;
- dataRow[3] = "-";
- dataRow[4] = "-";
- if (double.IsNaN(sPlv))
- dataRow[5] = "-";
- else
- dataRow[5] = sPlv;
- if (double.IsNaN(sPlh))
- dataRow[6] = "-";
- else
- dataRow[6] = sPlh;
- dataRow[7] = "-";
- dataRow[8] = "-";
- dataRow[9] = "-";
- dataRow[10] = "-";
- tableResult.Rows.Add(dataRow);
- dataRow = tableResult.NewRow();
- dataRow[0] = "95%CI";
- if (double.IsNaN(ciNlv))
- dataRow[1] = "-";
- else
- dataRow[1] = ciNlv;
- if (double.IsNaN(ciNlh))
- dataRow[2] = "-";
- else
- dataRow[2] = ciNlh;
- dataRow[3] = "-";
- dataRow[4] = "-";
- if (double.IsNaN(ciPlv))
- dataRow[5] = "-";
- else
- dataRow[5] = ciPlv;
- if (double.IsNaN(ciPlh))
- dataRow[6] = "-";
- else
- dataRow[6] = ciPlh;
- dataRow[7] = "-";
- dataRow[8] = "-";
- dataRow[9] = "-";
- dataRow[10] = "-";
- tableResult.Rows.Add(dataRow);
- dataRow = tableResult.NewRow();
- dataRow[0] = "%RA";
- if (double.IsNaN(raNlv))
- dataRow[1] = "-";
- else
- dataRow[1] = raNlv;
- if (double.IsNaN(raNlh))
- dataRow[2] = "-";
- else
- dataRow[2] = raNlh;
- dataRow[3] = "-";
- dataRow[4] = "-";
- if (double.IsNaN(raPlv))
- dataRow[5] = "-";
- else
- dataRow[5] = raPlv;
- if (double.IsNaN(raPlh))
- dataRow[6] = "-";
- else
- dataRow[6] = raPlh;
- dataRow[7] = "-";
- dataRow[8] = "-";
- dataRow[9] = "-";
- dataRow[10] = "-";
- tableResult.Rows.Add(dataRow);
- dataRow = tableResult.NewRow();
- dataRow[0] = "n";
- dataRow[1] = n;
- dataRow[2] = "-";
- dataRow[3] = "-";
- dataRow[4] = "-";
- dataRow[5] = "-";
- dataRow[6] = "-";
- dataRow[7] = "-";
- dataRow[8] = "-";
- dataRow[9] = "-";
- dataRow[10] = "-";
- tableResult.Rows.Add(dataRow);
- }
- /// <summary>
- /// 导出结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button14_Click(object sender, EventArgs e)
- {
- if (this.listView2.Items.Count > 0)
- {
- System.Data.DataSet ds = new DataSet();
- DataTable table1 = new DataTable();
- table1.TableName = PdnResources.GetString("Menu.breakdown.text");
- foreach (DataGridViewColumn c in this.dataGridView2.Columns)
- {
- table1.Columns.Add(c.HeaderText);
- }
- for (int r = 0; r < this.dataGridView2.Rows.Count; r++)
- {
- DataRow dataRow = table1.NewRow();
- if (r == 0)
- {
- for (int c = 0; c < this.dataGridView2.Rows[r].Cells.Count; c++)
- {
- dataRow[this.dataGridView2.Columns[c].HeaderText] = this.dataGridView2.Columns[c].HeaderText;
- }
- table1.Rows.Add(dataRow);
- }
- dataRow = table1.NewRow();
- for (int c = 0; c < this.dataGridView2.Rows[r].Cells.Count; c++)
- {
- dataRow[this.dataGridView2.Columns[c].HeaderText] = this.dataGridView2.Rows[r].Cells[c].Value;
- }
- table1.Rows.Add(dataRow);
- }
- DataTable table2 = new DataTable();
- table2.TableName = PdnResources.GetString("Menu.statisaatics.text");
- foreach (DataGridViewColumn c in this.dataGridView4.Columns)
- {
- table2.Columns.Add(c.HeaderText);
- }
- for (int r = 0; r < this.dataGridView4.Rows.Count; r++)
- {
- DataRow dataRow = table2.NewRow();
- if (r == 0)
- {
- for (int c = 0; c < this.dataGridView4.Rows[r].Cells.Count; c++)
- {
- dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView4.Columns[c].HeaderText;
- }
- table2.Rows.Add(dataRow);
- }
- dataRow = table2.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;
- }
- table2.Rows.Add(dataRow);
- }
- if (table1.Rows.Count > 0) ds.Tables.Add(table1);
- if (table2.Rows.Count > 0) ds.Tables.Add(table2);
- if (ds.Tables.Count > 0)
- DataToExcle(ds);
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
- }
- }
- /// <summary>
- /// 导出多 Sheet 报表
- /// </summary>
- /// <param name="ds">要导出的数据</param>
- public void DataToExcle(System.Data.DataSet ds)
- {
- try
- {
- if (ds.Tables == null || ds.Tables.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Nonedata.Text")+"!");
- return;
- }
- SaveFileDialog saveFileDialog = new SaveFileDialog();
- saveFileDialog.DefaultExt = "xlsx";
- saveFileDialog.Title = PdnResources.GetString("Menu.ExportdatatoEXECLtable.Text");
- saveFileDialog.FileName = PdnResources.GetString("Menu.DedicatedAnalysis.BlackMetal.BandedStructure.Text")+ PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddhhmmss");
- saveFileDialog.Filter = "microsoft office execl files (*.xlsx)|*.xlsx";
- saveFileDialog.RestoreDirectory = true;
- if (saveFileDialog.ShowDialog() == DialogResult.OK)
- {
- List<System.Data.DataTable> list = new List<System.Data.DataTable>();
- foreach (System.Data.DataTable itemTable in ds.Tables)
- list.Add(itemTable);
- this.appWorkspace.ExportDataToExcelWithProgress(list, saveFileDialog.FileName, true, true, true);
- }
- }
- catch (Exception e)
- {
- throw e;
- }
- }
- /// <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)
- {
- if (this.dataGridView1.Rows.Count > 0)
- RefreshResultsData();
- if (this.dataGridView2.Rows.Count > 0)
- RefreshDataGridView4();
- if (this.listView2.Items.Count > 0)
- ResultCalculation();
- }
- /// <summary>
- /// 设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.MicrostructureBan_ASTME1268");
- 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.Manager.item3.MicrostructureBan_ASTME1268");
- 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.dataGridView2.Rows.Count; i++)
- {
- List<string> content1 = new List<string>();
- if (i == 0)
- {
- content1.Add(this.dataGridView2.Columns[0].HeaderText);
- content1.Add(this.dataGridView2.Columns[1].HeaderText);
- content1.Add(this.dataGridView2.Columns[2].HeaderText);
- content1.Add(this.dataGridView2.Columns[3].HeaderText);
- content1.Add(this.dataGridView2.Columns[4].HeaderText);
- content1.Add(this.dataGridView2.Columns[5].HeaderText);
- analysisContent.Add(content1);
- }
- content1 = new List<string>();
- content1.Add(this.dataGridView2.Rows[i].Cells[0].Value.ToString());
- content1.Add(this.dataGridView2.Rows[i].Cells[1].Value.ToString());
- content1.Add(this.dataGridView2.Rows[i].Cells[2].Value.ToString());
- content1.Add(this.dataGridView2.Rows[i].Cells[3].Value.ToString());
- content1.Add(this.dataGridView2.Rows[i].Cells[4].Value.ToString());
- content1.Add(this.dataGridView2.Rows[i].Cells[5].Value.ToString());
- analysisContent.Add(content1);
- }
- List<string> content2 = new List<string>();
- analysisContent.Add(content2);
- 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);
- content1.Add(this.dataGridView4.Columns[9].HeaderText);
- content1.Add(this.dataGridView4.Columns[10].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());
- content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[10].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 (ListViewItem item in this.listView2.SelectedItems)
- {
- if (bitDic.ContainsKey(item.Tag.ToString()))
- {
- bitList.Add(bitDic[item.Tag.ToString()][0]);
- bitList.Add(bitDic[item.Tag.ToString()][1]);
- }
- }
- }
- }
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
- }
- /// <summary>
- /// 自动添加截点
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox4_CheckedChanged(object sender, EventArgs e)
- {
- if(checkBox4.Checked)
- {
- if (this.button6.Visible)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!");
- this.checkBox4.Checked = false;
- 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")+"!");
- this.checkBox4.Checked = false;
- return;
- }
- GetNumberOfGrains();
- RefreshResultsData();
- }
- else
- {
- this.vPointCount = 0;
- this.hPointCount = 0;
- this.p1RectangleFs.Clear();
- this.dataGridView1.Rows.Clear();
- this.dataGridView3.Rows.Clear();
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 自动添加截点
- /// </summary>
- private void GetNumberOfGrains()
- {
- this.vPointCount = 0;
- this.hPointCount = 0;
- this.p1RectangleFs.Clear();
- Mat OriginalPicture = new Mat();
- if (this.documentWorkspace.PhaseModels[0].mat != null)
- this.documentWorkspace.phaseModels[0].mat.CopyTo(OriginalPicture);
- else
- mat.CopyTo(OriginalPicture);
- List<PointF> vPointFs = new List<PointF>();
- List<PointF> hPointFs = new List<PointF>();
- foreach (var rectangleF in this.vRectangleFs)
- {
- for (int i = (int)rectangleF.Top + 3; i <= rectangleF.Bottom - 3; i++)
- {
- vPointFs.Add(new PointF((float)rectangleF.X + (float)rectangleF.Width / 2, i));
- }
- }
- foreach (var rectangleF in this.hRectangleFs)
- {
- for (int i = (int)rectangleF.Left + 3; i <= rectangleF.Right - 3; i++)
- {
- hPointFs.Add(new PointF(i, (float)rectangleF.Y + (float)rectangleF.Height / 2));
- }
- }
- foreach (var pointF in vPointFs)
- {
- PointF center = pointF;
- if (center.Y >= 0 && center.Y < this.documentWorkspace.CompositionSurface.Height
- && center.X >= 0 && center.X < this.documentWorkspace.CompositionSurface.Width)
- {
- Vec4b vec4BCenter = OriginalPicture.At<Vec4b>();
- if (center.X >= 0 && center.X < this.documentWorkspace.CompositionSurface.Width
- && center.Y >= 0 && center.Y < this.documentWorkspace.CompositionSurface.Height)
- {
- vec4BCenter = OriginalPicture.At<Vec4b>((int)center.Y, (int)center.X);
- if (this.documentWorkspace.PhaseModels[0].mat != null)
- {
- if (vec4BCenter.Item3 > 0)
- {
- continue;
- }
- }
- else if (vec4BCenter.Item0 == 0 && vec4BCenter.Item1 == 0 && vec4BCenter.Item2 == 0 && vec4BCenter.Item3 == 255)
- continue;
- }
- PointF leftTopP = new PointF(center.X - 1, center.Y - 1);
- PointF top = new PointF(center.X, center.Y - 1);
- PointF rightTop = new PointF(center.X + 1, center.Y - 1);
- PointF left = new PointF(center.X - 1, center.Y);
- PointF right = new PointF(center.X + 1, center.Y);
- PointF leftBottom = new PointF(center.X - 1, center.Y + 1);
- PointF bottom = new PointF(center.X, center.Y + 1);
- PointF rightBottom = new PointF(center.X + 1, center.Y + 1);
- Vec4b vec4BLeftTop = OriginalPicture.At<Vec4b>();
- Vec4b vec4BTop = OriginalPicture.At<Vec4b>();
- Vec4b vec4BRightTop = OriginalPicture.At<Vec4b>();
- Vec4b vec4BLeft = OriginalPicture.At<Vec4b>();
- Vec4b vec4BRight = OriginalPicture.At<Vec4b>();
- Vec4b vec4BLeftBottom = OriginalPicture.At<Vec4b>();
- Vec4b vec4BBottom = OriginalPicture.At<Vec4b>();
- Vec4b vec4BRightBottom = OriginalPicture.At<Vec4b>();
- if (leftTopP.X >= 0 && leftTopP.X < this.documentWorkspace.CompositionSurface.Width
- && leftTopP.Y >= 0 && leftTopP.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BLeftTop = OriginalPicture.At<Vec4b>((int)leftTopP.Y, (int)leftTopP.X);
- if (top.X >= 0 && top.X < this.documentWorkspace.CompositionSurface.Width
- && top.Y >= 0 && top.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BTop = OriginalPicture.At<Vec4b>((int)top.Y, (int)top.X);
- if (rightTop.X >= 0 && rightTop.X < this.documentWorkspace.CompositionSurface.Width
- && rightTop.Y >= 0 && rightTop.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BRightTop = OriginalPicture.At<Vec4b>((int)rightTop.Y, (int)rightTop.X);
- if (left.X >= 0 && left.X < this.documentWorkspace.CompositionSurface.Width
- && left.Y >= 0 && left.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BLeft = OriginalPicture.At<Vec4b>((int)left.Y, (int)left.X);
- if (right.X >= 0 && right.X < this.documentWorkspace.CompositionSurface.Width
- && right.Y >= 0 && right.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BRight = OriginalPicture.At<Vec4b>((int)right.Y, (int)right.X);
- if (leftBottom.X >= 0 && leftBottom.X < this.documentWorkspace.CompositionSurface.Width
- && leftBottom.Y >= 0 && leftBottom.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BLeftBottom = OriginalPicture.At<Vec4b>((int)leftBottom.Y, (int)leftBottom.X);
- if (bottom.X >= 0 && bottom.X < this.documentWorkspace.CompositionSurface.Width
- && bottom.Y >= 0 && bottom.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BBottom = OriginalPicture.At<Vec4b>((int)bottom.Y, (int)bottom.X);
- if (rightBottom.X >= 0 && rightBottom.X < this.documentWorkspace.CompositionSurface.Width
- && rightBottom.Y >= 0 && rightBottom.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BRightBottom = OriginalPicture.At<Vec4b>((int)rightBottom.Y, (int)rightBottom.X);
- if (center.X == 0 && center.Y > 0 && center.Y < this.documentWorkspace.CompositionSurface.Height)
- {
- vec4BLeftTop = vec4BCenter;
- vec4BLeft = vec4BCenter;
- vec4BLeftBottom = vec4BCenter;
- }
- else if (center.X == 0 && center.Y == 0)
- {
- vec4BLeftTop = vec4BCenter;
- vec4BLeft = vec4BCenter;
- vec4BLeftBottom = vec4BCenter;
- vec4BTop = vec4BCenter;
- vec4BRightTop = vec4BCenter;
- }
- else if (center.X == 0 && center.Y == this.documentWorkspace.CompositionSurface.Height)
- {
- vec4BLeftTop = vec4BCenter;
- vec4BLeft = vec4BCenter;
- vec4BLeftBottom = vec4BCenter;
- vec4BBottom = vec4BCenter;
- vec4BRightBottom = vec4BCenter;
- }
- if (center.X == this.documentWorkspace.CompositionSurface.Width && center.Y > 0 && center.Y < this.documentWorkspace.CompositionSurface.Height)
- {
- vec4BRightTop = vec4BCenter;
- vec4BRight = vec4BCenter;
- vec4BRightBottom = vec4BCenter;
- }
- else if (center.X == this.documentWorkspace.CompositionSurface.Width && center.Y == 0)
- {
- vec4BLeftTop = vec4BCenter;
- vec4BTop = vec4BCenter;
- vec4BRightTop = vec4BCenter;
- vec4BRight = vec4BCenter;
- vec4BRightBottom = vec4BCenter;
- }
- else if (center.X == this.documentWorkspace.CompositionSurface.Width && center.Y == this.documentWorkspace.CompositionSurface.Height)
- {
- vec4BLeftBottom = vec4BCenter;
- vec4BBottom = vec4BCenter;
- vec4BRightBottom = vec4BCenter;
- vec4BRight = vec4BCenter;
- vec4BRightTop = vec4BCenter;
- }
- else if (center.Y == 0 && center.X > 0 && center.X < this.documentWorkspace.CompositionSurface.Width)
- {
- vec4BLeftTop = vec4BCenter;
- vec4BTop = vec4BCenter;
- vec4BRightTop = vec4BCenter;
- }
- else if (center.Y == this.documentWorkspace.CompositionSurface.Height && center.X > 0 && center.X < this.documentWorkspace.CompositionSurface.Width)
- {
- vec4BLeftBottom = vec4BCenter;
- vec4BBottom = vec4BCenter;
- vec4BRightBottom = vec4BCenter;
- }
- if (vec4BCenter == vec4BLeftTop && vec4BCenter == vec4BTop && vec4BCenter == vec4BRightTop
- && vec4BCenter == vec4BLeft && vec4BCenter == vec4BRight && vec4BCenter == vec4BLeftBottom
- && vec4BCenter == vec4BBottom && vec4BCenter == vec4BRightBottom)
- { }
- else
- {
- float size = (float)(Convert.ToInt32(this.txt_LeftSize.Text) / unitLength);
- p1RectangleFs.Add(new RectangleF(pointF.X - (float)(size / 2)
- , pointF.Y - (float)(size / 2)
- , size, size));
- this.vPointCount++;
- }
-
- }
- }
- foreach (var pointF in hPointFs)
- {
- PointF center = pointF;
- if (center.Y >= 0 && center.Y < this.documentWorkspace.CompositionSurface.Height
- && center.X >= 0 && center.X < this.documentWorkspace.CompositionSurface.Width)
- {
- Vec4b vec4BCenter = OriginalPicture.At<Vec4b>();
- if (center.X >= 0 && center.X < this.documentWorkspace.CompositionSurface.Width
- && center.Y >= 0 && center.Y < this.documentWorkspace.CompositionSurface.Height)
- {
- vec4BCenter = OriginalPicture.At<Vec4b>((int)center.Y, (int)center.X);
- if (this.documentWorkspace.PhaseModels[0].mat != null)
- {
- if (vec4BCenter.Item3 > 0)
- {
- continue;
- }
- }
- else if (vec4BCenter.Item0 == 0 && vec4BCenter.Item1 == 0 && vec4BCenter.Item2 == 0 && vec4BCenter.Item3 == 255)
- continue;
- }
- PointF leftTopP = new PointF(center.X - 1, center.Y - 1);
- PointF top = new PointF(center.X, center.Y - 1);
- PointF rightTop = new PointF(center.X + 1, center.Y - 1);
- PointF left = new PointF(center.X - 1, center.Y);
- PointF right = new PointF(center.X + 1, center.Y);
- PointF leftBottom = new PointF(center.X - 1, center.Y + 1);
- PointF bottom = new PointF(center.X, center.Y + 1);
- PointF rightBottom = new PointF(center.X + 1, center.Y + 1);
- Vec4b vec4BLeftTop = OriginalPicture.At<Vec4b>();
- Vec4b vec4BTop = OriginalPicture.At<Vec4b>();
- Vec4b vec4BRightTop = OriginalPicture.At<Vec4b>();
- Vec4b vec4BLeft = OriginalPicture.At<Vec4b>();
- Vec4b vec4BRight = OriginalPicture.At<Vec4b>();
- Vec4b vec4BLeftBottom = OriginalPicture.At<Vec4b>();
- Vec4b vec4BBottom = OriginalPicture.At<Vec4b>();
- Vec4b vec4BRightBottom = OriginalPicture.At<Vec4b>();
- if (leftTopP.X >= 0 && leftTopP.X < this.documentWorkspace.CompositionSurface.Width
- && leftTopP.Y >= 0 && leftTopP.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BLeftTop = OriginalPicture.At<Vec4b>((int)leftTopP.Y, (int)leftTopP.X);
- if (top.X >= 0 && top.X < this.documentWorkspace.CompositionSurface.Width
- && top.Y >= 0 && top.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BTop = OriginalPicture.At<Vec4b>((int)top.Y, (int)top.X);
- if (rightTop.X >= 0 && rightTop.X < this.documentWorkspace.CompositionSurface.Width
- && rightTop.Y >= 0 && rightTop.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BRightTop = OriginalPicture.At<Vec4b>((int)rightTop.Y, (int)rightTop.X);
- if (left.X >= 0 && left.X < this.documentWorkspace.CompositionSurface.Width
- && left.Y >= 0 && left.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BLeft = OriginalPicture.At<Vec4b>((int)left.Y, (int)left.X);
- if (right.X >= 0 && right.X < this.documentWorkspace.CompositionSurface.Width
- && right.Y >= 0 && right.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BRight = OriginalPicture.At<Vec4b>((int)right.Y, (int)right.X);
- if (leftBottom.X >= 0 && leftBottom.X < this.documentWorkspace.CompositionSurface.Width
- && leftBottom.Y >= 0 && leftBottom.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BLeftBottom = OriginalPicture.At<Vec4b>((int)leftBottom.Y, (int)leftBottom.X);
- if (bottom.X >= 0 && bottom.X < this.documentWorkspace.CompositionSurface.Width
- && bottom.Y >= 0 && bottom.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BBottom = OriginalPicture.At<Vec4b>((int)bottom.Y, (int)bottom.X);
- if (rightBottom.X >= 0 && rightBottom.X < this.documentWorkspace.CompositionSurface.Width
- && rightBottom.Y >= 0 && rightBottom.Y < this.documentWorkspace.CompositionSurface.Height)
- vec4BRightBottom = OriginalPicture.At<Vec4b>((int)rightBottom.Y, (int)rightBottom.X);
- if (center.X == 0 && center.Y > 0 && center.Y < this.documentWorkspace.CompositionSurface.Height)
- {
- vec4BLeftTop = vec4BCenter;
- vec4BLeft = vec4BCenter;
- vec4BLeftBottom = vec4BCenter;
- }
- else if (center.X == 0 && center.Y == 0)
- {
- vec4BLeftTop = vec4BCenter;
- vec4BLeft = vec4BCenter;
- vec4BLeftBottom = vec4BCenter;
- vec4BTop = vec4BCenter;
- vec4BRightTop = vec4BCenter;
- }
- else if (center.X == 0 && center.Y == this.documentWorkspace.CompositionSurface.Height)
- {
- vec4BLeftTop = vec4BCenter;
- vec4BLeft = vec4BCenter;
- vec4BLeftBottom = vec4BCenter;
- vec4BBottom = vec4BCenter;
- vec4BRightBottom = vec4BCenter;
- }
- if (center.X == this.documentWorkspace.CompositionSurface.Width && center.Y > 0 && center.Y < this.documentWorkspace.CompositionSurface.Height)
- {
- vec4BRightTop = vec4BCenter;
- vec4BRight = vec4BCenter;
- vec4BRightBottom = vec4BCenter;
- }
- else if (center.X == this.documentWorkspace.CompositionSurface.Width && center.Y == 0)
- {
- vec4BLeftTop = vec4BCenter;
- vec4BTop = vec4BCenter;
- vec4BRightTop = vec4BCenter;
- vec4BRight = vec4BCenter;
- vec4BRightBottom = vec4BCenter;
- }
- else if (center.X == this.documentWorkspace.CompositionSurface.Width && center.Y == this.documentWorkspace.CompositionSurface.Height)
- {
- vec4BLeftBottom = vec4BCenter;
- vec4BBottom = vec4BCenter;
- vec4BRightBottom = vec4BCenter;
- vec4BRight = vec4BCenter;
- vec4BRightTop = vec4BCenter;
- }
- else if (center.Y == 0 && center.X > 0 && center.X < this.documentWorkspace.CompositionSurface.Width)
- {
- vec4BLeftTop = vec4BCenter;
- vec4BTop = vec4BCenter;
- vec4BRightTop = vec4BCenter;
- }
- else if (center.Y == this.documentWorkspace.CompositionSurface.Height && center.X > 0 && center.X < this.documentWorkspace.CompositionSurface.Width)
- {
- vec4BLeftBottom = vec4BCenter;
- vec4BBottom = vec4BCenter;
- vec4BRightBottom = vec4BCenter;
- }
- if (vec4BCenter == vec4BLeftTop && vec4BCenter == vec4BTop && vec4BCenter == vec4BRightTop
- && vec4BCenter == vec4BLeft && vec4BCenter == vec4BRight && vec4BCenter == vec4BLeftBottom
- && vec4BCenter == vec4BBottom && vec4BCenter == vec4BRightBottom)
- { }
- else
- {
- float size = (float)(Convert.ToInt32(this.txt_LeftSize.Text) / unitLength);
- p1RectangleFs.Add(new RectangleF(pointF.X - (float)(size / 2)
- , pointF.Y - (float)(size / 2)
- , size, size));
- this.hPointCount++;
- }
- }
- }
- }
- /// <summary>
- /// 刷新结果数据
- /// </summary>
- private void RefreshResultsData()
- {
- double unitLength = 0;
- this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Millimeter, out unitLength);
- this.dataGridView1.Rows.Clear();
- this.dataGridView3.Rows.Clear();
- DataGridViewRow dtr = new DataGridViewRow();
- DataGridViewRow dtr1 = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView1.Columns)
- {
- dtr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- dtr1.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- decimal lv = 0;
- decimal lh = 0;
- if (this.vRectangleFs.Count > 0)
- lv = ((decimal)this.vRectangleFs[0].Height - 6) * this.vNumber;
- if (this.hRectangleFs.Count > 0)
- lh = ((decimal)this.hRectangleFs[0].Width - 6) * this.hNumber;
- if (lv != 0 && lh != 0)
- {
- dtr.Cells[0].Value = PdnResources.GetString("Menu.view.text") + "1";
- dtr.Cells[1].Value = Math.Round((decimal)this.vPointCount / 2 / ((decimal)lv * (decimal)unitLength), Convert.ToInt32(this.numericUpDown1.Value));
- dtr.Cells[2].Value = Math.Round((decimal)this.hPointCount / 2 / ((decimal)lh * (decimal)unitLength), Convert.ToInt32(this.numericUpDown1.Value));
- dtr.Cells[3].Value = Math.Round((decimal)this.vPointCount / ((decimal)lv * (decimal)unitLength), Convert.ToInt32(this.numericUpDown1.Value));
- dtr.Cells[4].Value = Math.Round((decimal)this.hPointCount / ((decimal)lh * (decimal)unitLength), Convert.ToInt32(this.numericUpDown1.Value));
- this.dataGridView1.Rows.Add(dtr);
- dtr1.Cells[0].Value = PdnResources.GetString("Menu.view.text") + "1";
- dtr1.Cells[1].Value = (decimal)this.vPointCount / 2 / ((decimal)lv * (decimal)unitLength);
- dtr1.Cells[2].Value = (decimal)this.hPointCount / 2 / ((decimal)lh * (decimal)unitLength);
- dtr1.Cells[3].Value = (decimal)this.vPointCount / ((decimal)lv * (decimal)unitLength);
- dtr1.Cells[4].Value = (decimal)this.hPointCount / ((decimal)lh * (decimal)unitLength);
- }
- this.dataGridView3.Rows.Add(dtr1);
- }
- private void checkBox5_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 导出项目
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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.BandedStructure.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.dataGridView2.Rows.Count; i++)
- {
- List<string> content1 = new List<string>();
- if (i == 0)
- {
- content1.Add(this.dataGridView2.Columns[0].HeaderText);
- content1.Add(this.dataGridView2.Columns[1].HeaderText);
- content1.Add(this.dataGridView2.Columns[2].HeaderText);
- content1.Add(this.dataGridView2.Columns[3].HeaderText);
- content1.Add(this.dataGridView2.Columns[4].HeaderText);
- content1.Add(this.dataGridView2.Columns[5].HeaderText);
- analysisContent.Add(content1);
- }
- content1 = new List<string>();
- content1.Add(this.dataGridView2.Rows[i].Cells[0].Value.ToString());
- content1.Add(this.dataGridView2.Rows[i].Cells[1].Value.ToString());
- content1.Add(this.dataGridView2.Rows[i].Cells[2].Value.ToString());
- content1.Add(this.dataGridView2.Rows[i].Cells[3].Value.ToString());
- content1.Add(this.dataGridView2.Rows[i].Cells[4].Value.ToString());
- content1.Add(this.dataGridView2.Rows[i].Cells[5].Value.ToString());
- analysisContent.Add(content1);
- }
- List<string> content2 = new List<string>();
- analysisContent.Add(content2);
- 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);
- content1.Add(this.dataGridView4.Columns[9].HeaderText);
- content1.Add(this.dataGridView4.Columns[10].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());
- content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString());
- content1.Add(this.dataGridView4.Rows[i].Cells[10].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 (ListViewItem itemL2 in this.listView2.SelectedItems)
- {
- if (bitDic.ContainsKey(itemL2.Tag.ToString()))
- {
- bitList.Add(bitDic[itemL2.Tag.ToString()][0]);
- bitList.Add(bitDic[itemL2.Tag.ToString()][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)
- {
- }
- }
- #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, checkBox5.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//网格移动
- saveParamValue(ParamKey_Report, checkBox3.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//报告设置
- saveParamValue(ParamKey_Circular, rb_LeftCircle.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//圆形
- saveParamValue(ParamKey_Square, rb_LeftSquare.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//方形
- saveParamValue(ParamKey_Solid, rb_leftFill.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//实心
- saveParamValue(ParamKey_Hollow, rb_leftNoFill.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//空心
- saveParamValue(ParamKey_Size, txt_LeftSize.Text, (int)Base.Dtryt.ItemString);//尺寸
- saveParamValue(ParamKey_Width, txt_LeftLineWeight.Text, (int)Base.Dtryt.ItemString);//线宽
- saveParamValue(ParamKey_Colour, panel1.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//颜色
- 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:
- checkBox5.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Report:
- checkBox3.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Circular:
- rb_LeftCircle.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Square:
- rb_LeftSquare.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Solid:
- rb_leftFill.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Hollow:
- rb_leftNoFill.Checked = (Boolean)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Size:
- txt_LeftSize.Text = (string)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Width:
- txt_LeftLineWeight.Text = (string)this.analysisModel.ListParam[i].value;
- break;
- case ParamKey_Colour:
- panel1.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 "OpenWhileExportReport":
- checkBox3.Checked = Convert.ToBoolean(value);
- break;
- case "CalculatorDecimalDigits":
- numericUpDown1.Value = Convert.ToDecimal(value);
- break;
- case "ExportResults":
- value = false;
- break;
- case "ExportReports":
- value = false;
- break;
- case "ExportProjects":
- value = false;
- 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 "OpenWhileExportReport":
- value = checkBox3.Checked;
- break;
- case "CalculatorDecimalDigits":
- value = numericUpDown1.Value;
- break;
- }
- return value;
- }
- #endregion
- }
- }
|