12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132 |
- using Metis.ParameterSet;
- using OpenCvSharp;
- using PaintDotNet.Annotation;
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Base;
- using PaintDotNet.Base.CommTool;
- 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.Windows.Forms;
- namespace PaintDotNet.DedicatedAnalysis.QuantitativeAnalysis
- {
- /// <summary>
- /// 晶粒度(计点法)
- /// </summary>
- internal class GrainSizePointCountingMethodDialog : 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 Label label4;
- private Label label3;
- 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;
- /// <summary>
- /// 网格间距(μm)
- /// </summary>
- private TextBox textBox5;
- private TextBox textBox4;
- private TextBox textBox3;
- private TextBox textBox2;
- /// <summary>
- /// 余白(μm)
- /// </summary>
- private NumericUpDown numericUpDown4;
- private GroupBox groupBox5;
- private Panel panel2;
- private GroupBox groupBox6;
- private Label label13;
- private RadioButton rb_RightNoFill;
- private RadioButton rb_RightFill;
- private Label label14;
- private TextBox txt_RightLineWeight;
- private Label label15;
- private TextBox txt_RightSize;
- private Label label16;
- private RadioButton rb_RightSquare;
- private RadioButton rb_RightCircle;
- private Label label17;
- private GroupBox groupBox10;
- private GroupBox groupBox11;
- private Label label18;
- private RadioButton rb_leftNoFill;
- private RadioButton rb_leftFill;
- private Panel panel1;
- private Label label19;
- private TextBox txt_LeftLineWeight;
- private Label label20;
- private TextBox txt_LeftSize;
- private Label label21;
- private RadioButton rb_LeftSquare;
- private RadioButton rb_LeftCircle;
- private Label label22;
- private GroupBox groupBox9;
- private Button But_DelPhase;
- private Button but_AddPhase;
- private Button but_Clear;
- private DataGridView dataGridView1;
- private Button button1;
- private CheckBox checkBox3;
- private Panel panel4;
- private Button button7;
- private DataGridViewTextBoxColumn Column1;
- private DataGridViewTextBoxColumn Column2;
- private DataGridViewTextBoxColumn Column3;
- private DataGridViewTextBoxColumn Column4;
- private DataGridViewTextBoxColumn Column5;
- private DataGridViewTextBoxColumn Column6;
- private DataGridViewTextBoxColumn Column7;
- private GroupBox groupBox12;
- private CheckBox checkBox5;
- private CheckBox checkBox4;
- private CheckBox checkBox6;
- private Button button8;
- private DataGridViewTextBoxColumn Column11;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
- #endregion
- #region 属性
- //二值化集成1
- BinaryClass binaryClass;
- private int menuId;
- protected static string ParamKey_selectedGrid = "selectedGrid";//使用网格
- protected static string ParamKey_point1Rectangle = "point1Rectangle";//1点设置 形状
- protected static string ParamKey_point1Style = "point1Style";//1点设置 样式
- protected static string ParamKey_point1Size = "point1Size";//1点设置 尺寸
- protected static string ParamKey_point1LineWidth = "point1LineWidth";//1点设置 线宽
- protected static string ParamKey_point1LineColor = "point1LineColor";//1点设置 颜色
- protected static string ParamKey_point05Rectangle = "point05Rectangle";//0.5点设置 形状
- protected static string ParamKey_point05Style = "point05Style";//0.5点设置 样式
- protected static string ParamKey_point05Size = "point05Size";//0.5点设置 尺寸
- protected static string ParamKey_point05LineWidth = "point05LineWidth";//0.5点设置 线宽
- protected static string ParamKey_point05LineColor = "point05LineColor";//0.5点设置 颜色
- protected static string ParamKey_CalculatorDecimalDigits = "CalculatorDecimalDigits";//小数点位数
- protected static string ParamKey_OpenWhileExportReport = "OpenWhileExportReport";//生成报告时打开设置
- /// <summary>
- /// 保存所有窗口的参数
- /// </summary>
- private Dictionary<string, GrainSizeAnalysisModel> analysisDict = new Dictionary<string, GrainSizeAnalysisModel>();
- /// <summary>
- /// 选中图片的mat
- /// </summary>
- private Mat imageMat;
- /// <summary>
- /// 存在视场标记
- /// </summary>
- private bool existViewFlag = false;
- /// <summary>
- /// 是否选择了图片
- /// </summary>
- private int selectPicture = -1;
- /// <summary>
- /// 当前选择的图片
- /// </summary>
- private Mat mat;
- private int changeCount;
- /// <summary>
- /// 主空间
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 所有截点
- /// </summary>
- public List<List<RectangleF>> p1RectangleFs = new List<List<RectangleF>>();
- public List<List<RectangleF>> p2RectangleFs = new List<List<RectangleF>>();
- /// <summary>
- /// 图像面板
- /// </summary>
- private DocumentWorkspaceWindow documentWorkspace;
- /// <summary>
- /// 公共控件
- /// </summary>
- private GeneralAnalysisCommonControlButtons commonControlButtons;
- /// <summary>
- /// 调色板
- /// </summary>
- PaintDotNet.ColorsForm colorsForm1;
- /// <summary>
- /// 调色板
- /// </summary>
- PaintDotNet.ColorsForm colorsForm2;
- /// <summary>
- /// 调色板
- /// </summary>
- PaintDotNet.ColorsForm colorsForm3;
- /// <summary>
- /// 调色板
- /// </summary>
- PaintDotNet.ColorsForm colorsForm4;
- /// <summary>
- /// 网格交点
- /// </summary>
- private List<RectangleF> rectangleFs = new List<RectangleF>();
- /// <summary>
- /// 图片测量记录
- /// </summary>
- private List<DataTable> pictureDataTables = new List<DataTable>();
- /// <summary>
- /// 是否全部显示
- /// </summary>
- private bool allShow = false;
- /// <summary>
- /// 避免自动勾选引起的数据问题
- /// </summary>
- private bool autoCheck = false;
- /// <summary>
- /// 超出尺寸
- /// </summary>
- private bool exceed;
- /// <summary>
- /// 网格Xml
- /// </summary>
- private GrainSizePointCountingMethodModel grainSizePointCountingMethodModel;
- /// <summary>
- /// 网格绘制区域
- /// </summary>
- private float minX;
- private float maxX;
- private float minY;
- private float maxY;
- /// <summary>
- /// 保存用于生成报告的图片
- /// </summary>
- private List<Bitmap> bitList;
- /// <summary>
- /// 数据变化
- /// </summary>
- private bool saveSuccess = false;
- public string typeName;
- private string oldValue;
- /// <summary>
- /// 储存点击保存结果后的所有原图与分析图
- /// </summary>
- private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
- /// <summary>
- /// 中间数据
- /// </summary>
- private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
- private Button button9;
- private BinaryControlSmaller bc;
- private Dictionary<int, Boolean> check1Dic = new Dictionary<int, Boolean>();
- #endregion 属性
- /// <summary>
- /// 0,E1181; 1,ISO14250; 2,GBT24177;
- /// </summary>
- int gbtType;
- ///// <summary>
- ///// 微米/像素
- ///// </summary>
- //private double ruleValue = 1.0;
- #region 网格样式
- /// <summary>
- /// 水平数量
- /// </summary>
- private int hNumber;
- /// <summary>
- /// 垂直数量
- /// </summary>
- private int vNumber;
- /// <summary>
- /// 网格线宽
- /// </summary>
- private int gridWidth;
- /// <summary>
- /// 网格间距(μm)
- /// </summary>
- private int gridSpacing_rulevalue;
- /// <summary>
- /// 网格颜色
- /// </summary>
- private int gridColor;
- /// <summary>
- /// 全图 true:全图 false:非全图
- /// </summary>
- private bool wholePicture;
- private Button button_ApplyToAll;
- /// <summary>
- /// 余白(μm)
- /// </summary>
- private int blank_rulevalue = 1;
- private string menuName;
- #endregion
- /// <summary>
- ///
- /// </summary>
- /// <param name="appWorkspace"></param>
- /// <param name="gbtType">0,E1181; 1,ISO14250; 2,GBT24177;</param>
- public GrainSizePointCountingMethodDialog(AppWorkspace appWorkspace, int gbtType, PdnMenuItem menuItem)
- {
- this.menuId = menuItem.MenuId;
- this.menuName = menuItem.Text;
- binaryClass = new BinaryClass(menuId);
- this.gbtType = gbtType;
- if (this.gbtType == 2)
- this.Text = "GBT24177(" + PdnResources.GetString("Menu.Meterpointmethod.Text") + ")";
- else if (this.gbtType == 1)
- this.Text = "ISO14250_2000(" + PdnResources.GetString("Menu.Meterpointmethod.Text") + ")";
- else if (this.gbtType == 0)
- this.Text = "ASTM_E1181_2002(" + PdnResources.GetString("Menu.Meterpointmethod.Text") + ")";
- else
- this.Text = PdnResources.GetString("Menu.Meterpointmethod.Text");
- 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.commonControlButtons = new GeneralAnalysisCommonControlButtons();
- this.commonControlButtons.Dock = DockStyle.Top;
- this.commonControlButtons.Height = 30;
- this.commonControlButtons.HideZoomToWindowAndActualSize();
- this.commonControlButtons.trackLabel.Text = PdnResources.GetString("Menu.1point:clicktelete:doubleclick.text");
- this.commonControlButtons.trackLabel.Visible = true;
- this.commonControlButtons.trackLabel.Width = 300;
- this.commonControlButtons.Visible = false;
- this.groupBox7.Controls.Add(commonControlButtons);
- this.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.MouseMove += onMouseMove;
- this.documentWorkspace.ActiveTool = DrawToolType.Pointer;
- this.groupBox7.Controls.Add(this.documentWorkspace);
- //获取
- //Startup.instance.rules.TryGetValue(MeasurementUnit.Micron, out ruleValue);
- //double ruleValue = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
- ////double physical_area_length_Micron = getCurrentWorkspace().GetRuler(MeasurementUnit.Micron);
- //二值化集成2
- bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件
- binaryClass.createDocumentItemsSmaller(new string[] { "bp1"/*PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text")*//*, PdnResources.GetString("Menu.Grainboundarytoreproduce.text")*/ }
- , this.bc, this.appWorkspace, this.documentWorkspace, this.listView1);//初始化相的工作结构
- binaryClass.BinaryImplFinishAction += new EventHandler(this.refreshRectangleFs/*bClassBinaryImplFinishAction*/);//二值化后续处理事件(参数改变时,重新处理图像)
- InitCommonButtonEvent();
- InitGridStyle();
- InitPicList();
- //初始化图片列表
- int imgIndex = -1;
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
- {
- imgIndex = i;
- break;
- }
- //如果是脚本执行,将参数带入
- if (imgIndex != -1 && appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null && (int)appWorkspace.ScriptCurrentParam.MenuId == menuId)
- {
- ////在这里反射出对应功能的参数类
- 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;
- }
- GrainSizeAnalysisModel analysisModel = GrainSizeAnalysisModel.cloneListParamScript(param);
- foreach (var item in analysisModel.ListParam)
- item.setValue();
- this.analysisDict.Add(this.imageList1.Images.Keys[imgIndex], analysisModel);
- appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
- }
- else if (imgIndex != -1)
- {//读取上次关闭窗口时保存的参数
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- GrainSizeAnalysisModel analysisModel = analysisModelXml.cloneListParamModel(this.menuId);
- foreach (var item in analysisModel.ListParam)
- item.setValue();
- this.analysisDict.Add(this.imageList1.Images.Keys[imgIndex], analysisModel);
- }
- SetAnalyzeModelFromXml(getModelName());
- }
-
- private string getModelName()
- {
- if (this.gbtType == 2)
- return "Template.Manager.item3.GrainSizePointCounting";
- else if (this.gbtType == 1)
- return "Template.Manager.item3.GrainSizePCount14250Method";
- else if (this.gbtType == 0)
- return "Template.Manager.item3.GrainSizePCount1181Method";
- else
- return "Template.Manager.item3.GrainSizePointCounting";
- }
- #region 二值化相关方法
- private void GrainSizeDialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (getCurrentWorkTag() == null)
- {
- return;
- }
- #region [开启脚本录制]
- if (appWorkspace.startScriptRecording)
- {
- getScriptRecording();
- }
- #endregion
- binaryClass.saveParams();
- this.saveDialogParamValues(getCurrentWorkTag());
- GrainSizeAnalysisModel analysisModel = this.analysisDict[getCurrentWorkTag()];
- //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 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)
- {
- GrainSizeAnalysisModel newMod = analysisItem.cloneModel();
- newMod.value = null;//避免value为集合导致保存出错
- analysisModelXml.ListParam.Add(newMod);
- }
- //analysisModelXml.ListParam.Add(analysisItem.cloneModel());
- }
- //按路径和名称保存xml文件
- string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
- //保存xml
- FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
- this.documentWorkspace.GraphicsList.DeleteDrawClass(DrawClass.PhaseExtraction);
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 保存界面中的参数到model
- /// </summary>
- private void saveDialogParamValues(string imageKey)
- {
- GrainSizeAnalysisModel analysisModel = this.analysisDict[imageKey];
- analysisModel.saveParamValue(ParamKey_point1Rectangle, rb_LeftCircle.Checked ? "1" : "2", (int)Base.Dtryt.Interger, this.menuId);//1点设置 形状
- analysisModel.saveParamValue(ParamKey_point1Style, rb_leftFill.Checked ? "1" : "2", (int)Base.Dtryt.Interger, this.menuId);//1点设置 样式
- analysisModel.saveParamValue(ParamKey_point1Size, this.txt_LeftSize.Text.ToString(), (int)Base.Dtryt.ItemString, this.menuId);//1点设置 尺寸
- analysisModel.saveParamValue(ParamKey_point1LineWidth, this.txt_LeftLineWeight.Text.ToString(), (int)Base.Dtryt.ItemString, this.menuId);//1点设置 线宽
- analysisModel.saveParamValue(ParamKey_point1LineColor, /*(int)*/this.panel1.BackColor.ToArgb().ToString(), (int)Base.Dtryt.ItemString/*Str*/, this.menuId);//1点设置 颜色
- analysisModel.saveParamValue(ParamKey_point05Rectangle, rb_RightCircle.Checked ? "1" : "2", (int)Base.Dtryt.Interger, this.menuId);//0.5点设置 形状
- analysisModel.saveParamValue(ParamKey_point05Style, rb_RightFill.Checked ? "1" : "2", (int)Base.Dtryt.Interger, this.menuId);//0.5点设置 样式
- analysisModel.saveParamValue(ParamKey_point05Size, this.txt_RightSize.Text.ToString(), (int)Base.Dtryt.ItemString, this.menuId);//0.5点设置 尺寸
- analysisModel.saveParamValue(ParamKey_point05LineWidth, this.txt_RightLineWeight.Text.ToString(), (int)Base.Dtryt.ItemString, this.menuId);//0.5点设置 线宽
- analysisModel.saveParamValue(ParamKey_point05LineColor, /*(int)*/this.panel2.BackColor.ToArgb().ToString(), (int)Base.Dtryt.ItemString/*Str*/, this.menuId);//0.5点设置 颜色
- analysisModel.saveParamValue(ParamKey_selectedGrid, comboBox1.SelectedItem.ToString(), (int)Base.Dtryt.ItemString, this.menuId);//使用网格
- analysisModel.saveParamValue(ParamKey_CalculatorDecimalDigits, Convert.ToInt32(this.numericUpDown1.Value).ToString(), (int)Base.Dtryt.Interger, this.menuId);
- analysisModel.saveParamValue(ParamKey_OpenWhileExportReport, this.checkBox3.Checked ? "0" : "1", (int)Base.Dtryt.Boolean, this.menuId);//生成报告时打开设置
- }
- private string getCurrentWorkTag()
- {
- if (this.listView1 != null && this.listView1.FocusedItem != null)
- return this.imageList1.Images.Keys[this.listView1.FocusedItem.Index];
- return null;
- }
- /// <summary>
- /// 读取保存的参数给窗口显示
- /// </summary>
- private void showSaveParamToControl()
- {
- //读取上次关闭窗口时保存的参数
- if (this.analysisDict.Count == 0)
- {
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
- GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
- GrainSizeAnalysisModel grainSizeAnalysisModel = analysisModelXml.cloneListParamModel(this.menuId);
- foreach (var item in grainSizeAnalysisModel.ListParam)
- item.setValue();
- this.analysisDict.Add(getCurrentWorkTag(), grainSizeAnalysisModel);
- }
- GrainSizeAnalysisModel analysisModel = this.analysisDict[getCurrentWorkTag()];
- object ShowGrainBoundry;
- if (analysisModel.GetParamValue1(ParamKey_CalculatorDecimalDigits, out ShowGrainBoundry, this.menuId))//小数点位数
- this.numericUpDown1.Value = (int)ShowGrainBoundry;
- if (analysisModel.GetParamValue1(ParamKey_OpenWhileExportReport, out ShowGrainBoundry, this.menuId))//生成报告时打开设置
- this.checkBox3.Checked = (bool)ShowGrainBoundry;
- if (analysisModel.GetParamValue1(ParamKey_point1Rectangle, out ShowGrainBoundry, this.menuId))//1点设置 形状
- {
- this.rb_LeftCircle.Checked = int.Parse(ShowGrainBoundry.ToString()) == 1;
- this.rb_LeftSquare.Checked = int.Parse(ShowGrainBoundry.ToString()) == 2;
- }
- if (analysisModel.GetParamValue1(ParamKey_point1Style, out ShowGrainBoundry, this.menuId))//1点设置 样式
- {
- this.rb_leftFill.Checked = int.Parse(ShowGrainBoundry.ToString()) == 1;
- this.rb_leftNoFill.Checked = int.Parse(ShowGrainBoundry.ToString()) == 2;
- }
- if (analysisModel.GetParamValue1(ParamKey_point1Size, out ShowGrainBoundry, this.menuId))//1点设置 尺寸
- this.txt_LeftSize.Text = ShowGrainBoundry.ToString();
- if (analysisModel.GetParamValue1(ParamKey_point1LineWidth, out ShowGrainBoundry, this.menuId))//1点设置 线宽
- this.txt_LeftLineWeight.Text = ShowGrainBoundry.ToString();
- if (analysisModel.GetParamValue1(ParamKey_point1LineColor, out ShowGrainBoundry, this.menuId))//1点设置 颜色
- this.panel1.BackColor = Color.FromArgb(int.Parse(ShowGrainBoundry.ToString()));
- if (analysisModel.GetParamValue1(ParamKey_point05Rectangle, out ShowGrainBoundry, this.menuId))//0.5点设置 形状
- {
- this.rb_RightCircle.Checked = int.Parse(ShowGrainBoundry.ToString()) == 1;
- this.rb_RightSquare.Checked = int.Parse(ShowGrainBoundry.ToString()) == 2;
- }
- if (analysisModel.GetParamValue1(ParamKey_point05Style, out ShowGrainBoundry, this.menuId))//0.5点设置 样式
- {
- this.rb_RightFill.Checked = int.Parse(ShowGrainBoundry.ToString()) == 1;
- this.rb_RightNoFill.Checked = int.Parse(ShowGrainBoundry.ToString()) == 2;
- }
- if (analysisModel.GetParamValue1(ParamKey_point05Size, out ShowGrainBoundry, this.menuId))//0.5点设置 尺寸
- this.txt_RightSize.Text = ShowGrainBoundry.ToString();
- if (analysisModel.GetParamValue1(ParamKey_point05LineWidth, out ShowGrainBoundry, this.menuId))//0.5点设置 线宽
- this.txt_RightLineWeight.Text = ShowGrainBoundry.ToString();
- if (analysisModel.GetParamValue1(ParamKey_point05LineColor, out ShowGrainBoundry, this.menuId))//0.5点设置 颜色
- this.panel2.BackColor = Color.FromArgb(int.Parse(ShowGrainBoundry.ToString()));
- try
- {
- object ItemStringObject;
- if (analysisModel.GetParamValue1(ParamKey_selectedGrid, out ItemStringObject, this.menuId))//选择的网格 选择的辅助线
- try
- {
- this.comboBox1.SelectedIndex = Convert.ToInt32(ItemStringObject);
- }
- catch (Exception ex)
- {
- this.comboBox1.SelectedItem = (string)ItemStringObject;
- }
- }
- catch (Exception exc)
- {
- System.Console.WriteLine("this.comboBox1.SelectedItem: " + exc.ToString());
- }
- }
- private void ShownChoiseItemAndInitData(object sender, EventArgs e)
- {
- binaryClass.RefreshHistogramControl1Values();
- int imgIndex = -1;
- this.listView1.Focus();
- //初始化图片列表
- for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
- if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
- {
- imgIndex = i;
- break;
- }
- if (imgIndex != -1)//#21035
- {
- //滚动到指定的行位置
- this.listView1.EnsureVisible(imgIndex);
- this.listView1.Items[imgIndex].Focused = true;
- this.listView1.Items[imgIndex].Selected = true;
- }
- }
- /// <summary>
- /// 添加参数改变的监听
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void GrainSizePointCountingMethodDialog_Load(object sender, EventArgs e)
- {
- for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
- {
- this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
- }
- this.dataGridView4.SortCompare += DataGridView4_SortCompare;
- 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 bcOriginCheckedChanged(object sender, EventArgs e)
- {
- if (!bcOriginChecked())
- {
- if (bcBinaryChecked())
- this.documentWorkspace.PhaseModels[0].choise = true;
- }
- else
- this.documentWorkspace.PhaseModels[0].choise = false;
- this.documentWorkspace.Refresh();
- }
- #endregion
- /// <summary>
- /// 初始化画面数据
- /// </summary>
- private void InitGridStyle()
- {
- grainSizePointCountingMethodModel = XmlSerializeHelper.DESerializer<GrainSizePointCountingMethodModel>(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizePointCountingMethodModel.xml", FileMode.Open));
- if (grainSizePointCountingMethodModel.GridStyleList != null)
- {
- ArrayList arrayList = new ArrayList();
- foreach (var GridStyle in grainSizePointCountingMethodModel.GridStyleList)
- {
- arrayList.Add(GridStyle.gridName);
- }
- this.comboBox1.DataSource = null;
- this.comboBox1.DataSource = arrayList;
- if(grainSizePointCountingMethodModel.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))
- {
- GrainSizePointCountingMethodModel.GridStyle gridStyle = new GrainSizePointCountingMethodModel.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_rulevalue = Convert.ToInt32(this.textBox5.Text);
- gridStyle.gridColor = Convert.ToInt32(this.panel4.BackColor.ToArgb());
- gridStyle.wholePicture = this.checkBox2.Checked;
- gridStyle.blank_rulevalue = Convert.ToInt32(this.numericUpDown4.Value);
- if (this.grainSizePointCountingMethodModel.GridStyleList != null)
- this.grainSizePointCountingMethodModel.GridStyleList.Add(gridStyle);
- ArrayList arrayList = new ArrayList();
- foreach (var GridStyle in grainSizePointCountingMethodModel.GridStyleList)
- {
- arrayList.Add(GridStyle.gridName);
- }
- this.comboBox1.DataSource = null;
- this.comboBox1.DataSource = arrayList;
- this.comboBox1.SelectedIndex = this.comboBox1.Items.Count - 1;
- }
- else
- {
- if (this.grainSizePointCountingMethodModel.GridStyleList != null)
- {
- foreach (var GridStyle in this.grainSizePointCountingMethodModel.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_rulevalue = Convert.ToInt32(this.textBox5.Text);
- GridStyle.gridColor = Convert.ToInt32(this.panel4.BackColor.ToArgb());
- GridStyle.wholePicture = this.checkBox2.Checked;
- GridStyle.blank_rulevalue = Convert.ToInt32(this.numericUpDown4.Value);
- }
- }
- }
- }
- //以下保存xml文件信息
- string stageModelXml = XmlSerializeHelper.XmlSerialize<GrainSizePointCountingMethodModel>(grainSizePointCountingMethodModel);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizePointCountingMethodModel.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();
- }
- }
- /// <summary>
- /// 刷新网格矩形
- /// </summary>
- private void RefreshGridIntersections()
- {
- this.rectangleFs.Clear();
- float hGridSpacingDraw;
- float vGridSpacingDraw;
- double ruleValue = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
- if (this.wholePicture)
- {
- hGridSpacingDraw = (float)(this.documentWorkspace.CompositionSurface.Height - 2 * this.blank_rulevalue / ruleValue) / (this.hNumber - 1);
- vGridSpacingDraw = (float)(this.documentWorkspace.CompositionSurface.Width - 2 * this.blank_rulevalue / ruleValue) / (this.vNumber - 1);
- }
- else
- {
- hGridSpacingDraw = (float)(this.gridSpacing_rulevalue / ruleValue);
- vGridSpacingDraw = (float)(this.gridSpacing_rulevalue / ruleValue);
- }
- exceed = false;
- ArrayList xs = new ArrayList();
- ArrayList ys = new ArrayList();
- if (this.hNumber > 0)
- {
- if (this.hNumber % 2 == 0)
- {
- float Spacing = hGridSpacingDraw / 2;
- for (int i = 0; i < this.hNumber / 2; i++)
- {
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= 0
- && (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height)
- {
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing);
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += hGridSpacingDraw;
- }
- }
- else
- {
- if (this.hNumber == 1)
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2);
- else
- {
- float Spacing = hGridSpacingDraw;
- for (int i = 0; i < (this.hNumber - 1) / 2; i++)
- {
- if (i == 0)
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2);
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= 0
- && (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height)
- {
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing);
- ys.Add((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += hGridSpacingDraw;
- }
- }
- }
- }
- if (this.vNumber > 0)
- {
- if (this.vNumber % 2 == 0)
- {
- float Spacing = vGridSpacingDraw / 2;
- for (int i = 0; i < this.vNumber / 2; i++)
- {
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width)
- {
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing);
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += vGridSpacingDraw;
- }
- }
- else
- {
- if (this.vNumber == 1)
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2);
- else
- {
- float Spacing = vGridSpacingDraw;
- for (int i = 0; i < (this.vNumber - 1) / 2; i++)
- {
- if (i == 0)
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2);
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0)
- {
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing);
- xs.Add((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing);
- }
- else
- exceed = true;
- Spacing += vGridSpacingDraw;
- }
- }
- }
- }
- //if (xs.Count < 2)//0915###18761
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.teredbeyondtheimagesize.Text"));
- // return;
- //}
- if(xs.Count > 1)
- {
- this.minX = (float)xs[xs.Count - 2];
- this.maxX = (float)xs[xs.Count - 1];
- }
- if (ys.Count > 1)
- {
- this.minY = (float)ys[ys.Count - 2];
- this.maxY = (float)ys[ys.Count - 1];
- }
- foreach (var x in xs)
- {
- foreach (var y in ys)
- {
- this.rectangleFs.Add(new RectangleF((float)(Convert.ToDecimal(x) - Convert.ToDecimal((float)this.gridWidth / 2) - 3)
- , (float)(Convert.ToDecimal(y) - Convert.ToDecimal((float)this.gridWidth / 2) - 3), this.gridWidth + 6, this.gridWidth + 6));
- }
- }
- if (this.wholePicture)
- {
- int count = this.rectangleFs.Count;
- RectangleF rectangleF = new RectangleF((int)(this.blank_rulevalue / ruleValue), (int)(this.blank_rulevalue / ruleValue), this.documentWorkspace.CompositionSurface.Width + 1 - 2 * (int)(this.blank_rulevalue / ruleValue)
- , this.documentWorkspace.CompositionSurface.Height + 1 - 2 * (int)(this.blank_rulevalue / ruleValue));
- for (int i = count - 1; i >= 0; i--)
- {
- if (!rectangleF.Contains(new PointF(this.rectangleFs[i].X + (float)this.gridWidth / 2 + 3, this.rectangleFs[i].Y + (float)this.gridWidth / 2 + 3)))
- //|| rectangleF.X == this.rectangleFs[i].X || rectangleF.Y == this.rectangleFs[i].Y)
- {
- this.rectangleFs.RemoveAt(i);
- }
- }
- }
- if (exceed)
- MessageBox.Show(PdnResources.GetString("Menu.Thegridsizehasexceededtheimage.text")+"!");
- this.documentWorkspace.Refresh();
- }
- #region 初始化
- private void InitializeLanguageText()
- {
- this.bc = new PaintDotNet.CustomControl.BinaryControlSmaller();
- //
- // bc
- //
- this.bc.BinaryBackColor = System.Drawing.Color.Red;
- this.bc.BinaryChecked = false;
- this.bc.BinaryStyle = 1;
- this.bc.Location = new System.Drawing.Point(152, 43);
- 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, 247);
- this.bc.TabIndex = 3;
- 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.button_ApplyToAll.Text = "应用到全部";
- this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
- this.groupBox8.Text = PdnResources.GetString("Menu.Analysisresult.text");
- this.button9.Text = PdnResources.GetString("Menu.Exportproject.text");
- this.button16.Text = PdnResources.GetString("Menu.Cancelshowall.text");
- this.label5.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
- this.button14.Text = PdnResources.GetString("Menu.Exportresults.text");
- this.button13.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
- this.Column1.HeaderText = PdnResources.GetString("Menu.picture.Text");
- this.Column2.HeaderText = PdnResources.GetString("Menu.Type.text");
- this.Column6.HeaderText = PdnResources.GetString("Menu.total.text");
- this.Column7.HeaderText = PdnResources.GetString("Menu.percent.text");
- this.button12.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.button11.Text = PdnResources.GetString("Menu.Showall.text");
- this.groupBox7.Text = PdnResources.GetString("Menu.Preview.text");
- this.groupBox4.Text = PdnResources.GetString("Menu.Setting.GridSetting.Text");
- this.label10.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Gridspacing.text") + ":";
- this.checkBox2.Text = PdnResources.GetString("Menu.thefullimage.text");
- this.label12.Text = PdnResources.GetString("Menu.void.text") + ":";
- this.label11.Text = PdnResources.GetString("Menu.Gridcolor.text") + ":";
- this.label9.Text = PdnResources.GetString("Menu.Numberofvertical.text") + ":";
- this.label8.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Thelevelofthenumber.text") + ":";
- this.label7.Text = PdnResources.GetString("Menu.Gridlinewidth.text") + ":";
- this.groupBox5.Text = PdnResources.GetString("Menu.0.5pointsetting.text");
- this.label13.Text = PdnResources.GetString("Menu.style.text") + ":";
- this.rb_RightNoFill.Text = PdnResources.GetString("Menu.Hollow.text");
- this.rb_RightFill.Text = PdnResources.GetString("Menu.solid.text");
- this.label14.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.label15.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.label16.Text = PdnResources.GetString("Menu.sizeed.text") + ":";
- this.rb_RightSquare.Text = PdnResources.GetString("Menu.Square.text") + ":";
- this.rb_RightCircle.Text = PdnResources.GetString("Menu.circular.Text");
- this.label17.Text = PdnResources.GetString("Menu.shape.text") + ":";
- this.groupBox10.Text = PdnResources.GetString("Menu.1SpotSet.text");
- this.label18.Text = PdnResources.GetString("Menu.style.text") + ":";
- this.rb_leftNoFill.Text = PdnResources.GetString("Menu.Hollow.text");
- this.rb_leftFill.Text = PdnResources.GetString("Menu.solid.text");
- this.label19.Text = PdnResources.GetString("Menu.color.text") + ":";
- this.label20.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
- this.label21.Text = PdnResources.GetString("Menu.sizeed.text") + ":";
- this.rb_LeftSquare.Text = PdnResources.GetString("Menu.Square.text");
- this.rb_LeftCircle.Text = PdnResources.GetString("Menu.circular.Text");
- this.label22.Text = PdnResources.GetString("Menu.shape.text") + ":";
- this.groupBox9.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Expectedresult.text");
- this.button8.Text = PdnResources.GetString("Menu.Edit.Text");
- this.But_DelPhase.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.but_AddPhase.Text = PdnResources.GetString("Menu.Addto.text");
- this.but_Clear.Text = PdnResources.GetString("Menu.Empty.text");
- this.Column11.HeaderText = PdnResources.GetString("Menu.Type.text");
- this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.Gridpoints.text");
- this.dataGridViewTextBoxColumn4.HeaderText = PdnResources.GetString("Menu.total.text");
- this.dataGridViewTextBoxColumn5.HeaderText = PdnResources.GetString("Menu.percent.text");
- this.groupBox12.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
- this.checkBox6.Text = PdnResources.GetString("Menu.autoaddsection.text");
- this.checkBox5.Text = PdnResources.GetString("Menu.displaysections.text");
- this.checkBox4.Text = PdnResources.GetString("Menu.displaygrid.text");
- this.Column3.HeaderText = PdnResources.GetString("Menu.Gridpoints.text");
- }
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
- 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.button9 = new System.Windows.Forms.Button();
- this.listView2 = new System.Windows.Forms.ListView();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.button16 = new System.Windows.Forms.Button();
- this.label5 = new System.Windows.Forms.Label();
- this.button14 = new System.Windows.Forms.Button();
- this.button13 = new System.Windows.Forms.Button();
- this.dataGridView4 = new System.Windows.Forms.DataGridView();
- this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.button12 = new System.Windows.Forms.Button();
- this.button11 = new System.Windows.Forms.Button();
- this.label4 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- 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.groupBox5 = new System.Windows.Forms.GroupBox();
- this.panel2 = new System.Windows.Forms.Panel();
- this.groupBox6 = new System.Windows.Forms.GroupBox();
- this.label13 = new System.Windows.Forms.Label();
- this.rb_RightNoFill = new System.Windows.Forms.RadioButton();
- this.rb_RightFill = new System.Windows.Forms.RadioButton();
- this.label14 = new System.Windows.Forms.Label();
- this.txt_RightLineWeight = new System.Windows.Forms.TextBox();
- this.label15 = new System.Windows.Forms.Label();
- this.txt_RightSize = new System.Windows.Forms.TextBox();
- this.label16 = new System.Windows.Forms.Label();
- this.rb_RightSquare = new System.Windows.Forms.RadioButton();
- this.rb_RightCircle = new System.Windows.Forms.RadioButton();
- this.label17 = new System.Windows.Forms.Label();
- this.groupBox10 = new System.Windows.Forms.GroupBox();
- this.groupBox11 = new System.Windows.Forms.GroupBox();
- this.label18 = new System.Windows.Forms.Label();
- this.rb_leftNoFill = new System.Windows.Forms.RadioButton();
- this.rb_leftFill = new System.Windows.Forms.RadioButton();
- this.panel1 = new System.Windows.Forms.Panel();
- this.label19 = new System.Windows.Forms.Label();
- this.txt_LeftLineWeight = new System.Windows.Forms.TextBox();
- this.label20 = new System.Windows.Forms.Label();
- this.txt_LeftSize = new System.Windows.Forms.TextBox();
- this.label21 = new System.Windows.Forms.Label();
- this.rb_LeftSquare = new System.Windows.Forms.RadioButton();
- this.rb_LeftCircle = new System.Windows.Forms.RadioButton();
- this.label22 = new System.Windows.Forms.Label();
- this.groupBox9 = new System.Windows.Forms.GroupBox();
- this.button8 = new System.Windows.Forms.Button();
- this.But_DelPhase = new System.Windows.Forms.Button();
- this.but_AddPhase = new System.Windows.Forms.Button();
- this.but_Clear = new System.Windows.Forms.Button();
- this.dataGridView1 = new System.Windows.Forms.DataGridView();
- this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.groupBox12 = new System.Windows.Forms.GroupBox();
- this.checkBox6 = new System.Windows.Forms.CheckBox();
- this.checkBox5 = new System.Windows.Forms.CheckBox();
- this.checkBox4 = new System.Windows.Forms.CheckBox();
- this.button_ApplyToAll = new System.Windows.Forms.Button();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.groupBox8.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).BeginInit();
- this.groupBox4.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
- this.groupBox5.SuspendLayout();
- this.groupBox6.SuspendLayout();
- this.groupBox10.SuspendLayout();
- this.groupBox11.SuspendLayout();
- this.groupBox9.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
- this.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.button_ApplyToAll);
- 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, 25);
- this.button7.TabIndex = 22;
- this.button7.UseVisualStyleBackColor = false;
- this.button7.Click += new System.EventHandler(this.button7_Click);
- //
- // checkBox3
- //
- this.checkBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.checkBox3.AutoSize = true;
- this.checkBox3.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
- this.checkBox3.Location = new System.Drawing.Point(757, 21);
- this.checkBox3.Name = "checkBox3";
- this.checkBox3.Size = new System.Drawing.Size(15, 14);
- this.checkBox3.TabIndex = 21;
- this.checkBox3.UseVisualStyleBackColor = true;
- //
- // button6
- //
- this.button6.BackColor = System.Drawing.SystemColors.Control;
- this.button6.Location = new System.Drawing.Point(499, 13);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(72, 25);
- 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, 25);
- 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, 25);
- 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, 25);
- this.button3.TabIndex = 6;
- this.button3.UseVisualStyleBackColor = false;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // comboBox1
- //
- this.comboBox1.FormattingEnabled = true;
- this.comboBox1.Location = new System.Drawing.Point(78, 19);
- this.comboBox1.Name = "comboBox1";
- this.comboBox1.Size = new System.Drawing.Size(159, 20);
- this.comboBox1.TabIndex = 5;
- this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(18, 23);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(0, 12);
- this.label1.TabIndex = 4;
- //
- // button2
- //
- this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button2.BackColor = System.Drawing.SystemColors.Control;
- this.button2.Location = new System.Drawing.Point(895, 14);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(84, 25);
- 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(805, 14);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(84, 25);
- 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, 616);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- this.listView1.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView1_ItemSelectionChanged);
- this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
- this.listView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDown);
- this.listView1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseUp);
- //
- // imageList1
- //
- this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
- this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
- this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
- //
- // groupBox2
- //
- this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.groupBox2.Controls.Add(this.listView1);
- this.groupBox2.Location = new System.Drawing.Point(14, 59);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(135, 639);
- this.groupBox2.TabIndex = 3;
- this.groupBox2.TabStop = false;
- //
- // groupBox8
- //
- this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.groupBox8.Controls.Add(this.button9);
- 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.Controls.Add(this.label4);
- this.groupBox8.Controls.Add(this.label3);
- this.groupBox8.Location = new System.Drawing.Point(14, 704);
- this.groupBox8.Name = "groupBox8";
- this.groupBox8.Size = new System.Drawing.Size(1081, 204);
- this.groupBox8.TabIndex = 10;
- this.groupBox8.TabStop = false;
- //
- // button9
- //
- this.button9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button9.BackColor = System.Drawing.SystemColors.Control;
- this.button9.Location = new System.Drawing.Point(941, 109);
- this.button9.Name = "button9";
- this.button9.Size = new System.Drawing.Size(128, 26);
- this.button9.TabIndex = 23;
- this.button9.UseVisualStyleBackColor = false;
- this.button9.Click += new System.EventHandler(this.button9_Click);
- //
- // listView2
- //
- 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, 140);
- 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(997, 163);
- this.numericUpDown1.Maximum = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(56, 21);
- this.numericUpDown1.TabIndex = 21;
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
- //
- // button16
- //
- this.button16.BackColor = System.Drawing.SystemColors.Control;
- this.button16.Location = new System.Drawing.Point(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(958, 169);
- 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, 71);
- 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.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.dataGridView4.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dataGridView4.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
- dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F);
- dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.dataGridView4.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
- this.dataGridView4.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dataGridView4.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column1,
- this.Column2,
- this.Column3,
- this.Column4,
- this.Column5,
- this.Column6,
- this.Column7});
- this.dataGridView4.Location = new System.Drawing.Point(228, 20);
- this.dataGridView4.Name = "dataGridView4";
- this.dataGridView4.ReadOnly = true;
- this.dataGridView4.RowHeadersVisible = false;
- this.dataGridView4.RowTemplate.Height = 23;
- this.dataGridView4.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView4.Size = new System.Drawing.Size(693, 176);
- this.dataGridView4.TabIndex = 15;
- //
- // Column1
- //
- dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column1.DefaultCellStyle = dataGridViewCellStyle2;
- this.Column1.Name = "Column1";
- this.Column1.ReadOnly = true;
- //
- // Column2
- //
- dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column2.DefaultCellStyle = dataGridViewCellStyle3;
- this.Column2.Name = "Column2";
- this.Column2.ReadOnly = true;
- //
- // Column3
- //
- dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column3.DefaultCellStyle = dataGridViewCellStyle4;
- this.Column3.Name = "Column3";
- this.Column3.ReadOnly = true;
- //
- // Column4
- //
- dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column4.DefaultCellStyle = dataGridViewCellStyle5;
- this.Column4.HeaderText = "1";
- this.Column4.Name = "Column4";
- this.Column4.ReadOnly = true;
- //
- // Column5
- //
- dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column5.DefaultCellStyle = dataGridViewCellStyle6;
- this.Column5.HeaderText = ".5";
- this.Column5.Name = "Column5";
- this.Column5.ReadOnly = true;
- //
- // Column6
- //
- dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column6.DefaultCellStyle = dataGridViewCellStyle7;
- this.Column6.Name = "Column6";
- this.Column6.ReadOnly = true;
- //
- // Column7
- //
- dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column7.DefaultCellStyle = dataGridViewCellStyle8;
- this.Column7.Name = "Column7";
- this.Column7.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);
- //
- // label4
- //
- this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.label4.AutoSize = true;
- this.label4.ForeColor = System.Drawing.SystemColors.ScrollBar;
- this.label4.Location = new System.Drawing.Point(924, 9);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(11, 192);
- this.label4.TabIndex = 1;
- this.label4.Text = "|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.ForeColor = System.Drawing.SystemColors.ScrollBar;
- this.label3.Location = new System.Drawing.Point(214, 9);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(11, 192);
- this.label3.TabIndex = 0;
- this.label3.Text = "|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|\r\n|";
- //
- // groupBox7
- //
- this.groupBox7.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.groupBox7.Location = new System.Drawing.Point(515, 59);
- this.groupBox7.Name = "groupBox7";
- this.groupBox7.Size = new System.Drawing.Size(580, 639);
- 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, 290);
- 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(82, 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;
- //
- // groupBox5
- //
- this.groupBox5.Controls.Add(this.panel2);
- this.groupBox5.Controls.Add(this.groupBox6);
- this.groupBox5.Controls.Add(this.label14);
- this.groupBox5.Controls.Add(this.txt_RightLineWeight);
- this.groupBox5.Controls.Add(this.label15);
- this.groupBox5.Controls.Add(this.txt_RightSize);
- this.groupBox5.Controls.Add(this.label16);
- this.groupBox5.Controls.Add(this.rb_RightSquare);
- this.groupBox5.Controls.Add(this.rb_RightCircle);
- this.groupBox5.Controls.Add(this.label17);
- this.groupBox5.Location = new System.Drawing.Point(157, 436);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(351, 76);
- this.groupBox5.TabIndex = 19;
- this.groupBox5.TabStop = false;
- //
- // panel2
- //
- this.panel2.BackColor = System.Drawing.Color.Blue;
- this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.panel2.Location = new System.Drawing.Point(262, 51);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(79, 21);
- this.panel2.TabIndex = 26;
- this.panel2.BackColorChanged += new System.EventHandler(this.panel2_BackColorChanged);
- this.panel2.Click += new System.EventHandler(this.panel2_Click);
- //
- // groupBox6
- //
- this.groupBox6.Controls.Add(this.label13);
- this.groupBox6.Controls.Add(this.rb_RightNoFill);
- this.groupBox6.Controls.Add(this.rb_RightFill);
- this.groupBox6.Location = new System.Drawing.Point(172, 8);
- this.groupBox6.Name = "groupBox6";
- this.groupBox6.Size = new System.Drawing.Size(173, 42);
- this.groupBox6.TabIndex = 24;
- this.groupBox6.TabStop = false;
- //
- // label13
- //
- this.label13.AutoSize = true;
- this.label13.Location = new System.Drawing.Point(12, 18);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(0, 12);
- this.label13.TabIndex = 21;
- //
- // rb_RightNoFill
- //
- this.rb_RightNoFill.AutoSize = true;
- this.rb_RightNoFill.Checked = true;
- this.rb_RightNoFill.Location = new System.Drawing.Point(112, 16);
- this.rb_RightNoFill.Name = "rb_RightNoFill";
- this.rb_RightNoFill.Size = new System.Drawing.Size(14, 13);
- this.rb_RightNoFill.TabIndex = 20;
- this.rb_RightNoFill.TabStop = true;
- this.rb_RightNoFill.UseVisualStyleBackColor = true;
- //
- // rb_RightFill
- //
- this.rb_RightFill.AutoSize = true;
- this.rb_RightFill.Location = new System.Drawing.Point(53, 16);
- this.rb_RightFill.Name = "rb_RightFill";
- this.rb_RightFill.Size = new System.Drawing.Size(14, 13);
- this.rb_RightFill.TabIndex = 19;
- this.rb_RightFill.UseVisualStyleBackColor = true;
- this.rb_RightFill.CheckedChanged += new System.EventHandler(this.rb_RightFill_CheckedChanged);
- //
- // label14
- //
- this.label14.AutoSize = true;
- this.label14.Location = new System.Drawing.Point(224, 54);
- this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(0, 12);
- this.label14.TabIndex = 22;
- //
- // txt_RightLineWeight
- //
- this.txt_RightLineWeight.Location = new System.Drawing.Point(158, 51);
- this.txt_RightLineWeight.Name = "txt_RightLineWeight";
- this.txt_RightLineWeight.Size = new System.Drawing.Size(45, 21);
- this.txt_RightLineWeight.TabIndex = 21;
- this.txt_RightLineWeight.Text = "5";
- this.txt_RightLineWeight.TextChanged += new System.EventHandler(this.txt_RightLineWeight_TextChanged);
- this.txt_RightLineWeight.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxRightWidth_KeyPress);
- //
- // label15
- //
- this.label15.AutoSize = true;
- this.label15.Location = new System.Drawing.Point(121, 54);
- this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(0, 12);
- this.label15.TabIndex = 20;
- //
- // txt_RightSize
- //
- this.txt_RightSize.Location = new System.Drawing.Point(62, 51);
- this.txt_RightSize.Name = "txt_RightSize";
- this.txt_RightSize.Size = new System.Drawing.Size(45, 21);
- this.txt_RightSize.TabIndex = 19;
- this.txt_RightSize.Text = "30";
- this.txt_RightSize.TextChanged += new System.EventHandler(this.txt_RightSize_TextChanged);
- this.txt_RightSize.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxRightSize_KeyPress);
- //
- // label16
- //
- this.label16.AutoSize = true;
- this.label16.Location = new System.Drawing.Point(27, 54);
- this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(0, 12);
- this.label16.TabIndex = 18;
- //
- // rb_RightSquare
- //
- this.rb_RightSquare.AutoSize = true;
- this.rb_RightSquare.Location = new System.Drawing.Point(114, 24);
- this.rb_RightSquare.Name = "rb_RightSquare";
- this.rb_RightSquare.Size = new System.Drawing.Size(14, 13);
- this.rb_RightSquare.TabIndex = 14;
- this.rb_RightSquare.TabStop = true;
- this.rb_RightSquare.UseVisualStyleBackColor = true;
- //
- // rb_RightCircle
- //
- this.rb_RightCircle.AutoSize = true;
- this.rb_RightCircle.Checked = true;
- this.rb_RightCircle.Location = new System.Drawing.Point(59, 24);
- this.rb_RightCircle.Name = "rb_RightCircle";
- this.rb_RightCircle.Size = new System.Drawing.Size(14, 13);
- this.rb_RightCircle.TabIndex = 13;
- this.rb_RightCircle.TabStop = true;
- this.rb_RightCircle.UseVisualStyleBackColor = true;
- this.rb_RightCircle.CheckedChanged += new System.EventHandler(this.rb_RightCircle_CheckedChanged);
- //
- // label17
- //
- this.label17.AutoSize = true;
- this.label17.Location = new System.Drawing.Point(21, 26);
- this.label17.Name = "label17";
- this.label17.Size = new System.Drawing.Size(0, 12);
- this.label17.TabIndex = 12;
- //
- // groupBox10
- //
- this.groupBox10.Controls.Add(this.groupBox11);
- this.groupBox10.Controls.Add(this.panel1);
- this.groupBox10.Controls.Add(this.label19);
- this.groupBox10.Controls.Add(this.txt_LeftLineWeight);
- this.groupBox10.Controls.Add(this.label20);
- this.groupBox10.Controls.Add(this.txt_LeftSize);
- this.groupBox10.Controls.Add(this.label21);
- this.groupBox10.Controls.Add(this.rb_LeftSquare);
- this.groupBox10.Controls.Add(this.rb_LeftCircle);
- this.groupBox10.Controls.Add(this.label22);
- this.groupBox10.Location = new System.Drawing.Point(156, 364);
- this.groupBox10.Name = "groupBox10";
- this.groupBox10.Size = new System.Drawing.Size(352, 70);
- 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(173, 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(111, 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, 46);
- 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, 49);
- 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, 46);
- 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, 49);
- 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, 46);
- 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 = "30";
- 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, 49);
- 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(117, 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(64, 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.button8);
- this.groupBox9.Controls.Add(this.But_DelPhase);
- this.groupBox9.Controls.Add(this.but_AddPhase);
- this.groupBox9.Controls.Add(this.but_Clear);
- this.groupBox9.Controls.Add(this.dataGridView1);
- this.groupBox9.Location = new System.Drawing.Point(157, 555);
- this.groupBox9.Name = "groupBox9";
- this.groupBox9.Size = new System.Drawing.Size(351, 144);
- this.groupBox9.TabIndex = 20;
- this.groupBox9.TabStop = false;
- //
- // button8
- //
- this.button8.BackColor = System.Drawing.SystemColors.Control;
- this.button8.Location = new System.Drawing.Point(283, 15);
- this.button8.Name = "button8";
- this.button8.Size = new System.Drawing.Size(63, 23);
- this.button8.TabIndex = 4;
- this.button8.UseVisualStyleBackColor = false;
- this.button8.Click += new System.EventHandler(this.button8_Click);
- //
- // But_DelPhase
- //
- this.But_DelPhase.BackColor = System.Drawing.SystemColors.Control;
- this.But_DelPhase.Location = new System.Drawing.Point(212, 15);
- this.But_DelPhase.Name = "But_DelPhase";
- this.But_DelPhase.Size = new System.Drawing.Size(63, 23);
- this.But_DelPhase.TabIndex = 3;
- this.But_DelPhase.UseVisualStyleBackColor = false;
- this.But_DelPhase.Click += new System.EventHandler(this.But_DelPhase_Click);
- //
- // but_AddPhase
- //
- this.but_AddPhase.BackColor = System.Drawing.SystemColors.Control;
- this.but_AddPhase.Location = new System.Drawing.Point(143, 15);
- this.but_AddPhase.Name = "but_AddPhase";
- this.but_AddPhase.Size = new System.Drawing.Size(61, 23);
- this.but_AddPhase.TabIndex = 2;
- this.but_AddPhase.UseVisualStyleBackColor = false;
- this.but_AddPhase.Click += new System.EventHandler(this.but_AddPhase_Click);
- //
- // but_Clear
- //
- this.but_Clear.BackColor = System.Drawing.SystemColors.Control;
- this.but_Clear.Location = new System.Drawing.Point(74, 15);
- this.but_Clear.Name = "but_Clear";
- this.but_Clear.Size = new System.Drawing.Size(61, 23);
- this.but_Clear.TabIndex = 1;
- this.but_Clear.UseVisualStyleBackColor = false;
- this.but_Clear.Click += new System.EventHandler(this.but_Clear_Click);
- //
- // dataGridView1
- //
- this.dataGridView1.AllowUserToAddRows = false;
- this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
- dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle9;
- this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column11,
- this.dataGridViewTextBoxColumn1,
- this.dataGridViewTextBoxColumn2,
- this.dataGridViewTextBoxColumn3,
- this.dataGridViewTextBoxColumn4,
- this.dataGridViewTextBoxColumn5});
- this.dataGridView1.Location = new System.Drawing.Point(9, 40);
- 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, 100);
- this.dataGridView1.TabIndex = 0;
- this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);
- this.dataGridView1.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridView1_CellValidating);
- this.dataGridView1.SelectionChanged += new System.EventHandler(this.dataGridView1_SelectionChanged);
- //
- // Column11
- //
- dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column11.DefaultCellStyle = dataGridViewCellStyle10;
- this.Column11.Name = "Column11";
- this.Column11.ReadOnly = true;
- this.Column11.Width = 56;
- //
- // dataGridViewTextBoxColumn1
- //
- dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle11;
- this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
- this.dataGridViewTextBoxColumn1.ReadOnly = true;
- this.dataGridViewTextBoxColumn1.Width = 54;
- //
- // dataGridViewTextBoxColumn2
- //
- dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle12;
- this.dataGridViewTextBoxColumn2.HeaderText = "1";
- this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
- this.dataGridViewTextBoxColumn2.ReadOnly = true;
- this.dataGridViewTextBoxColumn2.Width = 50;
- //
- // dataGridViewTextBoxColumn3
- //
- dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle13;
- this.dataGridViewTextBoxColumn3.HeaderText = ".5";
- this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
- this.dataGridViewTextBoxColumn3.ReadOnly = true;
- this.dataGridViewTextBoxColumn3.Width = 50;
- //
- // dataGridViewTextBoxColumn4
- //
- dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle14;
- this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
- this.dataGridViewTextBoxColumn4.ReadOnly = true;
- this.dataGridViewTextBoxColumn4.Width = 55;
- //
- // dataGridViewTextBoxColumn5
- //
- dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle15;
- this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
- this.dataGridViewTextBoxColumn5.ReadOnly = true;
- this.dataGridViewTextBoxColumn5.Width = 69;
- //
- // groupBox12
- //
- this.groupBox12.Controls.Add(this.checkBox6);
- this.groupBox12.Controls.Add(this.checkBox5);
- this.groupBox12.Controls.Add(this.checkBox4);
- this.groupBox12.Location = new System.Drawing.Point(157, 514);
- this.groupBox12.Name = "groupBox12";
- this.groupBox12.Size = new System.Drawing.Size(351, 40);
- this.groupBox12.TabIndex = 21;
- this.groupBox12.TabStop = false;
- //
- // checkBox6
- //
- this.checkBox6.AutoSize = true;
- this.checkBox6.Location = new System.Drawing.Point(244, 20);
- this.checkBox6.Name = "checkBox6";
- this.checkBox6.Size = new System.Drawing.Size(15, 14);
- this.checkBox6.TabIndex = 2;
- this.checkBox6.UseVisualStyleBackColor = true;
- this.checkBox6.CheckedChanged += new System.EventHandler(this.checkBox6_CheckedChanged);
- //
- // checkBox5
- //
- this.checkBox5.AutoSize = true;
- this.checkBox5.Checked = true;
- this.checkBox5.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox5.Location = new System.Drawing.Point(134, 20);
- 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.Checked = true;
- this.checkBox4.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox4.Location = new System.Drawing.Point(24, 20);
- 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);
- //
- // button_ApplyToAll
- //
- this.button_ApplyToAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button_ApplyToAll.BackColor = System.Drawing.SystemColors.Control;
- this.button_ApplyToAll.Location = new System.Drawing.Point(985, 14);
- this.button_ApplyToAll.Name = "button_ApplyToAll";
- this.button_ApplyToAll.Size = new System.Drawing.Size(84, 25);
- this.button_ApplyToAll.TabIndex = 23;
- this.button_ApplyToAll.UseVisualStyleBackColor = false;
- this.button_ApplyToAll.Click += new System.EventHandler(this.button_ApplyToAll_Click);
- //
- // GrainSizePointCountingMethodDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(1104, 914);
- this.Controls.Add(this.groupBox12);
- this.Controls.Add(this.groupBox9);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox10);
- this.Controls.Add(this.groupBox4);
- this.Controls.Add(this.groupBox7);
- this.Controls.Add(this.groupBox8);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.groupBox1);
- this.Name = "GrainSizePointCountingMethodDialog";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GrainSizeDialog_FormClosing);
- this.Load += new System.EventHandler(this.GrainSizePointCountingMethodDialog_Load);
- this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData);
- this.Controls.SetChildIndex(this.groupBox1, 0);
- this.Controls.SetChildIndex(this.groupBox2, 0);
- this.Controls.SetChildIndex(this.groupBox8, 0);
- this.Controls.SetChildIndex(this.groupBox7, 0);
- this.Controls.SetChildIndex(this.groupBox4, 0);
- this.Controls.SetChildIndex(this.groupBox10, 0);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.Controls.SetChildIndex(this.groupBox9, 0);
- this.Controls.SetChildIndex(this.groupBox12, 0);
- this.groupBox1.ResumeLayout(false);
- this.groupBox1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox8.ResumeLayout(false);
- this.groupBox8.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).EndInit();
- this.groupBox4.ResumeLayout(false);
- this.groupBox4.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
- this.groupBox5.ResumeLayout(false);
- this.groupBox5.PerformLayout();
- this.groupBox6.ResumeLayout(false);
- this.groupBox6.PerformLayout();
- this.groupBox10.ResumeLayout(false);
- this.groupBox10.PerformLayout();
- this.groupBox11.ResumeLayout(false);
- this.groupBox11.PerformLayout();
- this.groupBox9.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
- this.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 panel2_Click(object sender, EventArgs e)
- {
- this.colorsForm2.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
- this.colorsForm2.setSaveBtn_Click(new System.EventHandler(this.panel2Changed));
- this.colorsForm2.ShowDialog();
- }
- private void panel2Changed(object sender, EventArgs e)
- {
- this.panel2.BackColor = this.colorsForm2.UserPrimaryColor.ToColor();
- this.colorsForm2.Close();
- }
- private void panel4_Click(object sender, EventArgs e)
- {
- this.colorsForm4.UserPrimaryColor = ColorBgra.FromColor(this.panel4.BackColor);
- this.colorsForm4.setSaveBtn_Click(new System.EventHandler(this.panel4Changed));
- this.colorsForm4.ShowDialog();
- }
- private void panel4Changed(object sender, EventArgs e)
- {
- this.panel4.BackColor = this.colorsForm4.UserPrimaryColor.ToColor();
- this.colorsForm4.Close();
- }
- private void listView1_MouseDown(object sender, MouseEventArgs e)
- {
- this.changeCount = 0;
- }
- private void DataGridView4_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
- {
- // 如果是数据的列,则按浮点数处理
- if (e.Column.Index > 1)//###20186
- {
- e.SortResult = (Convert.ToDouble(e.CellValue1) - Convert.ToDouble(e.CellValue2) > 0) ? 1 : (Convert.ToDouble(e.CellValue1) - Convert.ToDouble(e.CellValue2) < 0) ? -1 : 0;
- }
- //否则,按字符串比较
- else
- {
- e.SortResult = System.String.Compare(Convert.ToString(e.CellValue1), Convert.ToString(e.CellValue2));
- }
- e.Handled = true;//不能省掉,不然没效果
- }
- private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
- {
- bool change = false;
- if (this.changeCount == 0)
- {
- if (this.dataGridView1.Rows.Count > 0)
- {
- if(this.saveSuccess)
- {
- DialogResult dt = MessageBox.Show(PdnResources.GetString("Menu.Whethertosavetherrentpicture.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- if (dt == DialogResult.Yes)
- {
- string imgName = this.appWorkspace.DocumentWorkspaces[e.ItemIndex].GetFriendlyName();
- string tag = this.imageList1.Images.Keys[e.ItemIndex];
- if (this.dataGridView1.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseaddtype.text")+"!");
- return;
- }
- DataTable dataTable1 = new DataTable();
- bool replace = false;
- int add = 0;
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (item.Tag.Equals(tag))
- {
- add++;
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Themeasurementdertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- replace = true;
- this.listView2.Items.Remove(item);
- }
- break;
- }
- }
- if (replace || this.listView2.Items.Count == 0 || add == 0)
- {
- this.dataGridView4.Rows.Clear();
- 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;
- foreach (DataGridViewRow Row in this.dataGridView1.Rows)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- dgvr.Cells[0].Value = imgName;
- dgvr.Cells[1].Value = Row.Cells[0].Value;
- dgvr.Cells[2].Value = Row.Cells[1].Value;
- dgvr.Cells[3].Value = Row.Cells[2].Value;
- dgvr.Cells[4].Value = Row.Cells[3].Value;
- dgvr.Cells[5].Value = Row.Cells[4].Value;
- dgvr.Cells[6].Value = Row.Cells[5].Value;
- this.dataGridView4.Rows.Add(dgvr);
- }
- foreach (DataTable dataTable2 in pictureDataTables)
- {
- if (dataTable2.TableName.Equals(dataTable1.TableName))
- {
- pictureDataTables.Remove(dataTable2);
- break;
- }
- }
- foreach (DataGridViewColumn c in this.dataGridView4.Columns)
- {
- dataTable1.Columns.Add(c.HeaderText);
- }
- for (int r = 0; r < this.dataGridView1.Rows.Count; r++)
- {
- DataRow dataRow = dataTable1.NewRow();
- for (int c = 0; c < this.dataGridView1.Rows[r].Cells.Count + 1; c++)
- {
- if (c == 0)
- dataRow[this.dataGridView4.Columns[c].HeaderText] = imgName;
- else
- {
- if (c == 5)
- {
- dataRow[this.dataGridView4.Columns[c].HeaderText] = (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[2].Value)
- + (double)(Convert.ToInt32(this.dataGridView1.Rows[r].Cells[3].Value) * 0.5));
- }
- else if (c == this.dataGridView1.Rows[r].Cells.Count)
- {
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[1].Value) > 0)
- {
- percentage = (double)((Convert.ToInt32(this.dataGridView1.Rows[r].Cells[2].Value)
- + (double)(Convert.ToInt32(this.dataGridView1.Rows[r].Cells[3].Value) * 0.5))
- / Convert.ToInt32(this.dataGridView1.Rows[r].Cells[1].Value)) * 100;
- }
- dataRow[this.dataGridView4.Columns[c].HeaderText] = percentage;
- }
- else
- dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView1.Rows[r].Cells[c - 1].Value;
- }
- }
- dataTable1.Rows.Add(dataRow);
- }
- this.pictureDataTables.Add(dataTable1);
- if (this.allShow)
- AllShow();
- this.listView2.Items[0].Selected = true;
- }
- }
- }
-
- }
- }
- else
- {
- if (change)
- SelectedIndexChanged();
- }
- this.changeCount++;
- }
- /// <summary>
- /// 切换图片
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listView1_SelectedIndexChanged(object sender, EventArgs e)
- {
- SelectedIndexChanged();
- }
- /// <summary>
- /// 切换图片
- /// </summary>
- private void SelectedIndexChanged()
- {
- if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
- {
- existViewFlag = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList.IsExsitView();
- this.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
-
- if (!existViewFlag)
- mat = imageMat.Clone();
- else
- mat = PaintDotNet.Camera.Tools.ToMat(this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFullSizeWithRegion());
- this.dataGridView1.Rows.Clear();
- this.check1Dic.Clear();//##20721
- this.p1RectangleFs.Clear();
- this.p2RectangleFs.Clear();
- Init();
- //二值化集成4
- binaryClass.listView1_SelectedIndexChanged(this.imageMat.Clone(), getCurrentWorkTag());
- if (binaryClass.getModelMat(getCurrentWorkTag()) != null)
- this.documentWorkspace.PhaseModels[0].mat = binaryClass.getModelMat(getCurrentWorkTag()).Clone();
- if (this.selectPicture >= 0)
- {
- this.saveDialogParamValues(this.imageList1.Images.Keys[this.selectPicture].ToString());
- if (!this.analysisDict.ContainsKey(getCurrentWorkTag()))
- this.analysisDict.Add(getCurrentWorkTag(), this.analysisDict[this.imageList1.Images.Keys[this.selectPicture]].cloneListParamModel(this.menuId));
- }
- this.showSaveParamToControl();
- this.selectPicture = this.listView1.FocusedItem.Index;
- RefreshGridIntersections();
- this.documentWorkspace.Refresh();
- }
- }
- private void Init()
- {
- this.commonControlButtons.Visible = true;
- this.dataGridView1.Rows.Clear();
- this.check1Dic.Clear();//##20721
- this.documentWorkspace.phaseModels.Clear();
- //this.checkBox1.Checked = false;//####################19645
- this.checkBox6.Checked = false;//0915###18767因为还有添加类型和二值化的前提条件才能自动添加截点成功,所以改为切换图片后取消自动加点
- }
- /// <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);
- float hGridSpacingDraw;
- float vGridSpacingDraw;
- float blankDraw;
- double ruleValue = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
- if (this.wholePicture)
- {
- hGridSpacingDraw = (float)(this.documentWorkspace.CompositionSurface.Height - 2 * (int)(this.blank_rulevalue / ruleValue)) / (this.hNumber - 1);
- vGridSpacingDraw = (float)(this.documentWorkspace.CompositionSurface.Width - 2 * (int)(this.blank_rulevalue / ruleValue)) / (this.vNumber - 1);
- blankDraw = (int)(this.blank_rulevalue / ruleValue);
- }
- else
- {
- blankDraw = 0;
- hGridSpacingDraw = (int)(this.gridSpacing_rulevalue / ruleValue);
- vGridSpacingDraw = (int)(this.gridSpacing_rulevalue / ruleValue);
- }
- if(this.checkBox4.Checked)
- {
- if (this.hNumber > 0)
- {
- if (this.hNumber % 2 == 0)
- {
- float Spacing = hGridSpacingDraw / 2;
- for (int i = 0; i < (float)this.hNumber / 2; i++)
- {
- if (this.wholePicture)
- {
- if (this.documentWorkspace.CompositionSurface.Height > 2 * (int)(this.blank_rulevalue / ruleValue) && this.documentWorkspace.CompositionSurface.Width > 2 * (int)(this.blank_rulevalue / ruleValue))
- {
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= blankDraw)
- {
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing)
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height - blankDraw)
- {
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing)
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing));
- }
- }
- }
- else
- {
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= 0)
- {
- graphics.DrawLine(linePen, new PointF(minX, (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing)
- , new PointF(maxX, (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height)
- {
- graphics.DrawLine(linePen, new PointF(minX, (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing)
- , new PointF(maxX, (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing));
- }
- }
- Spacing += hGridSpacingDraw;
- }
- }
- else
- {
- if ((float)this.documentWorkspace.CompositionSurface.Width > 2 * blankDraw)
- {
- if (this.hNumber == 1)
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2)
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2));
- else
- {
- float Spacing = hGridSpacingDraw;
- for (int i = 0; i < (this.hNumber - 1) / 2; i++)
- {
- if (this.wholePicture)
- {
- if (this.documentWorkspace.CompositionSurface.Height > 2 * (int)(this.blank_rulevalue / ruleValue) && this.documentWorkspace.CompositionSurface.Width > 2 * (int)(this.blank_rulevalue / ruleValue))
- {
- if (i == 0)
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2)
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2));
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= blankDraw)
- {
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing)
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height - blankDraw)
- {
- graphics.DrawLine(linePen, new PointF(blankDraw, (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing)
- , new PointF((float)(this.documentWorkspace.CompositionSurface.Width - blankDraw), (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing));
- }
- }
- }
- else
- {
- if (i == 0)
- graphics.DrawLine(linePen, new PointF(minX, (float)this.documentWorkspace.CompositionSurface.Height / 2)
- , new PointF(maxX, (float)this.documentWorkspace.CompositionSurface.Height / 2));
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing >= 0)
- {
- graphics.DrawLine(linePen, new PointF(minX, (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing)
- , new PointF(maxX, (float)this.documentWorkspace.CompositionSurface.Height / 2 - Spacing));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Height)
- {
- graphics.DrawLine(linePen, new PointF(minX, (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing)
- , new PointF(maxX, (float)this.documentWorkspace.CompositionSurface.Height / 2 + Spacing));
- }
- }
- Spacing += hGridSpacingDraw;
- }
- }
- }
- }
- }
- if (this.vNumber > 0)
- {
- if (this.vNumber % 2 == 0)
- {
- float Spacing = vGridSpacingDraw / 2;
- for (int i = 0; i < (float)this.vNumber / 2; i++)
- {
- if (this.wholePicture)
- {
- if (this.documentWorkspace.CompositionSurface.Height > 2 * (int)(this.blank_rulevalue / ruleValue) && this.documentWorkspace.CompositionSurface.Width > 2 * (int)(this.blank_rulevalue / ruleValue))
- {
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= blankDraw)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width
- && (float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width - blankDraw)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- }
- }
- }
- else
- {
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, minY)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, maxY));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, minY)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, maxY));
- }
- }
- Spacing += vGridSpacingDraw;
- }
- }
- else
- {
- if (this.documentWorkspace.CompositionSurface.Height > 2 * blankDraw)
- {
- if (this.vNumber == 1)
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- else
- {
- float Spacing = vGridSpacingDraw;
- for (int i = 0; i < (this.vNumber - 1) / 2; i++)
- {
- if (this.wholePicture)
- {
- if (this.documentWorkspace.CompositionSurface.Height > 2 * (int)(this.blank_rulevalue / ruleValue) && this.documentWorkspace.CompositionSurface.Width > 2 * (int)(this.blank_rulevalue / ruleValue))
- {
- if (i == 0)
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width
- && this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width - blankDraw)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0 && (float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= blankDraw)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, blankDraw)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, (float)(this.documentWorkspace.CompositionSurface.Height - blankDraw)));
- }
- }
- }
- else
- {
- if (i == 0)
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, minY)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, maxY));
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing <= this.documentWorkspace.CompositionSurface.Width)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, minY)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + Spacing, maxY));
- }
- if ((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing >= 0)
- {
- graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, minY)
- , new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - Spacing, maxY));
- }
- }
- Spacing += vGridSpacingDraw;
- }
- }
- }
- }
- }
- }
- if(this.checkBox5.Checked)
- {
- if (this.p1RectangleFs.Count > 0 && this.dataGridView1.SelectedCells.Count > 0)
- {
- // 1截点
- foreach (var pointRectangleF in this.p1RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex])
- {
- // 绘制点
- PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
- int size = Convert.ToInt32(this.txt_LeftSize.Text);
- // 圆形
- if (this.rb_LeftCircle.Checked)
- {
- // 实心
- if (this.rb_leftFill.Checked)
- graphics.FillEllipse(new SolidBrush(this.panel1.BackColor), pointF.X - (float)size / 2, pointF.Y - (float)size / 2
- , size, size);
- // 空心
- else
- graphics.DrawEllipse(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- }
- // 方形
- else
- {
- // 实心
- if (this.rb_leftFill.Checked)
- graphics.FillRectangle(new SolidBrush(this.panel1.BackColor)
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- // 空心
- else
- graphics.DrawRectangle(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- }
- }
- }
- if (this.p2RectangleFs.Count > 0 && this.dataGridView1.SelectedCells.Count > 0)
- {
- // 0.5截点
- foreach (var pointRectangleF in this.p2RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex])
- {
- // 绘制点
- PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
- int size = Convert.ToInt32(this.txt_RightSize.Text);
- // 圆形
- if (this.rb_RightCircle.Checked)
- {
- // 实心
- if (this.rb_RightFill.Checked)
- graphics.FillEllipse(new SolidBrush(this.panel2.BackColor)
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- // 空心
- else
- graphics.DrawEllipse(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- }
- // 方形
- else
- {
- // 实心
- if (this.rb_RightFill.Checked)
- graphics.FillRectangle(new SolidBrush(this.panel2.BackColor)
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- // 空心
- else
- graphics.DrawRectangle(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
- , pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
- }
- }
- }
- }
- }
- private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBox3_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBox4_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBox5_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBoxLeftSize_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBoxLeftWidth_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBoxRightSize_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- private void textBoxRightWidth_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8)
- e.Handled = true;
- }
- /// <summary>
- /// 水平线值
- /// </summary>
- private string hText;
- /// <summary>
- /// 垂直线值
- /// </summary>
- private string vText;
- /// <summary>
- /// 线宽值
- /// </summary>
- private string wText;
- /// <summary>
- /// 间距值
- /// </summary>
- private string sText;
- /// <summary>
- /// 水平线数量改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void textBox2_TextChanged(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.textBox2.Text))
- this.textBox2.Text = "0";
- if (this.textBox2.Text.Length > 1 && this.textBox2.Text.Substring(0, 1).Equals("0"))
- this.textBox2.Text = this.textBox2.Text.Substring(1, (this.textBox2.Text.Length - 1));
- if (Convert.ToInt32(this.textBox2.Text) > 100000)
- this.textBox2.Text = "100000";
- if (Convert.ToInt32(this.textBox2.Text) > 0)
- this.hNumber = Convert.ToInt32(this.textBox2.Text) + 1;
- else
- this.hNumber = 0;
- if (selectPicture >= 0)
- RefreshGridIntersections();
- if (this.exceed)
- this.textBox2.Text = this.hText;
- foreach (var item in this.p1RectangleFs)
- {
- item.Clear();
- }
- foreach (var item in this.p2RectangleFs)
- {
- item.Clear();
- }
- //this.p1RectangleFs.Clear();
- //this.p2RectangleFs.Clear();
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[2].Value = 0;
- this.dataGridView1.Rows[i].Cells[3].Value = 0;
- this.dataGridView1.Rows[i].Cells[4].Value = 0;
- this.dataGridView1.Rows[i].Cells[5].Value = 0;
- }
- if (this.dataGridView1.Rows.Count > 0)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[1].Value = this.rectangleFs.Count;
- }
- }
- this.hText = this.textBox2.Text;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 垂线数量改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void textBox3_TextChanged(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.textBox3.Text))
- this.textBox3.Text = "0";
- if (this.textBox3.Text.Length > 1 && this.textBox3.Text.Substring(0, 1).Equals("0"))
- this.textBox3.Text = this.textBox3.Text.Substring(1, (this.textBox3.Text.Length - 1));
- if (Convert.ToInt32(this.textBox3.Text) > 100000)
- this.textBox3.Text = "100000";
- if (Convert.ToInt32(this.textBox3.Text) > 0)
- this.vNumber = Convert.ToInt32(this.textBox3.Text) + 1;
- else
- this.vNumber = 0;
- if (selectPicture >= 0)
- RefreshGridIntersections();
- if (this.exceed)
- this.textBox3.Text = this.vText;
- foreach (var item in this.p1RectangleFs)
- {
- item.Clear();
- }
- foreach (var item in this.p2RectangleFs)
- {
- item.Clear();
- }
- //this.p1RectangleFs.Clear();
- //this.p2RectangleFs.Clear();
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[2].Value = 0;
- this.dataGridView1.Rows[i].Cells[3].Value = 0;
- this.dataGridView1.Rows[i].Cells[4].Value = 0;
- this.dataGridView1.Rows[i].Cells[5].Value = 0;
- }
- if (this.dataGridView1.Rows.Count > 0)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[1].Value = this.rectangleFs.Count;
- }
- }
- this.vText = this.textBox3.Text;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 网格线宽改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void textBox4_TextChanged(object sender, EventArgs e)
- {
- 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 >= 0)
- RefreshGridIntersections();
- 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)
- {
- 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_rulevalue = Convert.ToInt32(this.textBox5.Text);
- if (selectPicture >= 0)
- RefreshGridIntersections();
- if (this.exceed)
- this.textBox5.Text = this.sText;
- //this.p1RectangleFs.Clear();
- //this.p2RectangleFs.Clear();
- foreach (var item in this.p1RectangleFs)
- {
- item.Clear();
- }
- foreach (var item in this.p2RectangleFs)
- {
- item.Clear();
- }
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[2].Value = 0;
- this.dataGridView1.Rows[i].Cells[3].Value = 0;
- this.dataGridView1.Rows[i].Cells[4].Value = 0;
- this.dataGridView1.Rows[i].Cells[5].Value = 0;
- }
- if (this.dataGridView1.Rows.Count > 0)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[1].Value = this.rectangleFs.Count;
- }
- }
- this.sText = this.textBox5.Text;
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 网格颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void panel4_BackColorChanged(object sender, EventArgs e)
- {
- this.gridColor = Convert.ToInt32(this.panel4.BackColor.ToArgb());
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 是否全图
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- 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 >= 0)
- RefreshGridIntersections();
- //this.p1RectangleFs.Clear();
- //this.p2RectangleFs.Clear();
- foreach (var item in this.p1RectangleFs)
- {
- item.Clear();
- }
- foreach (var item in this.p2RectangleFs)
- {
- item.Clear();
- }
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[2].Value = 0;
- this.dataGridView1.Rows[i].Cells[3].Value = 0;
- this.dataGridView1.Rows[i].Cells[4].Value = 0;
- this.dataGridView1.Rows[i].Cells[5].Value = 0;
- }
- if (this.dataGridView1.Rows.Count > 0)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[1].Value = this.rectangleFs.Count;
- }
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 余白改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown4_ValueChanged(object sender, EventArgs e)
- {
- this.blank_rulevalue = Convert.ToInt32(this.numericUpDown4.Value);
- double ruleValue = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
- if (this.blank_rulevalue / ruleValue < 1)//避免余白为0造成网格计算超出界限
- this.blank_rulevalue = (ruleValue - (int)(1 * ruleValue) > 0) ? ((int)(1 * ruleValue) + 1) : (int)(1 * ruleValue);
- if (selectPicture >= 0)
- RefreshGridIntersections();
- //this.p1RectangleFs.Clear();
- //this.p2RectangleFs.Clear();
- foreach (var item in this.p1RectangleFs)
- {
- item.Clear();
- }
- foreach (var item in this.p2RectangleFs)
- {
- item.Clear();
- }
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[2].Value = 0;
- this.dataGridView1.Rows[i].Cells[3].Value = 0;
- this.dataGridView1.Rows[i].Cells[4].Value = 0;
- this.dataGridView1.Rows[i].Cells[5].Value = 0;
- }
- if (this.dataGridView1.Rows.Count > 0)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[1].Value = this.rectangleFs.Count;
- }
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 另存为按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- List<string> items;
- if (this.comboBox1.Items != null && this.comboBox1.Items.Count > 0)
- {
- items = new List<string>(this.comboBox1.Items.Count);
- foreach (var item in this.comboBox1.Items)
- {
- items.Add(item.ToString());
- }
- }
- else
- {
- items = null;
- }
- GrainSizePointCountingMethodGridSaveDialog grainSizePointCountingMethodGridSaveDialog = new GrainSizePointCountingMethodGridSaveDialog(items, 1);
- grainSizePointCountingMethodGridSaveDialog.StartPosition = FormStartPosition.CenterScreen;
- grainSizePointCountingMethodGridSaveDialog.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 (grainSizePointCountingMethodModel.GridStyleList != null)
- {
- foreach (var GridStyle in grainSizePointCountingMethodModel.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_rulevalue.ToString();
- this.panel4.BackColor = Color.FromArgb(GridStyle.gridColor);
- this.checkBox2.Checked = GridStyle.wholePicture;
- this.numericUpDown4.Value = GridStyle.blank_rulevalue;
- }
- }
- }
- if (this.checkBox2.Checked)
- {
- this.label10.Visible = false;
- this.textBox5.Visible = false;
- this.label12.Visible = true;
- this.numericUpDown4.Visible = true;
- }
- else
- {
- this.label10.Visible = true;
- this.textBox5.Visible = true;
- this.label12.Visible = false;
- this.numericUpDown4.Visible = false;
- }
- //this.p1RectangleFs.Clear();
- //this.p2RectangleFs.Clear();
- foreach (var item in this.p1RectangleFs)
- {
- item.Clear();
- }
- foreach (var item in this.p2RectangleFs)
- {
- item.Clear();
- }
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- this.dataGridView1.Rows[i].Cells[2].Value = 0;
- this.dataGridView1.Rows[i].Cells[3].Value = 0;
- this.dataGridView1.Rows[i].Cells[5].Value = 0;
- }
- }
- }
- /// <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";
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点1线宽改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_LeftLineWeight_TextChanged(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.txt_LeftLineWeight.Text))
- this.txt_LeftLineWeight.Text = "0";
- if (this.txt_LeftLineWeight.Text.Length > 1 && this.txt_LeftLineWeight.Text.Substring(0, 1).Equals("0"))
- this.txt_LeftLineWeight.Text = this.txt_LeftLineWeight.Text.Substring(1, (this.txt_LeftLineWeight.Text.Length - 1));
- if (Convert.ToInt32(this.txt_LeftLineWeight.Text) > 100000)
- this.txt_LeftLineWeight.Text = "100000";
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点0.5形状改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void rb_RightCircle_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点0.5样式改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void rb_RightFill_CheckedChanged(object sender, EventArgs e)
- {
- if (this.rb_RightFill.Checked)
- {
- this.label15.Visible = false;
- this.txt_RightLineWeight.Visible = false;
- }
- else
- {
- this.label15.Visible = true;
- this.txt_RightLineWeight.Visible = true;
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点0.5大小改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_RightSize_TextChanged(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.txt_RightSize.Text))
- this.txt_RightSize.Text = "0";
- if (this.txt_RightSize.Text.Length > 1 && this.txt_RightSize.Text.Substring(0, 1).Equals("0"))
- this.txt_RightSize.Text = this.txt_RightSize.Text.Substring(1, (this.txt_RightSize.Text.Length - 1));
- if (Convert.ToInt32(this.txt_RightSize.Text) > 100000)
- this.txt_RightSize.Text = "100000";
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点0.5线宽改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_RightLineWeight_TextChanged(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(this.txt_RightLineWeight.Text))
- this.txt_RightLineWeight.Text = "0";
- if (this.txt_RightLineWeight.Text.Length > 1 && this.txt_RightLineWeight.Text.Substring(0, 1).Equals("0"))
- this.txt_RightLineWeight.Text = this.txt_RightLineWeight.Text.Substring(1, (this.txt_RightLineWeight.Text.Length - 1));
- if (Convert.ToInt32(this.txt_RightLineWeight.Text) > 100000)
- this.txt_RightLineWeight.Text = "100000";
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 截点0.5颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void panel2_BackColorChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 开始测量
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- if (this.listView1.SelectedItems.Count > 0)
- {
- this.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.check1Dic.Clear();//##20721
- this.p1RectangleFs.Clear();
- this.p2RectangleFs.Clear();
- this.documentWorkspace.Refresh();
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- }
- }
- /// <summary>
- /// 停止测量
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button7_Click(object sender, EventArgs e)
- {
- this.button6.Visible = true;
- this.button7.Visible = false;
- this.comboBox1.Enabled = true;
- this.button3.Enabled = true;
- this.button4.Enabled = true;
- this.button5.Enabled = true;
- this.groupBox4.Enabled = true;
- this.button6.Focus();
- }
- /// <summary>
- /// 截点颜色改变
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void panel1_BackColorChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 保存按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, EventArgs e)
- {
- if (this.comboBox1.Items.Count == 0)
- {
- GrainSizePointCountingMethodGridSaveDialog grainSizePointCountingMethodGridSaveDialog = new GrainSizePointCountingMethodGridSaveDialog(null, 1);
- grainSizePointCountingMethodGridSaveDialog.StartPosition = FormStartPosition.CenterScreen;
- grainSizePointCountingMethodGridSaveDialog.ShowDialog(this);
- }
- else
- {
- RefreshGridItems(null);
- //MessageBox.Show(PdnResources.GetString("Menu.Successfullysaved.text")+"!");//##20598
- }
- }
- /// <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.grainSizePointCountingMethodModel.GridStyleList != null)
- {
- foreach (var GridStyle in this.grainSizePointCountingMethodModel.GridStyleList)
- {
- if (GridStyle.gridName.Equals(this.comboBox1.SelectedItem))
- {
- this.grainSizePointCountingMethodModel.GridStyleList.Remove(GridStyle);
- break;
- }
- }
- }
- ArrayList arrayList = new ArrayList();
- foreach (var GridStyle in grainSizePointCountingMethodModel.GridStyleList)
- {
- arrayList.Add(GridStyle.gridName);
- }
- this.comboBox1.DataSource = null;
- this.comboBox1.DataSource = arrayList;
- if (this.comboBox1.Items.Count > 0)
- {
- if (index == 0)
- this.comboBox1.SelectedIndex = index;
- else
- this.comboBox1.SelectedIndex = index - 1;
- }
- else
- {
- this.textBox2.Text = "0";
- this.textBox3.Text = "0";
- this.textBox4.Text = "0";
- this.textBox5.Text = "0";
- this.numericUpDown4.Value = 0;
- this.checkBox2.Checked = false;
- this.label10.Visible = true;
- this.textBox5.Visible = true;
- this.label12.Visible = false;
- this.numericUpDown4.Visible = false;
- }
- //以下保存xml文件信息
- string stageModelXml = XmlSerializeHelper.XmlSerialize<GrainSizePointCountingMethodModel>(grainSizePointCountingMethodModel);
- string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizePointCountingMethodModel.xml";
- FileOperationHelper.WriteStringToFile(stageModelXml, filePath, FileMode.Create);
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Nogrid.text")+"!");
- }
- }
- /// <summary>
- /// 移动
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void onMouseMove(object sender, MouseEventArgs e)
- {
- // 换算后的点
- PointF point1 = documentWorkspace.GetScalePoint(e.Location);
- }
- private void dataGridView1_SelectionChanged(object sender, EventArgs e)
- {
- if (this.dataGridView1.SelectedCells.Count > 0)
- {
- if (check1Dic.ContainsKey(this.dataGridView1.SelectedCells[0].RowIndex))
- {
- autoCheck = (this.checkBox6.Checked != check1Dic[this.dataGridView1.SelectedCells[0].RowIndex]);
- this.checkBox6.Checked = check1Dic[this.dataGridView1.SelectedCells[0].RowIndex];
- }
- else
- {
- check1Dic[this.dataGridView1.SelectedCells[0].RowIndex] = false;
- autoCheck = (this.checkBox6.Checked != false);
- this.checkBox6.Checked = false;
- }
- }
- else
- {
- autoCheck = (this.checkBox6.Checked != false);
- this.checkBox6.Checked = false;
- }
- 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)
- {
- int dataTableIndex = 0;
- for (int i = 0; i < this.pictureDataTables.Count; i++)
- {
- if (this.pictureDataTables[i].TableName.Equals(this.listView2.SelectedItems[0].Tag))
- dataTableIndex = i;
- }
- if (this.pictureDataTables[dataTableIndex].Rows.Count > 0)
- {
- this.dataGridView4.Rows.Clear();
- for (int r = 0; r < this.pictureDataTables[dataTableIndex].Rows.Count; r++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < this.pictureDataTables[dataTableIndex].Columns.Count; c++)
- {
- if(c == this.pictureDataTables[dataTableIndex].Columns.Count - 1)
- dgvr.Cells[c].Value =Math.Round((double)Convert.ToDecimal(this.pictureDataTables[dataTableIndex].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
- else
- dgvr.Cells[c].Value = this.pictureDataTables[dataTableIndex].Rows[r][c].ToString();
- }
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- }
- else
- {
- this.listView2.Items[0].Selected = true;
- if (this.pictureDataTables.Count > 0
- && this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count > 0)
- {
- this.dataGridView4.Rows.Clear();
- for (int r = 0; r < this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count; r++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count; c++)
- {
- if(c == this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count - 1)
- dgvr.Cells[c].Value =Math.Round((double)Convert.ToDecimal( this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
- else
- dgvr.Cells[c].Value =this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c].ToString();
- }
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- }
- }
- }
- /// <summary>
- /// 分析结果删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button12_Click(object sender, EventArgs e)
- {
- if (this.listView2.Items.Count > 0)
- {
- if (this.listView2.SelectedItems.Count > 0)
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethisanalysisresult.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- string detaleName = string.Empty;
- int selectIndex = this.listView2.SelectedItems[0].Index;
- int count = this.listView2.Items.Count;
- for (int i = 0; i < count; i++)
- {
- if (this.listView2.SelectedItems[0].Text.Equals(this.listView2.Items[i].SubItems[0].Text))
- {
- detaleName = this.listView2.Items[i].Tag.ToString();
- this.listView2.Items.Remove(this.listView2.Items[i]);
- break;
- }
- }
- foreach (DataTable dataTable in this.pictureDataTables)
- {
- if (dataTable.TableName.Equals(detaleName))
- {
- this.pictureDataTables.Remove(dataTable);
- break;
- }
- }
- if (bitDic.ContainsKey(detaleName))
- bitDic.Remove(detaleName);
- //中间数据
- foreach (ExportProjectModel model in this.tempDataModel)
- {
- if (model.tagName.Equals(detaleName))
- {
- this.tempDataModel.Remove(model);
- break;
- }
- }
- if (this.listView2.Items.Count > 0)
- {
- if (selectIndex == 0)
- this.listView2.Items[0].Selected = true;
- else
- this.listView2.Items[selectIndex - 1].Selected = true;
- RefreshDataGridView4();
- }
- else
- {
- this.dataGridView4.Rows.Clear();
- }
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheanalysisresulttodelete.text")+"!");
- }
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Nodataintheanalysisresults.text")+"!");
- }
- }
- /// <summary>
- /// 刷新分析结果数据
- /// </summary>
- private void RefreshDataGridView4()
- {
- if (!this.allShow)
- {
- if (this.listView2.SelectedItems.Count > 0)
- {
- int dataTableIndex = 0;
- for (int i = 0; i < this.pictureDataTables.Count; i++)
- {
- if (this.pictureDataTables[i].TableName.Equals(this.listView2.SelectedItems[0].Tag))
- dataTableIndex = i;
- }
- if (this.pictureDataTables[dataTableIndex].Rows.Count > 0)
- {
- this.dataGridView4.Rows.Clear();
- for (int r = 0; r < this.pictureDataTables[dataTableIndex].Rows.Count; r++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < this.pictureDataTables[dataTableIndex].Columns.Count; c++)
- {
- if(c != this.pictureDataTables[dataTableIndex].Columns.Count - 1)
- dgvr.Cells[c].Value = this.pictureDataTables[dataTableIndex].Rows[r][c].ToString();
- else
- dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[dataTableIndex].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
- }
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- }
- }
- else
- {
- this.dataGridView4.Rows.Clear();
- DataTable dataTable = new DataTable();
- for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
- {
- dataTable = this.pictureDataTables[i];
- for (int r = 0; r < dataTable.Rows.Count; r++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < dataTable.Columns.Count; c++)
- {
- if(c != dataTable.Columns.Count - 1)
- dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
- else
- dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
- }
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- }
- }
- /// <summary>
- /// 切换分析结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listView2_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (!this.allShow)
- {
- if (this.listView2.SelectedItems.Count <= 0)
- return;
- this.dataGridView4.Rows.Clear();
- //1019###19650
- for (int listViewIndex = 0; listViewIndex < this.listView2.SelectedItems.Count; listViewIndex++)
- {
- int dataTableIndex = 0;
- for (int i = 0; i < this.pictureDataTables.Count; i++)
- {
- if (this.pictureDataTables[i].TableName.Equals(this.listView2.SelectedItems[listViewIndex].Tag))
- dataTableIndex = i;
- }
- if (this.pictureDataTables[dataTableIndex].Rows.Count > 0)
- {
- //this.dataGridView4.Rows.Clear();
- for (int r = 0; r < this.pictureDataTables[dataTableIndex].Rows.Count; r++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < this.pictureDataTables[dataTableIndex].Columns.Count; c++)
- {
- if(c == this.pictureDataTables[dataTableIndex].Columns.Count - 1)
- dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[dataTableIndex].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
- else
- dgvr.Cells[c].Value = this.pictureDataTables[dataTableIndex].Rows[r][c].ToString();
- }
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- }
- }
- }
- /// <summary>
- /// 未选择分析结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listView2_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
- {
- if (!this.allShow)
- {
- if (this.listView2.SelectedItems.Count == 0)
- this.dataGridView4.Rows.Clear();
- }
- }
- /// <summary>
- /// 全部显示
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button11_Click(object sender, EventArgs e)
- {
- this.allShow = true;
- this.button11.Visible = false;
- this.button16.Visible = true;
- this.button16.Focus();
- AllShow();
- }
- private void AllShow()
- {
- this.dataGridView4.Rows.Clear();
- DataTable dataTable = new DataTable();
- for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
- {
- dataTable = this.pictureDataTables[i];
- for (int r = 0; r < dataTable.Rows.Count; r++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < dataTable.Columns.Count; c++)
- {
- if (c == dataTable.Columns.Count - 1)
- dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
- else
- dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
- }
- this.dataGridView4.Rows.Add(dgvr);
- }
- }
- }
- /// <summary>
- /// 鼠标按下
- /// </summary>
- /// <param name="drawArea"></param>
- /// <param name="e"></param>
- private void OnMouseDown(object sender, MouseEventArgs e)
- {
- if (this.button6.Visible)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!");
- return;
- }
- if (this.dataGridView1.SelectedCells.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectatype,ifnot,pleaseaddatype.text")+"!");
- return;
- }
- if (!bcBinaryChecked())
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformperation.text")+"!");
- return;
- }
- // 换算后的点
- PointF point1 = documentWorkspace.GetScalePoint(e.Location);
- bool canAdd1 = true;
- bool canAdd2 = true;
- if (p2RectangleFs.Count > 0)
- {
- foreach (var rectangleF in p2RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex])
- {
- if (rectangleF.Contains(point1))
- {
- canAdd1 = false;
- if(e.Button == MouseButtons.Left && e.Clicks == 2)
- {
- p2RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Remove(rectangleF);
- this.saveSuccess = true;
- break;
- }
- }
- }
- }
- if (p1RectangleFs.Count > 0)
- {
- foreach (var rectangleF in p1RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex])
- {
- if (rectangleF.Contains(point1))
- {
- canAdd2 = false;
- if (e.Button == MouseButtons.Left && e.Clicks == 2)
- {
- p1RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Remove(rectangleF);
- this.saveSuccess = true;
- break;
- }
-
- }
- }
- }
- if (e.Button == MouseButtons.Left)
- {
- foreach (RectangleF rectangleF in this.rectangleFs)
- {
- if (canAdd1 && canAdd2)
- {
- if (rectangleF.Contains(point1))
- {
- p1RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(new RectangleF(rectangleF.X + (float)rectangleF.Width / 2 - (float)(Convert.ToInt32(this.txt_LeftSize.Text) / 2)
- , rectangleF.Y + (float)rectangleF.Height / 2 - (float)(Convert.ToInt32(this.txt_LeftSize.Text) / 2)
- , Convert.ToInt32(this.txt_LeftSize.Text), Convert.ToInt32(this.txt_LeftSize.Text)));
- this.saveSuccess = true;
- }
- }
- }
- }
- if (e.Button == MouseButtons.Right)
- {
- foreach (RectangleF rectangleF in this.rectangleFs)
- {
- if (canAdd1 && canAdd2)
- {
- if (rectangleF.Contains(point1))
- {
- p2RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(new RectangleF(rectangleF.X + (float)rectangleF.Width / 2 - (float)(Convert.ToInt32(this.txt_RightSize.Text) / 2)
- , rectangleF.Y + (float)rectangleF.Height / 2 - (float)(Convert.ToInt32(this.txt_RightSize.Text) / 2)
- , Convert.ToInt32(this.txt_RightSize.Text), Convert.ToInt32(this.txt_RightSize.Text)));
- this.saveSuccess = true;
- }
- }
- }
- }
-
- if (this.p1RectangleFs.Count > 0)
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[2].Value = p1RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count;
- else
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[2].Value = 0;
- if (this.p2RectangleFs.Count > 0)
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[3].Value = p2RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count;
- else
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[3].Value = 0;
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[1].Value) > 0)
- {
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[4].Value = (Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[2].Value)
- + (double)(Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[3].Value) * 0.5));
- percentage = (double)((Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[2].Value)
- + (double)(Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[3].Value) * 0.5))
- / Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[1].Value)) * 100;
- }
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[5].Value = Math.Round(percentage, Convert.ToInt32(this.numericUpDown1.Value));
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 添加
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void but_AddPhase_Click(object sender, EventArgs e)
- {
- if(this.button6.Visible)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!");
- return;
- }
- this.typeName = string.Empty;
- List<string> items;
- if (this.dataGridView1.Rows.Count > 0)
- {
- items = new List<string>(this.dataGridView1.Rows.Count);
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- items.Add(this.dataGridView1.Rows[i].Cells[0].Value.ToString());
- }
- }
- else
- items = null;
- GrainSizePointCountingMethodGridSaveDialog grainSizePointCountingMethodGridSaveDialog = new GrainSizePointCountingMethodGridSaveDialog(items, 2);
- grainSizePointCountingMethodGridSaveDialog.StartPosition = FormStartPosition.CenterScreen;
- grainSizePointCountingMethodGridSaveDialog.ShowDialog(this);
- if(!string.IsNullOrEmpty(this.typeName))
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- foreach (DataGridViewColumn c in this.dataGridView1.Columns)
- {
- dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
- }
- dgvr.Cells[0].Value = this.typeName + "";//0915###18762 & 18756 "视场1";
- dgvr.Cells[1].Value = this.rectangleFs.Count;
- dgvr.Cells[2].Value = 0;
- dgvr.Cells[3].Value = 0;
- dgvr.Cells[4].Value = 0;// this.rectangleFs.Count;
- dgvr.Cells[5].Value = 0;
- this.dataGridView1.Rows.Add(dgvr);
- this.p1RectangleFs.Add(new List<RectangleF>());
- this.p2RectangleFs.Add(new List<RectangleF>());
- this.saveSuccess = true;
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void But_DelPhase_Click(object sender, EventArgs e)
- {
- if (this.dataGridView1.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
- return;
- }
- if (this.dataGridView1.SelectedCells.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectthedatatobedeleted.text")+"!");
- return;
- }
- DialogResult dt = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretcteddata.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dt == DialogResult.OK)
- {
- if (this.dataGridView1.Rows.Count > 0)
- {
- this.p1RectangleFs.RemoveAt(this.dataGridView1.SelectedCells[0].RowIndex);
- this.p2RectangleFs.RemoveAt(this.dataGridView1.SelectedCells[0].RowIndex);
- }
- else
- {
- this.p1RectangleFs.RemoveAt(0);
- this.p2RectangleFs.RemoveAt(0);
- }
- this.dataGridView1.Rows.RemoveAt(this.dataGridView1.SelectedCells[0].RowIndex);
- this.saveSuccess = true;
- this.documentWorkspace.Refresh();
- }
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button8_Click(object sender, EventArgs e)
- {
- if (this.dataGridView1.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
- return;
- }
- if (this.dataGridView1.SelectedCells.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectthedatatoedit.text")+"!");
- return;
- }
-
- int selIndex;
- selIndex = this.dataGridView1.SelectedCells[0].RowIndex;
- //this.dataGridView1.ClearSelection();
- this.dataGridView1.ReadOnly = false;
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- if (i != selIndex)
- this.dataGridView1.Rows[selIndex].ReadOnly = true;
- }
- for (int i = 0; i < this.dataGridView1.Rows[selIndex].Cells.Count; i++)
- {
- if(i != 1)
- this.dataGridView1.Rows[selIndex].Cells[i].ReadOnly = true;
- }
- this.dataGridView1.Rows[selIndex].Cells[0].ReadOnly = false;
- List<string> items;
- if (this.dataGridView1.Rows != null && this.dataGridView1.Rows.Count > 0)
- {
- items = new List<string>(this.dataGridView1.Rows.Count);
- foreach (DataGridViewRow item in this.dataGridView1.Rows)
- {
- items.Add(item.Cells[0].Value.ToString());
- }
- }
- else
- {
- items = null;
- }
- oldValue = this.dataGridView1.Rows[selIndex].Cells[0].Value.ToString();
- GrainSizePointCountingMethodGridSaveDialog grainSizePointCountingMethodGridSaveDialog = new GrainSizePointCountingMethodGridSaveDialog(items, 2, oldValue);
- grainSizePointCountingMethodGridSaveDialog.StartPosition = FormStartPosition.CenterScreen;
- grainSizePointCountingMethodGridSaveDialog.ShowDialog(this);
- if (!string.IsNullOrEmpty(this.typeName))
- {
- this.dataGridView1.Rows[selIndex].Cells[0].Value = this.typeName + "";
- this.dataGridView1.ReadOnly = true;
- this.dataGridView1.Rows[selIndex].Cells[0].ReadOnly = true;
- //DataGridViewRow dgvr = new DataGridViewRow();
- //foreach (DataGridViewColumn c in this.dataGridView1.Columns)
- //{
- // dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
- //}
- //dgvr.Cells[0].Value = this.typeName + "";//0915###18762 & 18756 "视场1";
- //dgvr.Cells[1].Value = this.rectangleFs.Count;
- //dgvr.Cells[2].Value = 0;
- //dgvr.Cells[3].Value = 0;
- //dgvr.Cells[4].Value = 0;// this.rectangleFs.Count;
- //dgvr.Cells[5].Value = 0;
- //this.dataGridView1.Rows.Add(dgvr);
- //this.p1RectangleFs.Add(new List<RectangleF>());
- //this.p2RectangleFs.Add(new List<RectangleF>());
- }
- //this.dataGridView1.Rows[selIndex].Cells[0].Style.BackColor = Color.GreenYellow;
- //this.dataGridView1.Rows[selIndex].Cells[0].Selected = true;
- }
- /// <summary>
- /// 获取单元格修改之前的值
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
- {
- oldValue = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
- }
- /// <summary>
- /// 单元格修改验证
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
- {
- if (e.RowIndex >= 0)
- {
- string newValue = this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();//0916###18878
- for (int i = 0; i < dataGridView1.Rows.Count; i++)
- {
- if (i != e.RowIndex && newValue.Equals(this.dataGridView1.Rows[i].Cells[0].Value.ToString()))
- {
- MessageBox.Show(PdnResources.GetString("Menu.Namealreadyexists.text")+"!");
- this.dataGridView1.Rows[e.RowIndex].Cells[0].Value = oldValue;
- return;
- }
- }
- }
- }
- /// <summary>
- /// 编辑结束后
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
- {
- this.dataGridView1.ReadOnly = true;
- this.dataGridView1.Rows[e.RowIndex].Cells[0].ReadOnly = true;
- this.dataGridView1.Rows[e.RowIndex].Cells[0].Style.BackColor = SystemColors.ControlLightLight;
- }
- /// <summary>
- /// 清空
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void but_Clear_Click(object sender, EventArgs e)
- {
- if (this.dataGridView1.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
- return;
- }
- DialogResult dt = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretocleardata?.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dt == DialogResult.OK)
- {
- this.dataGridView1.Rows.Clear();
- this.check1Dic.Clear();//##20721
- this.p1RectangleFs.Clear();
- this.p2RectangleFs.Clear();
- this.documentWorkspace.Refresh();
- }
- }
- /// <summary>
- /// 保存结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- if (this.listView1.SelectedItems.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- return;
- }
- SaveMeasurementResults(this.listView1.SelectedItems[0].Index/*, this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName()*/); ;
- }
- /// <summary>
- /// 保存结果
- /// </summary>
- private void SaveMeasurementResults(int selectIndex/*, string imgName*/)
- {
- if (this.listView1.SelectedItems.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- return;
- }
- string imgName = this.appWorkspace.DocumentWorkspaces[selectIndex/*this.listView1.FocusedItem.Index*/].GetFriendlyName();
- string tag = this.imageList1.Images.Keys[selectIndex];
- if (this.dataGridView1.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseaddtype.text")+"!");
- return;
- }
- //int count = 0;
- //foreach (var item in this.p1RectangleFs)
- //{
- // count += item.Count;
- //}
- //foreach (var item in this.p2RectangleFs)
- //{
- // count += item.Count;
- //}
- //if (count == 0)
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleaseadaintercept.Text")+"!");
- // return;
- //}
- DataTable dataTable1 = new DataTable();
- bool replace = false;
- int add = 0;
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (item.Tag.Equals(tag))
- {
- add++;
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Themeasurementdertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- replace = true;
- this.listView2.Items.Remove(item);
- }
- break;
- }
- }
- if (replace || this.listView2.Items.Count == 0 || add == 0)
- {
- this.dataGridView4.Rows.Clear();
- 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;
- foreach (DataGridViewRow Row in this.dataGridView1.Rows)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- foreach (DataGridViewColumn Column in this.dataGridView4.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- dgvr.Cells[0].Value = imgName;
- dgvr.Cells[1].Value = Row.Cells[0].Value;
- dgvr.Cells[2].Value = Row.Cells[1].Value;
- dgvr.Cells[3].Value = Row.Cells[2].Value;
- dgvr.Cells[4].Value = Row.Cells[3].Value;
- dgvr.Cells[5].Value = Row.Cells[4].Value;
- dgvr.Cells[6].Value = Row.Cells[5].Value;
- this.dataGridView4.Rows.Add(dgvr);
- }
- foreach (DataTable dataTable2 in pictureDataTables)
- {
- if (dataTable2.TableName.Equals(dataTable1.TableName))
- {
- pictureDataTables.Remove(dataTable2);
- break;
- }
- }
- foreach (DataGridViewColumn c in this.dataGridView4.Columns)
- {
- dataTable1.Columns.Add(c.HeaderText);
- }
- for (int r = 0; r < this.dataGridView1.Rows.Count; r++)
- {
- DataRow dataRow = dataTable1.NewRow();
- for (int c = 0; c < this.dataGridView1.Rows[r].Cells.Count + 1; c++)
- {
- if(c == 0)
- dataRow[this.dataGridView4.Columns[c].HeaderText] = imgName;
- else
- {
- if (c == 5)
- {
- dataRow[this.dataGridView4.Columns[c].HeaderText] = (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[2].Value)
- + (double)(Convert.ToInt32(this.dataGridView1.Rows[r].Cells[3].Value) * 0.5));
- }
- else if(c == this.dataGridView1.Rows[r].Cells.Count)
- {
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[1].Value) > 0)
- {
- percentage = (double)((Convert.ToInt32(this.dataGridView1.Rows[r].Cells[2].Value)
- + (double)(Convert.ToInt32(this.dataGridView1.Rows[r].Cells[3].Value) * 0.5))
- / Convert.ToInt32(this.dataGridView1.Rows[r].Cells[1].Value)) * 100;
- }
- dataRow[this.dataGridView4.Columns[c].HeaderText] = percentage;
- }
- else
- dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView1.Rows[r].Cells[c - 1].Value;
-
- }
- }
- dataTable1.Rows.Add(dataRow);
- }
- this.pictureDataTables.Add(dataTable1);
- if (this.allShow)
- AllShow();
- this.listView2.Items[0].Selected = true;
- this.saveSuccess = false;
- //保存处理后的图片
- double pantographRatio = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
- List<Bitmap> tempBit = new List<Bitmap>();
- Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[selectIndex/*this.listView1.FocusedItem.Index*/].CompositionSurface.CreateAliasedBitmap();
- originalBit.Tag = pantographRatio;
- tempBit.Add(originalBit);
- Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
- Graphics graphics = Graphics.FromImage(newBit);
- //{ }//0916###18882
- if (this.documentWorkspace.PhaseModels.Count > 0 && this.documentWorkspace.PhaseModels[0].choise && this.documentWorkspace.PhaseModels[0].mat != null)
- {
- Mat targetMat = this.documentWorkspace.PhaseModels[0].mat;
- graphics.DrawImage(OpenCvSharp.Extensions.BitmapConverter.ToBitmap(targetMat), 0, 0, targetMat.Width, targetMat.Height);
- }
- //if (this.documentWorkspace.PhaseModels[1].choise && this.documentWorkspace.PhaseModels[1].mat != null)
- //{
- // Mat targetMat = this.documentWorkspace.PhaseModels[1].mat;
- // graphics.DrawImage(OpenCvSharp.Extensions.BitmapConverter.ToBitmap(targetMat), 0, 0, targetMat.Width, targetMat.Height);
- //}
- Draw(graphics);
- newBit.Tag = pantographRatio;
- tempBit.Add(newBit);
- if (bitDic.ContainsKey(tag))
- bitDic[tag] = tempBit;
- else
- bitDic.Add(tag, tempBit);
- //中间数据-拼接中间数据
- List<List<string>> dataList = new List<List<string>>();
- List<string> columnName = new List<string>();
- columnName.Add(PdnResources.GetString("Menu.Type.text"));
- columnName.Add(PdnResources.GetString("Menu.Gridpoints.text"));
- columnName.Add("1");
- columnName.Add(".5");
- columnName.Add(PdnResources.GetString("Menu.total.text"));
- columnName.Add(PdnResources.GetString("Menu.percent.text"));
- dataList.Add(columnName);
- foreach (DataGridViewRow Row in this.dataGridView1.Rows)
- {
- List<string> strList = new List<string>();
- strList.Add(Row.Cells[0].Value.ToString());
- strList.Add(Row.Cells[1].Value.ToString());
- strList.Add(Row.Cells[2].Value.ToString());
- strList.Add(Row.Cells[3].Value.ToString());
- strList.Add(Row.Cells[4].Value.ToString());
- strList.Add(Row.Cells[5].Value.ToString());
- dataList.Add(strList);
- }
- bool isExist = false;//是否已存在进行替换
- int modelIndex = -1;//要替换的下标
- for (int j = 0; j < tempDataModel.Count; j++)
- {
- if (tempDataModel[j].tagName.Equals(tag))
- {
- isExist = true;
- modelIndex = j;
- break;
- }
- }
- if (isExist && modelIndex > -1)
- tempDataModel[modelIndex].dataList = dataList;
- else
- {
- ExportProjectModel newModel = new ExportProjectModel();
- newModel.tagName = tag;
- newModel.picName = imgName;
- newModel.dataList = dataList;
- tempDataModel.Add(newModel);
- }
- RefreshDataGridView4();
- }
- }
- /// <summary>
- /// 导出结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button14_Click(object sender, EventArgs e)
- {
- if (this.listView2.Items.Count > 0)
- {
- SaveFileDialog exe = new SaveFileDialog();
- exe.Filter = "Execl files (*.xlsx)|*.xlsx";
- exe.FilterIndex = 0;
- exe.RestoreDirectory = true;
- //exe.CreatePrompt = true;
- exe.Title = "Export Excel File";
- exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + PdnResources.GetString("Menu.pointcountingmethod.Text");
- DialogResult dr = exe.ShowDialog();
- if (dr != DialogResult.OK)
- {
- return;
- }
- DataTable dtb = new DataTable();
- foreach (DataGridViewColumn c in this.dataGridView4.Columns)
- {
- dtb.Columns.Add(c.HeaderText);
- }
- for (int r = 0; r < this.dataGridView4.Rows.Count; r++)
- {
- DataRow dataRow = dtb.NewRow();
- for (int c = 0; c < this.dataGridView4.Rows[r].Cells.Count; c++)
- {
- dataRow[this.dataGridView4.Columns[c].HeaderText] = (string)this.dataGridView4.Rows[r].Cells[c].Value.ToString();
- }
- dtb.Rows.Add(dataRow);
- //this.dataGridView4.Rows[r].Cells[1].Attributes.Add("style", "vnd.ms-excel.numberformat:@");
- }
- List<DataTable> list = new List<DataTable>();
- list.Add(dtb);
- this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
- }
- else
- {
- MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
- }
- }
- /// <summary>
- /// 不可点击空白区域
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listView1_MouseUp(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Left)
- {
- if (listView1.SelectedItems.Count > 0)
- {
- }
- else if (listView1.SelectedItems.Count <= 0)//点击空白区
- {
- if (this.listView1.FocusedItem != null)
- {
- ListViewItem item = this.listView1.GetItemAt(e.X, e.Y);
- if (item == null)
- {
- this.listView1.FocusedItem.Selected = true;
- }
- }
- }
- }
- }
- /// <summary>
- /// 小数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
- {
- double percentage = 0;
- this.dataGridView1.Rows[i].Cells[4].Value = (Convert.ToInt32(this.dataGridView1.Rows[i].Cells[2].Value)
- + (double)(Convert.ToInt32(this.dataGridView1.Rows[i].Cells[3].Value) * 0.5));
- if (Convert.ToInt32(this.dataGridView1.Rows[i].Cells[1].Value) > 0)
- {
- percentage = (double)((Convert.ToInt32(this.dataGridView1.Rows[i].Cells[2].Value)
- + (double)(Convert.ToInt32(this.dataGridView1.Rows[i].Cells[3].Value) * 0.5))
- / Convert.ToInt32(this.dataGridView1.Rows[i].Cells[1].Value)) * 100;
- }
- this.dataGridView1.Rows[i].Cells[5].Value = Math.Round(percentage, Convert.ToInt32(this.numericUpDown1.Value));
- }
- RefreshDataGridView4();
- }
- /// <summary>
- /// 设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, getModelName());
- 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, getModelName());
- if (recombinationRateSetDialog.hasModule)
- {
- recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
- recombinationRateSetDialog.ShowDialog();
- }
- else
- {
- recombinationRateSetDialog = null;
- }
- }
- if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- List<List<string>> analysisContent = new List<List<string>>();
- for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
- {
- List<string> content1 = new List<string>();
- if (i == 0)
- {
- content1.Add(this.dataGridView4.Columns[0].HeaderText);
- content1.Add(this.dataGridView4.Columns[1].HeaderText);
- content1.Add(this.dataGridView4.Columns[2].HeaderText);
- content1.Add(this.dataGridView4.Columns[3].HeaderText);
- content1.Add(this.dataGridView4.Columns[4].HeaderText);
- content1.Add(this.dataGridView4.Columns[5].HeaderText);
- content1.Add(this.dataGridView4.Columns[6].HeaderText);
- 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());
- 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 checkBox6_CheckedChanged(object sender, EventArgs e)
- {
- if (autoCheck)
- {
- autoCheck = false;
- return;
- }
- refreshRectangleFs(null, null);
- }
- /// <summary>
- /// 更新自动添加的截点信息 //#21005
- /// </summary>
- private void refreshRectangleFs(object sender, EventArgs e)
- {
- if (this.dataGridView1.SelectedCells.Count > 0)
- {
- check1Dic[this.dataGridView1.SelectedCells[0].RowIndex] = this.checkBox6.Checked;
- }
- if(this.checkBox6.Checked)
- {
- if (this.dataGridView1.SelectedCells.Count > 0)
- {
- if (this.p1RectangleFs.Count > 0)
- p1RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Clear();
- if (this.p2RectangleFs.Count > 0)
- p2RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Clear();
- }
- if (this.button6.Visible)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!");
- this.checkBox6.Checked = false;
- return;
- }
- if (this.documentWorkspace.phaseModels.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseperformbinarizationoperationfirst.text")+"!");
- this.checkBox6.Checked = false;
- return;
- }
- if (this.dataGridView1.SelectedCells.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectatype,ifnot,pleaseaddatype.text")+"!");
- this.checkBox6.Checked = false;
- return;
- }
- GetNumberOfGrains();
- this.saveSuccess = true;
- this.documentWorkspace.Refresh();
- if (this.p1RectangleFs.Count > 0)
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[2].Value = p1RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count;
- else
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[2].Value = 0;
- if (this.p2RectangleFs.Count > 0)
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[3].Value = p2RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count;
- else
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[3].Value = 0;
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[1].Value) > 0)
- {
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[4].Value = (Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[2].Value)
- + (double)(Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[3].Value) * 0.5));
- percentage = (double)((Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[2].Value)
- + (double)(Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[3].Value) * 0.5))
- / Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[1].Value)) * 100;
- }
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[5].Value = Math.Round(percentage, Convert.ToInt32(this.numericUpDown1.Value));
- }
- else
- {
- if (this.dataGridView1.SelectedCells.Count > 0)
- {
- if (this.p1RectangleFs.Count > 0)
- p1RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Clear();
- if (this.p2RectangleFs.Count > 0)
- p2RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Clear();
- this.documentWorkspace.Refresh();
- if (this.p1RectangleFs.Count > 0)
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[2].Value = p1RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count;
- else
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[2].Value = 0;
- if (this.p2RectangleFs.Count > 0)
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[3].Value = p2RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count;
- else
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[3].Value = 0;
- double percentage = 0;
- if (Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[1].Value) > 0)
- {
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[4].Value = (Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[2].Value)
- + (double)(Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[3].Value) * 0.5));
- percentage = (double)((Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[2].Value)
- + (double)(Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[3].Value) * 0.5))
- / Convert.ToInt32(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[1].Value)) * 100;
- }
- this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[5].Value = Math.Round(percentage, Convert.ToInt32(this.numericUpDown1.Value));
- }
- }
- }
- private void GetNumberOfGrains()
- {
- this.p1RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Clear();
- this.p2RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Clear();
- Mat OriginalPicture = new Mat();
- if (bcBinaryChecked() && this.documentWorkspace.PhaseModels[0].mat != null)
- this.documentWorkspace.PhaseModels[0].mat.CopyTo(OriginalPicture);
- else
- mat.CopyTo(OriginalPicture);
- if (bcBinaryChecked() && this.documentWorkspace.PhaseModels[0].mat != null)
- this.documentWorkspace.PhaseModels[0].mat.CopyTo(OriginalPicture);
- foreach (var rectangleF in this.rectangleFs)
- {
- PointF center = new PointF(rectangleF.X + rectangleF.Width / 2, rectangleF.Y + rectangleF.Height / 2);
- 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 (bcBinaryChecked() && 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)
- p1RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(new RectangleF(rectangleF.X + (float)rectangleF.Width / 2 - (float)(Convert.ToInt32(this.txt_LeftSize.Text) / 2)
- , rectangleF.Y + (float)rectangleF.Height / 2 - (float)(Convert.ToInt32(this.txt_LeftSize.Text) / 2)
- , Convert.ToInt32(this.txt_LeftSize.Text), Convert.ToInt32(this.txt_LeftSize.Text)));
- else
- p2RectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(new RectangleF(rectangleF.X + (float)rectangleF.Width / 2 - (float)(Convert.ToInt32(this.txt_RightSize.Text) / 2)
- , rectangleF.Y + (float)rectangleF.Height / 2 - (float)(Convert.ToInt32(this.txt_RightSize.Text) / 2)
- , Convert.ToInt32(this.txt_RightSize.Text), Convert.ToInt32(this.txt_RightSize.Text)));
- }
- }
- }
- /// <summary>
- /// 显示网格
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox4_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 显示截点
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox5_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 导出项目
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button9_Click(object sender, EventArgs e)
- {
- if (this.checkBox3.Checked)
- {
- AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, getModelName());
- if (recombinationRateSetDialog.hasModule)
- {
- recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
- recombinationRateSetDialog.ShowDialog();
- }
- else
- {
- recombinationRateSetDialog = null;
- }
- }
- if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
- {
- Instrument.ProjectEngineering.NodeItem nodeItem = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.GrainSize.Text", this.analyzeSettingModel.savePath);
- if (nodeItem == null) return;
- //获取word书签与excel单元格的关系,以字典方式存储
- List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
- Dictionary<string, string> tagInfos = new Dictionary<string, string>();
- if (mic_module_infos != null && mic_module_infos.Count > 0)
- {
- foreach (mic_module_infos info in mic_module_infos)
- {
- tagInfos.Add(info.tag_name, info.cell_position);
- }
- }
- List<List<string>> analysisContent = new List<List<string>>();
- for (int i = 0; i < this.dataGridView4.Rows.Count; i++)
- {
- List<string> content1 = new List<string>();
- if (i == 0)
- {
- content1.Add(this.dataGridView4.Columns[0].HeaderText);
- content1.Add(this.dataGridView4.Columns[1].HeaderText);
- content1.Add(this.dataGridView4.Columns[2].HeaderText);
- content1.Add(this.dataGridView4.Columns[3].HeaderText);
- content1.Add(this.dataGridView4.Columns[4].HeaderText);
- content1.Add(this.dataGridView4.Columns[5].HeaderText);
- content1.Add(this.dataGridView4.Columns[6].HeaderText);
- 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());
- analysisContent.Add(content1);
- }
- //中间数据1
- List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
- bitList = new List<Bitmap>();
- if (this.allShow)
- {
- //中间数据2
- foreach (ExportProjectModel model in this.tempDataModel)
- {
- ExportProjectModel tempModel = new ExportProjectModel();
- tempModel.tagName = model.tagName;
- tempModel.picName = model.picName;
- tempModel.dataList = model.dataList;
- exportModel.Add(tempModel);
- }
- 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)
- {
- //中间数据2
- foreach (ListViewItem rowItem in this.listView2.SelectedItems)
- {
- foreach (ExportProjectModel model in this.tempDataModel)
- {
- if (model.tagName.Equals(rowItem.Tag.ToString()))
- {
- ExportProjectModel tempModel = new ExportProjectModel();
- tempModel.tagName = model.tagName;
- tempModel.picName = model.picName;
- tempModel.dataList = model.dataList;
- exportModel.Add(tempModel);
- break;
- }
- }
- }
- 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]);
- }
- }
- }
- else if (this.listView2.Items.Count > 0)
- {
- //中间数据2
- ListViewItem rowItem = this.listView2.Items[0];
- {
- foreach (ExportProjectModel model in this.tempDataModel)
- {
- if (model.tagName.Equals(rowItem.Tag.ToString()))
- {
- ExportProjectModel tempModel = new ExportProjectModel();
- tempModel.tagName = model.tagName;
- tempModel.picName = model.picName;
- tempModel.dataList = model.dataList;
- exportModel.Add(tempModel);
- break;
- }
- }
- }
- ListViewItem item = this.listView2.Items[0];
- {
- if (bitDic.ContainsKey(item.Tag.ToString()))
- {
- bitList.Add(bitDic[item.Tag.ToString()][0]);
- bitList.Add(bitDic[item.Tag.ToString()][1]);
- }
- }
- }
- }
- //中间数据3
- this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, nodeItem.path, nodeItem.code);
- //保存项目信息到数据库
- this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, nodeItem);
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
- }
- #region 内部类
- internal class LocalListViewItem
- {
- public DocumentWorkspace Value { get; }
- public string Display { get; }
- public LocalListViewItem(DocumentWorkspace Value, string Display)
- {
- this.Value = Value;
- this.Display = Display;
- }
- }
- 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;
- }
- }
- #endregion
- /// <summary>
- /// 应用到全部
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button_ApplyToAll_Click(object sender, EventArgs e)
- {
- if (this.selectPicture < 0)
- return;
- this.saveDialogParamValues(this.imageList1.Images.Keys[this.selectPicture].ToString());
- binaryClass.saveParams();
- binaryClass.applyToAll(this.imageList1.Images.Keys, this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]);
- for (int i = 0; i < listView1.Items.Count; i++)
- {
- if (!this.analysisDict.ContainsKey(this.imageList1.Images.Keys[i]))
- this.analysisDict.Add(this.imageList1.Images.Keys[i], this.analysisDict[getCurrentWorkTag()].cloneListParamModel(this.menuId));
- else
- this.analysisDict[this.imageList1.Images.Keys[i]] = this.analysisDict[getCurrentWorkTag()].cloneListParamModel(this.menuId);
- this.listView1.EnsureVisible(i);
- this.listView1.Items[i].Focused = true;
- this.listView1.Items[i].Selected = true;
- }
- }
- #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 "selectedGrid":
- value = this.comboBox1.SelectedIndex;
- break;
- case "point1Rectangle":
- value = this.rb_LeftCircle.Checked ? 1 : 2;
- break;
- case "point1Style":
- value = this.rb_leftFill.Checked ? 1 : 2;
- break;
- case "point1Size":
- value = this.txt_LeftSize.Text;
- break;
- case "point1LineWidth":
- value = this.txt_LeftLineWeight.Text;
- break;
- case "point1LineColor":
- value = this.panel1.BackColor.ToArgb();
- break;
- case "point05Rectangle":
- value = this.rb_RightCircle.Checked ? 1 : 2;
- break;
- case "point05Style":
- value = this.rb_RightFill.Checked ? 1 : 2;
- break;
- case "point05Size":
- value = this.txt_RightSize.Text;
- break;
- case "point05LineWidth":
- value = this.txt_RightLineWeight.Text;
- break;
- case "point05LineColor":
- value = this.panel2.BackColor.ToArgb();
- break;
- case "CalculatorDecimalDigits":
- value = this.numericUpDown1.Value;
- break;
- case "OpenWhileExportReport":
- value = this.checkBox3.Checked;
- break;
- case "ExportResults":
- value = false;
- break;
- case "ExportReports":
- value = false;
- break;
- case "ExportProjects":
- value = false;
- break;
- }
- return value;
- }
- #endregion
- }
- }
|