MetallographicMethod1077Dialog.cs 206 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103
  1. using Metis.ParameterSet;
  2. using OpenCvSharp.Extensions;
  3. using PaintDotNet.Base;
  4. using PaintDotNet.Base.CommTool;
  5. using PaintDotNet.Base.Functionodel;
  6. using PaintDotNet.CustomControl;
  7. using PaintDotNet.Data.Param;
  8. using PaintDotNet.DbOpreate.DbBll;
  9. using PaintDotNet.DbOpreate.DbModel;
  10. using PaintDotNet.Instrument;
  11. using System;
  12. using System.Collections.Generic;
  13. using System.ComponentModel;
  14. using System.Data;
  15. using System.Data.Entity.Migrations.Infrastructure;
  16. using System.Diagnostics.Contracts;
  17. using System.Drawing;
  18. using System.Drawing.Drawing2D;
  19. using System.IO;
  20. using System.Linq;
  21. using System.Text;
  22. using System.Threading.Tasks;
  23. using System.Windows.Forms;
  24. namespace PaintDotNet.DedicatedAnalysis.SteelDecarburization.ASTME_1077_2014
  25. {
  26. /// <summary>
  27. /// 金相法
  28. /// </summary>
  29. internal class MetallographicMethod1077Dialog : PdnBaseForm
  30. {
  31. #region 基础控件
  32. private Button button1;
  33. private CheckBox checkBox1;
  34. private Button button2;
  35. private GroupBox groupBox2;
  36. private ListView listView1;
  37. private GroupBox groupBox3;
  38. private GroupBox groupBox4;
  39. private Button button5;
  40. private Button button4;
  41. private Button button3;
  42. private GroupBox groupBox5;
  43. private TextBox textBox2;
  44. private TextBox textBox1;
  45. private Label label2;
  46. private Label label1;
  47. private GroupBox groupBox6;
  48. private Panel panel1;
  49. private Label label4;
  50. private Label label3;
  51. private Panel panel5;
  52. private Panel panel4;
  53. private Panel panel3;
  54. private Panel panel2;
  55. private GroupBox groupBox7;
  56. private CheckBox checkBox3;
  57. private CheckBox checkBox2;
  58. private GroupBox groupBox8;
  59. private DataGridView dataGridView1;
  60. private GroupBox groupBox9;
  61. private Button button6;
  62. private Button button7;
  63. private ListView listView2;
  64. private DataGridView dataGridView2;
  65. private Button button9;
  66. private Button button8;
  67. private NumericUpDown numericUpDown1;
  68. private Label label8;
  69. private Label label9;
  70. private Label label10;
  71. private ImageList imageList1;
  72. private IContainer components;
  73. private GroupBox groupBox1;
  74. private TrackBar trackBar1;
  75. private TrackBar trackBar2;
  76. private Panel panel6;
  77. private DataGridViewTextBoxColumn Column10;
  78. private DataGridViewTextBoxColumn Column11;
  79. private DataGridViewTextBoxColumn Column12;
  80. private DataGridViewTextBoxColumn Column13;
  81. private DataGridViewTextBoxColumn Column14;
  82. private DataGridViewTextBoxColumn Column15;
  83. private DataGridViewTextBoxColumn Column19;
  84. private DataGridViewTextBoxColumn Column16;
  85. private DataGridViewTextBoxColumn Column17;
  86. private DataGridViewTextBoxColumn Column18;
  87. private Button button10;
  88. #endregion
  89. /// <summary>
  90. /// 调色板
  91. /// </summary>
  92. PaintDotNet.ColorsForm colorsForm1;
  93. PaintDotNet.ColorsForm colorsForm2;
  94. PaintDotNet.ColorsForm colorsForm3;
  95. PaintDotNet.ColorsForm colorsForm4;
  96. PaintDotNet.ColorsForm colorsForm5;
  97. PaintDotNet.ColorsForm colorsForm6;
  98. /// <summary>
  99. /// 主控件
  100. /// </summary>
  101. private AppWorkspace appWorkspace;
  102. /// <summary>
  103. /// 图像面板
  104. /// </summary>
  105. private DocumentWorkspaceWindow documentWorkspace;
  106. /// <summary>
  107. /// 公共按钮
  108. /// </summary>
  109. private CommonControlButtons commonControlButtons;
  110. /// <summary>
  111. /// 0:添加 1:选择 2:删除
  112. /// </summary>
  113. private int operationK = -1;
  114. /// <summary>
  115. /// 被选择的线
  116. /// </summary>
  117. private int selected = -1;
  118. /// <summary>
  119. /// 起止点
  120. /// </summary>
  121. private System.Drawing.PointF startPoint, endPoint;
  122. /// <summary>
  123. /// 存储所有线的点集合
  124. /// </summary>
  125. private List<PointF[]> pointList = new List<PointF[]>();
  126. /// <summary>
  127. /// 测量点
  128. /// </summary>
  129. public List<RectangleF> rectangleFList = new List<RectangleF>();
  130. /// <summary>
  131. /// 存储当前线的点集合
  132. /// </summary>
  133. private PointF[] nowLine;
  134. /// <summary>
  135. /// 线的总数
  136. /// </summary>
  137. private int lineCount = 0;
  138. /// <summary>
  139. /// 计算结果的表格集合
  140. /// </summary>
  141. private List<DataTable> resultTableList = new List<DataTable>();
  142. /// <summary>
  143. /// 保存用于生成报告的图片
  144. /// </summary>
  145. private List<Bitmap> bitList;
  146. /// <summary>
  147. /// 储存点击保存结果后的所有原图与分析图
  148. /// </summary>
  149. private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();
  150. /// <summary>
  151. /// 是否显示全部
  152. /// </summary>
  153. private bool showAll = false;
  154. /// <summary>
  155. /// 辅助计算偏移量-移动线两端的点
  156. /// </summary>
  157. private PointF lastPoint = new PointF(0, 0);
  158. /// <summary>
  159. /// 辅助计算偏移量-移动线中间的点
  160. /// </summary>
  161. private PointF tempPoint = new PointF(0, 0);
  162. /// <summary>
  163. /// 判断图形是否可移动
  164. /// </summary>
  165. private bool canMove = false;
  166. /// <summary>
  167. /// 移动线上的哪一个点
  168. /// </summary>
  169. private int movePointIndex = -1;
  170. /// <summary>
  171. /// 点击次数
  172. /// </summary>
  173. private int clickCount = 0;
  174. /// <summary>
  175. /// 单位标尺
  176. /// </summary>
  177. private double unitLength = 1;
  178. private CheckBox checkBox7;
  179. private CheckBox checkBox6;
  180. private CheckBox checkBox5;
  181. private CheckBox checkBox4;
  182. private DataGridViewTextBoxColumn Column1;
  183. private DataGridViewTextBoxColumn Column2;
  184. private DataGridViewTextBoxColumn Column3;
  185. private DataGridViewTextBoxColumn Column4;
  186. private DataGridViewTextBoxColumn Column5;
  187. private DataGridViewTextBoxColumn Column9;
  188. private DataGridViewTextBoxColumn Column6;
  189. private DataGridViewTextBoxColumn Column7;
  190. private DataGridViewTextBoxColumn Column8;
  191. /// <summary>
  192. /// 中间数据
  193. /// </summary>
  194. private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();
  195. private int defaultIndex = -1;
  196. private int menuId;
  197. private string menuName;
  198. /// <summary>
  199. /// 是否脚本运行
  200. /// </summary>
  201. private Boolean initScriptValues = false;
  202. /// <summary>
  203. /// 保存窗口参数
  204. /// </summary>
  205. private GrainSizeAnalysisModel analysisModel;
  206. private const string ParamKey_Report = "report";//报告设置
  207. private const string ParamKey_LineLength = "lineLength";//线长
  208. private const string ParamKey_LineWidth = "lineWidth";//线宽
  209. private const string ParamKey_Baseline = "baseline";//基准线
  210. private const string ParamKey_Surface = "surface";//钢样表面
  211. private const string ParamKey_Free = "free";//自由
  212. private const string ParamKey_FreeColour = "freeColour";//自由颜色
  213. private const string ParamKey_Whole = "whole";//完全
  214. private const string ParamKey_WholeColour = "wholeColour";//完全颜色
  215. private const string ParamKey_Valid = "valid";//有效
  216. private const string ParamKey_ValidColour = "validColour";//有效颜色
  217. private const string ParamKey_Part = "part";//部分
  218. private const string ParamKey_PartColour = "partColour";//部分颜色
  219. private const string ParamKey_WholeGauge = "wholeGauge";//完全测量
  220. private const string ParamKey_ValidGauge = "validGauge";//有效测量
  221. private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数
  222. public MetallographicMethod1077Dialog(AppWorkspace appWorkspace, PdnMenuItem menuItem)
  223. {
  224. this.menuId = menuItem.MenuId;
  225. this.menuName = menuItem.Text;
  226. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  227. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  228. this.analysisModel = analysisModelXml.cloneListParamModel(this.menuId);
  229. foreach (var item in this.analysisModel.ListParam)
  230. item.setValue();
  231. this.appWorkspace = appWorkspace;
  232. InitializeComponent();
  233. InitializeLanguageText();
  234. InitGridHeader();
  235. InitOtherTools();
  236. //如果是脚本执行,将参数带入
  237. if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)
  238. {
  239. this.initScriptValues = true;//ScriptAutomatic
  240. //Boolean initScriptValues = true;
  241. ////在这里反射出对应功能的参数类
  242. string className = InvariantData.path_Action + ".Action" + menuId;
  243. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  244. foreach (Args arg in param.Lists)
  245. {
  246. Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));
  247. if (param1.value != null)
  248. arg.Value = param1.value;
  249. getValue(arg.key, arg.Value);
  250. }
  251. appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
  252. }
  253. else
  254. {//读取上次关闭窗口时保存的参数
  255. GetListParamModel();
  256. }
  257. InitPicList();
  258. InitCommonButtonEvent();
  259. AddPictureBoxEvent();
  260. SetAnalyzeModelFromXml("Template.Manager.item3.MetallographicMethod1077");
  261. }
  262. private void ShowImgEvent(object sender, EventArgs e)
  263. {
  264. listView1.Focus();
  265. if (this.defaultIndex != -1)
  266. {
  267. this.listView1.Items[defaultIndex].Focused = true;
  268. this.listView1.Items[defaultIndex].Selected = true;
  269. }
  270. }
  271. private void InitializeLanguageText()
  272. {
  273. this.button10.Text = PdnResources.GetString("Menu.Exportproject.text");
  274. this.groupBox9.Text = PdnResources.GetString("Menu.Analysisresult.text");
  275. this.Column8.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.iondepth.text");
  276. this.Column7.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Meanfreeferritedepth.text");
  277. this.Column6.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Averagedezationlayer.text");
  278. this.Column9.HeaderText = PdnResources.GetString("Menu.Freeferritedepth.text");
  279. this.Column5.HeaderText = PdnResources.GetString("Menu.Totaldecarburizationlayer.text");
  280. this.Column4.HeaderText = PdnResources.GetString("Menu.Partiallydecarburizedlayer.text");
  281. this.Column3.HeaderText = PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text");
  282. this.Column2.HeaderText = PdnResources.GetString("Menu.Completelydecarburizedlayer.text");
  283. this.Column1.HeaderText = PdnResources.GetString("Menu.packet.text");
  284. this.groupBox8.Text = PdnResources.GetString("Menu.datapresentation.text");
  285. this.checkBox2.Text = PdnResources.GetString("Menu.Completelydecarburizedlayer.text");
  286. this.checkBox3.Text = PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text");
  287. this.groupBox7.Text = PdnResources.GetString("Menu.Measurementlayerselection.text");
  288. this.label3.Text = PdnResources.GetString("Menu.Baseline.text") + ":";
  289. this.label4.Text = PdnResources.GetString("Menu.Steelsamplesurface.text") + ":";
  290. this.checkBox4.Text = PdnResources.GetString("Menu.Completelydecarburizedlayer.text") + ":";
  291. this.checkBox5.Text = PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text") + ":";
  292. this.checkBox6.Text = PdnResources.GetString("Menu.Partiallydecarburizedlayer.text") + ":";
  293. this.checkBox7.Text = PdnResources.GetString("Menu.Freeferritedepth.text") + ":";
  294. this.groupBox6.Text = PdnResources.GetString("Menu.Colorsetting.text");
  295. this.label1.Text = PdnResources.GetString("Menu.Linelength.text") + ":";
  296. this.label2.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";
  297. this.groupBox5.Text = PdnResources.GetString("Menu.Basicsettingsofmeasuringline.text");
  298. this.button3.Text = PdnResources.GetString("Menu.Addmeasuringline.text");
  299. this.button4.Text = PdnResources.GetString("Menu.Selectmeasurementline.text");
  300. this.button5.Text = PdnResources.GetString("Menu.Deletemeasurementline.text");
  301. this.groupBox4.Text = PdnResources.GetString("Menu.Measurementbaseline.text");
  302. this.groupBox3.Text = PdnResources.GetString("Menu.Preview.text");
  303. this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
  304. this.button1.Text = PdnResources.GetString("Menu.Setting.Text");
  305. this.checkBox1.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");
  306. this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");
  307. this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
  308. this.Text = "ASTM E1077-2001(" + PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Metallographicmethod.text") + ")";
  309. this.button6.Text = PdnResources.GetString("Menu.Showall.text");
  310. this.button7.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
  311. this.Column18.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.iondepth.text");
  312. this.Column17.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Meanfreeferritedepth.text");
  313. this.Column16.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Averagedezationlayer.text");
  314. this.Column19.HeaderText = PdnResources.GetString("Menu.Freeferritedepth.text");
  315. this.Column15.HeaderText = PdnResources.GetString("Menu.Totaldecarburizationlayer.text");
  316. this.Column14.HeaderText = PdnResources.GetString("Menu.Partiallydecarburizedlayer.text");
  317. this.Column13.HeaderText = PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text");
  318. this.Column12.HeaderText = PdnResources.GetString("Menu.Completelydecarburizedlayer.text");
  319. this.Column11.HeaderText = PdnResources.GetString("Menu.packet.text");
  320. this.Column10.HeaderText = PdnResources.GetString("Menu.picture.Text");
  321. this.button8.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
  322. this.button9.Text = PdnResources.GetString("Menu.Exportresults.text");
  323. this.label8.Text = PdnResources.GetString("Menu.Decimal.text") + ":";
  324. }
  325. private void InitializeComponent()
  326. {
  327. this.components = new System.ComponentModel.Container();
  328. this.groupBox1 = new System.Windows.Forms.GroupBox();
  329. this.button2 = new System.Windows.Forms.Button();
  330. this.checkBox1 = new System.Windows.Forms.CheckBox();
  331. this.button1 = new System.Windows.Forms.Button();
  332. this.groupBox2 = new System.Windows.Forms.GroupBox();
  333. this.listView1 = new System.Windows.Forms.ListView();
  334. this.imageList1 = new System.Windows.Forms.ImageList(this.components);
  335. this.groupBox3 = new System.Windows.Forms.GroupBox();
  336. this.groupBox4 = new System.Windows.Forms.GroupBox();
  337. this.button5 = new System.Windows.Forms.Button();
  338. this.button4 = new System.Windows.Forms.Button();
  339. this.button3 = new System.Windows.Forms.Button();
  340. this.groupBox5 = new System.Windows.Forms.GroupBox();
  341. this.trackBar2 = new System.Windows.Forms.TrackBar();
  342. this.trackBar1 = new System.Windows.Forms.TrackBar();
  343. this.textBox2 = new System.Windows.Forms.TextBox();
  344. this.textBox1 = new System.Windows.Forms.TextBox();
  345. this.label2 = new System.Windows.Forms.Label();
  346. this.label1 = new System.Windows.Forms.Label();
  347. this.groupBox6 = new System.Windows.Forms.GroupBox();
  348. this.checkBox7 = new System.Windows.Forms.CheckBox();
  349. this.checkBox6 = new System.Windows.Forms.CheckBox();
  350. this.checkBox5 = new System.Windows.Forms.CheckBox();
  351. this.checkBox4 = new System.Windows.Forms.CheckBox();
  352. this.panel6 = new System.Windows.Forms.Panel();
  353. this.panel5 = new System.Windows.Forms.Panel();
  354. this.panel4 = new System.Windows.Forms.Panel();
  355. this.panel3 = new System.Windows.Forms.Panel();
  356. this.panel2 = new System.Windows.Forms.Panel();
  357. this.panel1 = new System.Windows.Forms.Panel();
  358. this.label4 = new System.Windows.Forms.Label();
  359. this.label3 = new System.Windows.Forms.Label();
  360. this.groupBox7 = new System.Windows.Forms.GroupBox();
  361. this.checkBox3 = new System.Windows.Forms.CheckBox();
  362. this.checkBox2 = new System.Windows.Forms.CheckBox();
  363. this.groupBox8 = new System.Windows.Forms.GroupBox();
  364. this.dataGridView1 = new System.Windows.Forms.DataGridView();
  365. this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  366. this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  367. this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  368. this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  369. this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  370. this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  371. this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  372. this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  373. this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  374. this.groupBox9 = new System.Windows.Forms.GroupBox();
  375. this.button10 = new System.Windows.Forms.Button();
  376. this.label10 = new System.Windows.Forms.Label();
  377. this.label9 = new System.Windows.Forms.Label();
  378. this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
  379. this.label8 = new System.Windows.Forms.Label();
  380. this.button9 = new System.Windows.Forms.Button();
  381. this.button8 = new System.Windows.Forms.Button();
  382. this.dataGridView2 = new System.Windows.Forms.DataGridView();
  383. this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  384. this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  385. this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  386. this.Column13 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  387. this.Column14 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  388. this.Column15 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  389. this.Column19 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  390. this.Column16 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  391. this.Column17 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  392. this.Column18 = new System.Windows.Forms.DataGridViewTextBoxColumn();
  393. this.listView2 = new System.Windows.Forms.ListView();
  394. this.button7 = new System.Windows.Forms.Button();
  395. this.button6 = new System.Windows.Forms.Button();
  396. this.groupBox1.SuspendLayout();
  397. this.groupBox2.SuspendLayout();
  398. this.groupBox4.SuspendLayout();
  399. this.groupBox5.SuspendLayout();
  400. ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();
  401. ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
  402. this.groupBox6.SuspendLayout();
  403. this.groupBox7.SuspendLayout();
  404. this.groupBox8.SuspendLayout();
  405. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
  406. this.groupBox9.SuspendLayout();
  407. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
  408. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
  409. this.SuspendLayout();
  410. //
  411. // groupBox1
  412. //
  413. this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
  414. | System.Windows.Forms.AnchorStyles.Right)));
  415. this.groupBox1.Controls.Add(this.button2);
  416. this.groupBox1.Controls.Add(this.checkBox1);
  417. this.groupBox1.Controls.Add(this.button1);
  418. this.groupBox1.Location = new System.Drawing.Point(14, 3);
  419. this.groupBox1.Name = "groupBox1";
  420. this.groupBox1.Size = new System.Drawing.Size(1081, 50);
  421. this.groupBox1.TabIndex = 1;
  422. this.groupBox1.TabStop = false;
  423. //
  424. // button2
  425. //
  426. this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  427. | System.Windows.Forms.AnchorStyles.Right)));
  428. this.button2.Location = new System.Drawing.Point(985, 14);
  429. this.button2.Name = "button2";
  430. this.button2.Size = new System.Drawing.Size(84, 30);
  431. this.button2.TabIndex = 2;
  432. this.button2.UseVisualStyleBackColor = true;
  433. this.button2.Click += new System.EventHandler(this.button2_Click);
  434. //
  435. // checkBox1
  436. //
  437. this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  438. | System.Windows.Forms.AnchorStyles.Left)));
  439. this.checkBox1.AutoSize = true;
  440. this.checkBox1.Location = new System.Drawing.Point(141, 21);
  441. this.checkBox1.Name = "checkBox1";
  442. this.checkBox1.Size = new System.Drawing.Size(15, 14);
  443. this.checkBox1.TabIndex = 1;
  444. this.checkBox1.UseVisualStyleBackColor = true;
  445. //
  446. // button1
  447. //
  448. this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  449. | System.Windows.Forms.AnchorStyles.Left)));
  450. this.button1.Location = new System.Drawing.Point(15, 14);
  451. this.button1.Name = "button1";
  452. this.button1.Size = new System.Drawing.Size(84, 30);
  453. this.button1.TabIndex = 0;
  454. this.button1.UseVisualStyleBackColor = true;
  455. this.button1.Click += new System.EventHandler(this.button1_Click);
  456. //
  457. // groupBox2
  458. //
  459. this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  460. | System.Windows.Forms.AnchorStyles.Left)));
  461. this.groupBox2.Controls.Add(this.listView1);
  462. this.groupBox2.Location = new System.Drawing.Point(14, 60);
  463. this.groupBox2.Name = "groupBox2";
  464. this.groupBox2.Size = new System.Drawing.Size(135, 497);
  465. this.groupBox2.TabIndex = 2;
  466. this.groupBox2.TabStop = false;
  467. //
  468. // listView1
  469. //
  470. this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  471. | System.Windows.Forms.AnchorStyles.Left)
  472. | System.Windows.Forms.AnchorStyles.Right)));
  473. this.listView1.HideSelection = false;
  474. this.listView1.LargeImageList = this.imageList1;
  475. this.listView1.Location = new System.Drawing.Point(5, 17);
  476. this.listView1.MultiSelect = false;
  477. this.listView1.Name = "listView1";
  478. this.listView1.Size = new System.Drawing.Size(124, 474);
  479. this.listView1.TabIndex = 0;
  480. this.listView1.UseCompatibleStateImageBehavior = false;
  481. this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
  482. //
  483. // imageList1
  484. //
  485. this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
  486. this.imageList1.ImageSize = new System.Drawing.Size(64, 64);
  487. this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
  488. //
  489. // groupBox3
  490. //
  491. this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  492. | System.Windows.Forms.AnchorStyles.Left)
  493. | System.Windows.Forms.AnchorStyles.Right)));
  494. this.groupBox3.Location = new System.Drawing.Point(508, 60);
  495. this.groupBox3.Name = "groupBox3";
  496. this.groupBox3.Size = new System.Drawing.Size(580, 496);
  497. this.groupBox3.TabIndex = 3;
  498. this.groupBox3.TabStop = false;
  499. //
  500. // groupBox4
  501. //
  502. this.groupBox4.Controls.Add(this.button5);
  503. this.groupBox4.Controls.Add(this.button4);
  504. this.groupBox4.Controls.Add(this.button3);
  505. this.groupBox4.Location = new System.Drawing.Point(156, 60);
  506. this.groupBox4.Name = "groupBox4";
  507. this.groupBox4.Size = new System.Drawing.Size(353, 58);
  508. this.groupBox4.TabIndex = 4;
  509. this.groupBox4.TabStop = false;
  510. //
  511. // button5
  512. //
  513. this.button5.Location = new System.Drawing.Point(203, 20);
  514. this.button5.Name = "button5";
  515. this.button5.Size = new System.Drawing.Size(75, 23);
  516. this.button5.TabIndex = 2;
  517. this.button5.UseVisualStyleBackColor = true;
  518. this.button5.Click += new System.EventHandler(this.button5_Click);
  519. //
  520. // button4
  521. //
  522. this.button4.Location = new System.Drawing.Point(109, 20);
  523. this.button4.Name = "button4";
  524. this.button4.Size = new System.Drawing.Size(75, 23);
  525. this.button4.TabIndex = 1;
  526. this.button4.UseVisualStyleBackColor = true;
  527. this.button4.Click += new System.EventHandler(this.button4_Click);
  528. //
  529. // button3
  530. //
  531. this.button3.Location = new System.Drawing.Point(16, 20);
  532. this.button3.Name = "button3";
  533. this.button3.Size = new System.Drawing.Size(75, 23);
  534. this.button3.TabIndex = 0;
  535. this.button3.UseVisualStyleBackColor = true;
  536. this.button3.Click += new System.EventHandler(this.button3_Click);
  537. //
  538. // groupBox5
  539. //
  540. this.groupBox5.Controls.Add(this.trackBar2);
  541. this.groupBox5.Controls.Add(this.trackBar1);
  542. this.groupBox5.Controls.Add(this.textBox2);
  543. this.groupBox5.Controls.Add(this.textBox1);
  544. this.groupBox5.Controls.Add(this.label2);
  545. this.groupBox5.Controls.Add(this.label1);
  546. this.groupBox5.Location = new System.Drawing.Point(156, 125);
  547. this.groupBox5.Name = "groupBox5";
  548. this.groupBox5.Size = new System.Drawing.Size(353, 71);
  549. this.groupBox5.TabIndex = 5;
  550. this.groupBox5.TabStop = false;
  551. //
  552. // trackBar2
  553. //
  554. this.trackBar2.Cursor = System.Windows.Forms.Cursors.Hand;
  555. this.trackBar2.Location = new System.Drawing.Point(218, 24);
  556. this.trackBar2.Maximum = 50;
  557. this.trackBar2.Minimum = 1;
  558. this.trackBar2.Name = "trackBar2";
  559. this.trackBar2.Size = new System.Drawing.Size(85, 45);
  560. this.trackBar2.TabIndex = 5;
  561. this.trackBar2.TickStyle = System.Windows.Forms.TickStyle.None;
  562. this.trackBar2.Value = 3;
  563. this.trackBar2.Scroll += new System.EventHandler(this.trackBar2_Scroll);
  564. this.trackBar2.ValueChanged += new System.EventHandler(this.trackBar2_ValueChanged);
  565. //
  566. // trackBar1
  567. //
  568. this.trackBar1.Cursor = System.Windows.Forms.Cursors.Hand;
  569. this.trackBar1.Location = new System.Drawing.Point(42, 24);
  570. this.trackBar1.Maximum = 50;
  571. this.trackBar1.Minimum = 1;
  572. this.trackBar1.Name = "trackBar1";
  573. this.trackBar1.Size = new System.Drawing.Size(91, 45);
  574. this.trackBar1.TabIndex = 4;
  575. this.trackBar1.TickStyle = System.Windows.Forms.TickStyle.None;
  576. this.trackBar1.Value = 40;
  577. this.trackBar1.Scroll += new System.EventHandler(this.trackBar1_Scroll);
  578. this.trackBar1.ValueChanged += new System.EventHandler(this.trackBar1_ValueChanged);
  579. //
  580. // textBox2
  581. //
  582. this.textBox2.Location = new System.Drawing.Point(307, 24);
  583. this.textBox2.Name = "textBox2";
  584. this.textBox2.Size = new System.Drawing.Size(35, 21);
  585. this.textBox2.TabIndex = 3;
  586. this.textBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox2_KeyPress);
  587. this.textBox2.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox2_KeyUp);
  588. //
  589. // textBox1
  590. //
  591. this.textBox1.Location = new System.Drawing.Point(136, 24);
  592. this.textBox1.Name = "textBox1";
  593. this.textBox1.Size = new System.Drawing.Size(35, 21);
  594. this.textBox1.TabIndex = 2;
  595. this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
  596. this.textBox1.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox1_KeyUp);
  597. //
  598. // label2
  599. //
  600. this.label2.AutoSize = true;
  601. this.label2.Location = new System.Drawing.Point(183, 28);
  602. this.label2.Name = "label2";
  603. this.label2.Size = new System.Drawing.Size(0, 12);
  604. this.label2.TabIndex = 1;
  605. //
  606. // label1
  607. //
  608. this.label1.AutoSize = true;
  609. this.label1.Location = new System.Drawing.Point(12, 28);
  610. this.label1.Name = "label1";
  611. this.label1.Size = new System.Drawing.Size(0, 12);
  612. this.label1.TabIndex = 0;
  613. //
  614. // groupBox6
  615. //
  616. this.groupBox6.Controls.Add(this.checkBox7);
  617. this.groupBox6.Controls.Add(this.checkBox6);
  618. this.groupBox6.Controls.Add(this.checkBox5);
  619. this.groupBox6.Controls.Add(this.checkBox4);
  620. this.groupBox6.Controls.Add(this.panel6);
  621. this.groupBox6.Controls.Add(this.panel5);
  622. this.groupBox6.Controls.Add(this.panel4);
  623. this.groupBox6.Controls.Add(this.panel3);
  624. this.groupBox6.Controls.Add(this.panel2);
  625. this.groupBox6.Controls.Add(this.panel1);
  626. this.groupBox6.Controls.Add(this.label4);
  627. this.groupBox6.Controls.Add(this.label3);
  628. this.groupBox6.Location = new System.Drawing.Point(156, 202);
  629. this.groupBox6.Name = "groupBox6";
  630. this.groupBox6.Size = new System.Drawing.Size(354, 95);
  631. this.groupBox6.TabIndex = 6;
  632. this.groupBox6.TabStop = false;
  633. //
  634. // checkBox7
  635. //
  636. this.checkBox7.AutoSize = true;
  637. this.checkBox7.Location = new System.Drawing.Point(9, 68);
  638. this.checkBox7.Name = "checkBox7";
  639. this.checkBox7.Size = new System.Drawing.Size(15, 14);
  640. this.checkBox7.TabIndex = 14;
  641. this.checkBox7.UseVisualStyleBackColor = true;
  642. this.checkBox7.CheckedChanged += new System.EventHandler(this.checkBox7_CheckedChanged);
  643. //
  644. // checkBox6
  645. //
  646. this.checkBox6.AutoSize = true;
  647. this.checkBox6.Location = new System.Drawing.Point(174, 68);
  648. this.checkBox6.Name = "checkBox6";
  649. this.checkBox6.Size = new System.Drawing.Size(15, 14);
  650. this.checkBox6.TabIndex = 13;
  651. this.checkBox6.UseVisualStyleBackColor = true;
  652. this.checkBox6.CheckedChanged += new System.EventHandler(this.checkBox6_CheckedChanged);
  653. //
  654. // checkBox5
  655. //
  656. this.checkBox5.AutoSize = true;
  657. this.checkBox5.Location = new System.Drawing.Point(174, 46);
  658. this.checkBox5.Name = "checkBox5";
  659. this.checkBox5.Size = new System.Drawing.Size(15, 14);
  660. this.checkBox5.TabIndex = 12;
  661. this.checkBox5.UseVisualStyleBackColor = true;
  662. this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged);
  663. //
  664. // checkBox4
  665. //
  666. this.checkBox4.AutoSize = true;
  667. this.checkBox4.Location = new System.Drawing.Point(174, 23);
  668. this.checkBox4.Name = "checkBox4";
  669. this.checkBox4.Size = new System.Drawing.Size(15, 14);
  670. this.checkBox4.TabIndex = 11;
  671. this.checkBox4.UseVisualStyleBackColor = true;
  672. this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
  673. //
  674. // panel6
  675. //
  676. this.panel6.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  677. this.panel6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  678. this.panel6.Location = new System.Drawing.Point(130, 67);
  679. this.panel6.Name = "panel6";
  680. this.panel6.Size = new System.Drawing.Size(40, 18);
  681. this.panel6.TabIndex = 10;
  682. this.panel6.Click += new System.EventHandler(this.panel6_Click);
  683. //
  684. // panel5
  685. //
  686. this.panel5.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  687. this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  688. this.panel5.Location = new System.Drawing.Point(272, 67);
  689. this.panel5.Name = "panel5";
  690. this.panel5.Size = new System.Drawing.Size(75, 18);
  691. this.panel5.TabIndex = 8;
  692. this.panel5.Click += new System.EventHandler(this.panel5_Click);
  693. //
  694. // panel4
  695. //
  696. this.panel4.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  697. this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  698. this.panel4.Location = new System.Drawing.Point(272, 44);
  699. this.panel4.Name = "panel4";
  700. this.panel4.Size = new System.Drawing.Size(75, 18);
  701. this.panel4.TabIndex = 7;
  702. this.panel4.Click += new System.EventHandler(this.panel4_Click);
  703. //
  704. // panel3
  705. //
  706. this.panel3.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  707. this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  708. this.panel3.Location = new System.Drawing.Point(272, 21);
  709. this.panel3.Name = "panel3";
  710. this.panel3.Size = new System.Drawing.Size(75, 18);
  711. this.panel3.TabIndex = 6;
  712. this.panel3.Click += new System.EventHandler(this.panel3_Click);
  713. //
  714. // panel2
  715. //
  716. this.panel2.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  717. this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  718. this.panel2.Location = new System.Drawing.Point(95, 44);
  719. this.panel2.Name = "panel2";
  720. this.panel2.Size = new System.Drawing.Size(75, 18);
  721. this.panel2.TabIndex = 6;
  722. this.panel2.Click += new System.EventHandler(this.panel2_Click);
  723. //
  724. // panel1
  725. //
  726. this.panel1.BackColor = System.Drawing.SystemColors.ButtonHighlight;
  727. this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  728. this.panel1.Location = new System.Drawing.Point(95, 21);
  729. this.panel1.Name = "panel1";
  730. this.panel1.Size = new System.Drawing.Size(75, 18);
  731. this.panel1.TabIndex = 5;
  732. this.panel1.Click += new System.EventHandler(this.panel1_Click);
  733. //
  734. // label4
  735. //
  736. this.label4.AutoSize = true;
  737. this.label4.Location = new System.Drawing.Point(24, 47);
  738. this.label4.Name = "label4";
  739. this.label4.Size = new System.Drawing.Size(0, 12);
  740. this.label4.TabIndex = 1;
  741. //
  742. // label3
  743. //
  744. this.label3.AutoSize = true;
  745. this.label3.Location = new System.Drawing.Point(24, 24);
  746. this.label3.Name = "label3";
  747. this.label3.Size = new System.Drawing.Size(0, 12);
  748. this.label3.TabIndex = 0;
  749. //
  750. // groupBox7
  751. //
  752. this.groupBox7.Controls.Add(this.checkBox3);
  753. this.groupBox7.Controls.Add(this.checkBox2);
  754. this.groupBox7.Location = new System.Drawing.Point(156, 303);
  755. this.groupBox7.Name = "groupBox7";
  756. this.groupBox7.Size = new System.Drawing.Size(353, 58);
  757. this.groupBox7.TabIndex = 7;
  758. this.groupBox7.TabStop = false;
  759. //
  760. // checkBox3
  761. //
  762. this.checkBox3.AutoSize = true;
  763. this.checkBox3.Checked = true;
  764. this.checkBox3.CheckState = System.Windows.Forms.CheckState.Checked;
  765. this.checkBox3.Location = new System.Drawing.Point(142, 25);
  766. this.checkBox3.Name = "checkBox3";
  767. this.checkBox3.Size = new System.Drawing.Size(15, 14);
  768. this.checkBox3.TabIndex = 1;
  769. this.checkBox3.UseVisualStyleBackColor = true;
  770. this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
  771. //
  772. // checkBox2
  773. //
  774. this.checkBox2.AutoSize = true;
  775. this.checkBox2.Checked = true;
  776. this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
  777. this.checkBox2.Location = new System.Drawing.Point(26, 25);
  778. this.checkBox2.Name = "checkBox2";
  779. this.checkBox2.Size = new System.Drawing.Size(15, 14);
  780. this.checkBox2.TabIndex = 0;
  781. this.checkBox2.UseVisualStyleBackColor = true;
  782. this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
  783. //
  784. // groupBox8
  785. //
  786. this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  787. | System.Windows.Forms.AnchorStyles.Left)));
  788. this.groupBox8.Controls.Add(this.dataGridView1);
  789. this.groupBox8.Location = new System.Drawing.Point(155, 367);
  790. this.groupBox8.Name = "groupBox8";
  791. this.groupBox8.Size = new System.Drawing.Size(353, 189);
  792. this.groupBox8.TabIndex = 8;
  793. this.groupBox8.TabStop = false;
  794. //
  795. // dataGridView1
  796. //
  797. this.dataGridView1.AllowUserToAddRows = false;
  798. this.dataGridView1.AllowUserToDeleteRows = false;
  799. this.dataGridView1.AllowUserToResizeColumns = false;
  800. this.dataGridView1.AllowUserToResizeRows = false;
  801. this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  802. | System.Windows.Forms.AnchorStyles.Left)
  803. | System.Windows.Forms.AnchorStyles.Right)));
  804. this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  805. this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
  806. this.dataGridView1.ColumnHeadersHeight = 44;
  807. this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  808. this.Column1,
  809. this.Column2,
  810. this.Column3,
  811. this.Column4,
  812. this.Column5,
  813. this.Column9,
  814. this.Column6,
  815. this.Column7,
  816. this.Column8});
  817. this.dataGridView1.Location = new System.Drawing.Point(7, 21);
  818. this.dataGridView1.MultiSelect = false;
  819. this.dataGridView1.Name = "dataGridView1";
  820. this.dataGridView1.ReadOnly = true;
  821. this.dataGridView1.RowHeadersVisible = false;
  822. this.dataGridView1.RowTemplate.Height = 23;
  823. this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  824. this.dataGridView1.Size = new System.Drawing.Size(340, 162);
  825. this.dataGridView1.TabIndex = 0;
  826. //
  827. // Column1
  828. //
  829. this.Column1.FillWeight = 237.576F;
  830. this.Column1.HeaderText = "Column1";
  831. this.Column1.MinimumWidth = 75;
  832. this.Column1.Name = "Column1";
  833. this.Column1.ReadOnly = true;
  834. this.Column1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  835. this.Column1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  836. //
  837. // Column2
  838. //
  839. this.Column2.FillWeight = 301.5228F;
  840. this.Column2.HeaderText = "Column2";
  841. this.Column2.MinimumWidth = 75;
  842. this.Column2.Name = "Column2";
  843. this.Column2.ReadOnly = true;
  844. this.Column2.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  845. this.Column2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  846. //
  847. // Column3
  848. //
  849. this.Column3.FillWeight = 51.5573F;
  850. this.Column3.HeaderText = "Column3";
  851. this.Column3.MinimumWidth = 75;
  852. this.Column3.Name = "Column3";
  853. this.Column3.ReadOnly = true;
  854. this.Column3.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  855. this.Column3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  856. //
  857. // Column4
  858. //
  859. this.Column4.FillWeight = 51.5573F;
  860. this.Column4.HeaderText = "Column4";
  861. this.Column4.MinimumWidth = 75;
  862. this.Column4.Name = "Column4";
  863. this.Column4.ReadOnly = true;
  864. this.Column4.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  865. this.Column4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  866. //
  867. // Column5
  868. //
  869. this.Column5.FillWeight = 51.5573F;
  870. this.Column5.HeaderText = "Column5";
  871. this.Column5.MinimumWidth = 75;
  872. this.Column5.Name = "Column5";
  873. this.Column5.ReadOnly = true;
  874. this.Column5.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  875. this.Column5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  876. //
  877. // Column9
  878. //
  879. this.Column9.FillWeight = 51.5573F;
  880. this.Column9.HeaderText = "Column9";
  881. this.Column9.MinimumWidth = 75;
  882. this.Column9.Name = "Column9";
  883. this.Column9.ReadOnly = true;
  884. this.Column9.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  885. this.Column9.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  886. //
  887. // Column6
  888. //
  889. this.Column6.FillWeight = 51.5573F;
  890. this.Column6.HeaderText = "Column6";
  891. this.Column6.MinimumWidth = 75;
  892. this.Column6.Name = "Column6";
  893. this.Column6.ReadOnly = true;
  894. this.Column6.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  895. this.Column6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  896. //
  897. // Column7
  898. //
  899. this.Column7.FillWeight = 51.5573F;
  900. this.Column7.HeaderText = "Column7";
  901. this.Column7.MinimumWidth = 75;
  902. this.Column7.Name = "Column7";
  903. this.Column7.ReadOnly = true;
  904. this.Column7.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  905. this.Column7.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  906. //
  907. // Column8
  908. //
  909. this.Column8.FillWeight = 51.5573F;
  910. this.Column8.HeaderText = "Column8";
  911. this.Column8.MinimumWidth = 75;
  912. this.Column8.Name = "Column8";
  913. this.Column8.ReadOnly = true;
  914. this.Column8.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  915. this.Column8.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  916. //
  917. // groupBox9
  918. //
  919. this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
  920. | System.Windows.Forms.AnchorStyles.Right)));
  921. this.groupBox9.Controls.Add(this.button10);
  922. this.groupBox9.Controls.Add(this.label10);
  923. this.groupBox9.Controls.Add(this.label9);
  924. this.groupBox9.Controls.Add(this.numericUpDown1);
  925. this.groupBox9.Controls.Add(this.label8);
  926. this.groupBox9.Controls.Add(this.button9);
  927. this.groupBox9.Controls.Add(this.button8);
  928. this.groupBox9.Controls.Add(this.dataGridView2);
  929. this.groupBox9.Controls.Add(this.listView2);
  930. this.groupBox9.Controls.Add(this.button7);
  931. this.groupBox9.Controls.Add(this.button6);
  932. this.groupBox9.Location = new System.Drawing.Point(14, 562);
  933. this.groupBox9.Name = "groupBox9";
  934. this.groupBox9.Size = new System.Drawing.Size(1081, 204);
  935. this.groupBox9.TabIndex = 9;
  936. this.groupBox9.TabStop = false;
  937. //
  938. // button10
  939. //
  940. this.button10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  941. this.button10.Location = new System.Drawing.Point(941, 102);
  942. this.button10.Name = "button10";
  943. this.button10.Size = new System.Drawing.Size(128, 26);
  944. this.button10.TabIndex = 10;
  945. this.button10.UseVisualStyleBackColor = true;
  946. this.button10.Click += new System.EventHandler(this.button10_Click);
  947. //
  948. // label10
  949. //
  950. this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  951. this.label10.AutoSize = true;
  952. this.label10.ForeColor = System.Drawing.SystemColors.ScrollBar;
  953. this.label10.Location = new System.Drawing.Point(927, 9);
  954. this.label10.Name = "label10";
  955. this.label10.Size = new System.Drawing.Size(11, 192);
  956. this.label10.TabIndex = 9;
  957. this.label10.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|";
  958. //
  959. // label9
  960. //
  961. this.label9.AutoSize = true;
  962. this.label9.ForeColor = System.Drawing.SystemColors.ScrollBar;
  963. this.label9.Location = new System.Drawing.Point(210, 9);
  964. this.label9.Name = "label9";
  965. this.label9.Size = new System.Drawing.Size(11, 192);
  966. this.label9.TabIndex = 8;
  967. this.label9.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|";
  968. //
  969. // numericUpDown1
  970. //
  971. this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  972. this.numericUpDown1.Location = new System.Drawing.Point(993, 162);
  973. this.numericUpDown1.Maximum = new decimal(new int[] {
  974. 10,
  975. 0,
  976. 0,
  977. 0});
  978. this.numericUpDown1.Name = "numericUpDown1";
  979. this.numericUpDown1.Size = new System.Drawing.Size(70, 21);
  980. this.numericUpDown1.TabIndex = 7;
  981. this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
  982. //
  983. // label8
  984. //
  985. this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
  986. this.label8.AutoSize = true;
  987. this.label8.Location = new System.Drawing.Point(957, 167);
  988. this.label8.Name = "label8";
  989. this.label8.Size = new System.Drawing.Size(0, 12);
  990. this.label8.TabIndex = 6;
  991. //
  992. // button9
  993. //
  994. this.button9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  995. this.button9.Location = new System.Drawing.Point(941, 68);
  996. this.button9.Name = "button9";
  997. this.button9.Size = new System.Drawing.Size(128, 26);
  998. this.button9.TabIndex = 5;
  999. this.button9.UseVisualStyleBackColor = true;
  1000. this.button9.Click += new System.EventHandler(this.button9_Click);
  1001. //
  1002. // button8
  1003. //
  1004. this.button8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  1005. this.button8.Location = new System.Drawing.Point(941, 34);
  1006. this.button8.Name = "button8";
  1007. this.button8.Size = new System.Drawing.Size(128, 26);
  1008. this.button8.TabIndex = 4;
  1009. this.button8.UseVisualStyleBackColor = true;
  1010. this.button8.Click += new System.EventHandler(this.button8_Click);
  1011. //
  1012. // dataGridView2
  1013. //
  1014. this.dataGridView2.AllowUserToAddRows = false;
  1015. this.dataGridView2.AllowUserToDeleteRows = false;
  1016. this.dataGridView2.AllowUserToResizeColumns = false;
  1017. this.dataGridView2.AllowUserToResizeRows = false;
  1018. this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  1019. | System.Windows.Forms.AnchorStyles.Left)
  1020. | System.Windows.Forms.AnchorStyles.Right)));
  1021. this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
  1022. this.dataGridView2.BackgroundColor = System.Drawing.Color.White;
  1023. this.dataGridView2.ColumnHeadersHeight = 48;
  1024. this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
  1025. this.Column10,
  1026. this.Column11,
  1027. this.Column12,
  1028. this.Column13,
  1029. this.Column14,
  1030. this.Column15,
  1031. this.Column19,
  1032. this.Column16,
  1033. this.Column17,
  1034. this.Column18});
  1035. this.dataGridView2.Location = new System.Drawing.Point(228, 20);
  1036. this.dataGridView2.MultiSelect = false;
  1037. this.dataGridView2.Name = "dataGridView2";
  1038. this.dataGridView2.ReadOnly = true;
  1039. this.dataGridView2.RowHeadersVisible = false;
  1040. this.dataGridView2.RowTemplate.Height = 23;
  1041. this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
  1042. this.dataGridView2.Size = new System.Drawing.Size(693, 176);
  1043. this.dataGridView2.TabIndex = 3;
  1044. //
  1045. // Column10
  1046. //
  1047. this.Column10.FillWeight = 395.9391F;
  1048. this.Column10.MinimumWidth = 74;
  1049. this.Column10.Name = "Column10";
  1050. this.Column10.ReadOnly = true;
  1051. this.Column10.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  1052. this.Column10.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  1053. //
  1054. // Column11
  1055. //
  1056. this.Column11.FillWeight = 67.11788F;
  1057. this.Column11.MinimumWidth = 54;
  1058. this.Column11.Name = "Column11";
  1059. this.Column11.ReadOnly = true;
  1060. this.Column11.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  1061. this.Column11.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  1062. //
  1063. // Column12
  1064. //
  1065. this.Column12.FillWeight = 67.11788F;
  1066. this.Column12.MinimumWidth = 68;
  1067. this.Column12.Name = "Column12";
  1068. this.Column12.ReadOnly = true;
  1069. this.Column12.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  1070. this.Column12.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  1071. //
  1072. // Column13
  1073. //
  1074. this.Column13.FillWeight = 67.11788F;
  1075. this.Column13.MinimumWidth = 68;
  1076. this.Column13.Name = "Column13";
  1077. this.Column13.ReadOnly = true;
  1078. this.Column13.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  1079. this.Column13.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  1080. //
  1081. // Column14
  1082. //
  1083. this.Column14.FillWeight = 67.11788F;
  1084. this.Column14.MinimumWidth = 68;
  1085. this.Column14.Name = "Column14";
  1086. this.Column14.ReadOnly = true;
  1087. this.Column14.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  1088. this.Column14.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  1089. //
  1090. // Column15
  1091. //
  1092. this.Column15.FillWeight = 67.11788F;
  1093. this.Column15.MinimumWidth = 68;
  1094. this.Column15.Name = "Column15";
  1095. this.Column15.ReadOnly = true;
  1096. this.Column15.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  1097. this.Column15.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  1098. //
  1099. // Column19
  1100. //
  1101. this.Column19.FillWeight = 67.11788F;
  1102. this.Column19.MinimumWidth = 68;
  1103. this.Column19.Name = "Column19";
  1104. this.Column19.ReadOnly = true;
  1105. this.Column19.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  1106. this.Column19.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  1107. //
  1108. // Column16
  1109. //
  1110. this.Column16.FillWeight = 67.11788F;
  1111. this.Column16.MinimumWidth = 68;
  1112. this.Column16.Name = "Column16";
  1113. this.Column16.ReadOnly = true;
  1114. this.Column16.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  1115. this.Column16.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  1116. //
  1117. // Column17
  1118. //
  1119. this.Column17.FillWeight = 67.11788F;
  1120. this.Column17.MinimumWidth = 68;
  1121. this.Column17.Name = "Column17";
  1122. this.Column17.ReadOnly = true;
  1123. this.Column17.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  1124. this.Column17.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  1125. //
  1126. // Column18
  1127. //
  1128. this.Column18.FillWeight = 67.11788F;
  1129. this.Column18.MinimumWidth = 68;
  1130. this.Column18.Name = "Column18";
  1131. this.Column18.ReadOnly = true;
  1132. this.Column18.Resizable = System.Windows.Forms.DataGridViewTriState.False;
  1133. this.Column18.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
  1134. //
  1135. // listView2
  1136. //
  1137. this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
  1138. | System.Windows.Forms.AnchorStyles.Left)));
  1139. this.listView2.HideSelection = false;
  1140. this.listView2.Location = new System.Drawing.Point(16, 56);
  1141. this.listView2.Name = "listView2";
  1142. this.listView2.Size = new System.Drawing.Size(181, 140);
  1143. this.listView2.TabIndex = 2;
  1144. this.listView2.UseCompatibleStateImageBehavior = false;
  1145. this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
  1146. //
  1147. // button7
  1148. //
  1149. this.button7.Location = new System.Drawing.Point(145, 20);
  1150. this.button7.Name = "button7";
  1151. this.button7.Size = new System.Drawing.Size(52, 26);
  1152. this.button7.TabIndex = 1;
  1153. this.button7.UseVisualStyleBackColor = true;
  1154. this.button7.Click += new System.EventHandler(this.button7_Click);
  1155. //
  1156. // button6
  1157. //
  1158. this.button6.Location = new System.Drawing.Point(16, 20);
  1159. this.button6.Name = "button6";
  1160. this.button6.Size = new System.Drawing.Size(93, 26);
  1161. this.button6.TabIndex = 0;
  1162. this.button6.UseVisualStyleBackColor = true;
  1163. this.button6.Click += new System.EventHandler(this.button6_Click);
  1164. //
  1165. // MetallographicMethod1077Dialog
  1166. //
  1167. this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
  1168. this.ClientSize = new System.Drawing.Size(1107, 771);
  1169. this.Controls.Add(this.groupBox9);
  1170. this.Controls.Add(this.groupBox8);
  1171. this.Controls.Add(this.groupBox7);
  1172. this.Controls.Add(this.groupBox6);
  1173. this.Controls.Add(this.groupBox5);
  1174. this.Controls.Add(this.groupBox4);
  1175. this.Controls.Add(this.groupBox3);
  1176. this.Controls.Add(this.groupBox2);
  1177. this.Controls.Add(this.groupBox1);
  1178. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  1179. this.Name = "MetallographicMethod1077Dialog";
  1180. this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MetallographicMethod1077Dialog_FormClosing);
  1181. this.Controls.SetChildIndex(this.groupBox1, 0);
  1182. this.Controls.SetChildIndex(this.groupBox2, 0);
  1183. this.Controls.SetChildIndex(this.groupBox3, 0);
  1184. this.Controls.SetChildIndex(this.groupBox4, 0);
  1185. this.Controls.SetChildIndex(this.groupBox5, 0);
  1186. this.Controls.SetChildIndex(this.groupBox6, 0);
  1187. this.Controls.SetChildIndex(this.groupBox7, 0);
  1188. this.Controls.SetChildIndex(this.groupBox8, 0);
  1189. this.Controls.SetChildIndex(this.groupBox9, 0);
  1190. this.groupBox1.ResumeLayout(false);
  1191. this.groupBox1.PerformLayout();
  1192. this.groupBox2.ResumeLayout(false);
  1193. this.groupBox4.ResumeLayout(false);
  1194. this.groupBox5.ResumeLayout(false);
  1195. this.groupBox5.PerformLayout();
  1196. ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();
  1197. ((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
  1198. this.groupBox6.ResumeLayout(false);
  1199. this.groupBox6.PerformLayout();
  1200. this.groupBox7.ResumeLayout(false);
  1201. this.groupBox7.PerformLayout();
  1202. this.groupBox8.ResumeLayout(false);
  1203. ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
  1204. this.groupBox9.ResumeLayout(false);
  1205. this.groupBox9.PerformLayout();
  1206. ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
  1207. ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
  1208. this.ResumeLayout(false);
  1209. }
  1210. /// <summary>
  1211. /// 初始化其他控件
  1212. /// </summary>
  1213. private void InitOtherTools()
  1214. {
  1215. //
  1216. //初始化图像控件
  1217. //
  1218. this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);
  1219. this.documentWorkspace.Dock = DockStyle.Fill;
  1220. this.documentWorkspace.HookMouseEvents();
  1221. this.documentWorkspace.AuxiliaryLineEnabled = false;
  1222. this.documentWorkspace.Visible = false;
  1223. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.NullTool;
  1224. this.groupBox3.Controls.Add(documentWorkspace);
  1225. //
  1226. //初始化操作按钮
  1227. //
  1228. this.commonControlButtons = new CommonControlButtons();
  1229. this.commonControlButtons.Dock = DockStyle.Top;
  1230. this.commonControlButtons.Height = 30;
  1231. this.commonControlButtons.HideZoomToWindowAndActualSize();
  1232. this.commonControlButtons.Visible = false;
  1233. this.groupBox3.Controls.Add(commonControlButtons);
  1234. //
  1235. //调色板
  1236. //
  1237. this.colorsForm1 = new ColorsForm();
  1238. this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;
  1239. this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  1240. this.colorsForm2 = new ColorsForm();
  1241. this.colorsForm2.StartPosition = FormStartPosition.CenterScreen;
  1242. this.colorsForm2.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  1243. this.colorsForm3 = new ColorsForm();
  1244. this.colorsForm3.StartPosition = FormStartPosition.CenterScreen;
  1245. this.colorsForm3.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  1246. this.colorsForm4 = new ColorsForm();
  1247. this.colorsForm4.StartPosition = FormStartPosition.CenterScreen;
  1248. this.colorsForm4.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  1249. this.colorsForm5 = new ColorsForm();
  1250. this.colorsForm5.StartPosition = FormStartPosition.CenterScreen;
  1251. this.colorsForm5.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  1252. this.colorsForm6 = new ColorsForm();
  1253. this.colorsForm6.StartPosition = FormStartPosition.CenterScreen;
  1254. this.colorsForm6.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);
  1255. //
  1256. //颜色panel给定初始值
  1257. //
  1258. this.panel1.BackColor = Color.Red;
  1259. this.panel2.BackColor = Color.Blue;
  1260. this.panel3.BackColor = Color.Green;
  1261. this.panel4.BackColor = Color.Pink;
  1262. this.panel5.BackColor = Color.Yellow;
  1263. this.panel6.BackColor = Color.Black;
  1264. //
  1265. //滚动条与输入框值匹配
  1266. //
  1267. this.textBox1.Text = "" + this.trackBar1.Value;
  1268. this.textBox2.Text = "" + this.trackBar2.Value;
  1269. //
  1270. //按钮绑定事件
  1271. //
  1272. this.button3.LostFocus += new System.EventHandler(this.button3_LostFocus);
  1273. ////
  1274. ////获取系统标尺-微米
  1275. ////
  1276. //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength);
  1277. }
  1278. /// <summary>
  1279. /// 初始化图片列表数据
  1280. /// </summary>
  1281. public void InitPicList()
  1282. {
  1283. //初始化图片列表
  1284. for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
  1285. {
  1286. this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);
  1287. this.listView1.Items.Add("", i);
  1288. this.listView1.Items[i].ImageIndex = i;
  1289. this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  1290. this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();
  1291. if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))
  1292. {
  1293. defaultIndex = i;
  1294. }
  1295. }
  1296. this.Shown += ShowImgEvent;
  1297. }
  1298. /// <summary>
  1299. /// 初始化表头
  1300. /// </summary>
  1301. private void InitGridHeader()
  1302. {
  1303. this.dataGridView1.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1304. this.dataGridView1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1305. this.dataGridView1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1306. this.dataGridView1.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1307. this.dataGridView1.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1308. this.dataGridView1.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1309. this.dataGridView1.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1310. this.dataGridView1.Columns[7].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1311. this.dataGridView1.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1312. this.dataGridView2.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1313. this.dataGridView2.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1314. this.dataGridView2.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1315. this.dataGridView2.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1316. this.dataGridView2.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1317. this.dataGridView2.Columns[5].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1318. this.dataGridView2.Columns[6].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1319. this.dataGridView2.Columns[7].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1320. this.dataGridView2.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1321. this.dataGridView2.Columns[9].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
  1322. //
  1323. //左下表
  1324. //
  1325. this.listView2.View = View.Details;
  1326. ColumnHeader header0 = new ColumnHeader();
  1327. header0.Text = PdnResources.GetString("Menu.Resultlist.Text");
  1328. header0.Width = 175;
  1329. this.listView2.Columns.Add(header0);
  1330. }
  1331. /// <summary>
  1332. /// 初始化画布按键功能
  1333. /// </summary>
  1334. private void InitCommonButtonEvent()
  1335. {
  1336. this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
  1337. this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
  1338. this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
  1339. this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
  1340. this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
  1341. this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
  1342. }
  1343. private void zoomInButton_Click(object sender, EventArgs e)
  1344. {
  1345. this.documentWorkspace.ZoomIn();
  1346. }
  1347. private void zoomOutButton_Click(object sender, EventArgs e)
  1348. {
  1349. this.documentWorkspace.ZoomOut();
  1350. }
  1351. private void zoomToWindowButton_Click(object sender, EventArgs e)
  1352. {
  1353. this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
  1354. }
  1355. private void actualSizeButton_Click(object sender, EventArgs e)
  1356. {
  1357. this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
  1358. this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
  1359. }
  1360. private void pointerButton_Click(object sender, EventArgs e)
  1361. {
  1362. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
  1363. }
  1364. private void mobileModeButton_Click(object sender, EventArgs e)
  1365. {
  1366. this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
  1367. }
  1368. /// <summary>
  1369. /// 添加画布绑定事件
  1370. /// </summary>
  1371. private void AddPictureBoxEvent()
  1372. {
  1373. this.documentWorkspace.panel.MouseDown += new MouseEventHandler(this.BoxMouseDownHandler);
  1374. this.documentWorkspace.panel.MouseMove += new MouseEventHandler(this.BoxMouseMoveHandler);
  1375. this.documentWorkspace.panel.MouseUp += new MouseEventHandler(this.BoxMouseUpHandler);
  1376. this.documentWorkspace.panel.Paint += new PaintEventHandler(this.BoxPaintHandler);
  1377. }
  1378. /// <summary>
  1379. /// 调色板回调函数
  1380. /// </summary>
  1381. /// <param name="sender"></param>
  1382. /// <param name="ce"></param>
  1383. private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)
  1384. {
  1385. }
  1386. /// <summary>
  1387. /// 添加内容单元格
  1388. /// </summary>
  1389. /// <param name="text"></param>
  1390. /// <param name="tag"></param>
  1391. /// <returns></returns>
  1392. private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag)
  1393. {
  1394. DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();
  1395. textboxcell.Value = text;
  1396. textboxcell.Tag = tag;
  1397. return textboxcell;
  1398. }
  1399. /// <summary>
  1400. /// 设置按钮
  1401. /// </summary>
  1402. /// <param name="sender"></param>
  1403. /// <param name="e"></param>
  1404. private void button1_Click(object sender, EventArgs e)
  1405. {
  1406. AnalyzeSettingDialog metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.MetallographicMethod1077");
  1407. if (metallographicMethodSetDialog.hasModule)
  1408. {
  1409. metallographicMethodSetDialog.StartPosition = FormStartPosition.CenterScreen;
  1410. metallographicMethodSetDialog.ShowDialog();
  1411. }
  1412. else
  1413. {
  1414. metallographicMethodSetDialog = null;
  1415. }
  1416. }
  1417. /// <summary>
  1418. /// 保存结果按钮
  1419. /// </summary>
  1420. /// <param name="sender"></param>
  1421. /// <param name="e"></param>
  1422. private void button2_Click(object sender, EventArgs e)
  1423. {
  1424. if (this.listView1.SelectedItems.Count > 0)
  1425. {
  1426. string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
  1427. string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
  1428. bool replace = false;
  1429. int rowIndex = 0;
  1430. if (this.dataGridView1.Rows.Count > 0)
  1431. {
  1432. if (this.listView2.Items.Count > 0)
  1433. {
  1434. foreach (ListViewItem item in this.listView2.Items)
  1435. {
  1436. if (item.Name.Equals(tag))
  1437. {
  1438. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1439. if(dr == DialogResult.OK)
  1440. {
  1441. replace = true;
  1442. }
  1443. else
  1444. {
  1445. return;
  1446. }
  1447. break;
  1448. }
  1449. }
  1450. }
  1451. //有重名需要替换
  1452. if (replace)
  1453. {
  1454. for(int i = 0; i < this.resultTableList.Count; i++)
  1455. {
  1456. if (this.resultTableList[i].TableName.Equals(tag))
  1457. {
  1458. rowIndex = i;
  1459. this.resultTableList.Remove(this.resultTableList[i]);
  1460. if (this.pointList.Count > 0)
  1461. {
  1462. double avg1 = 0;
  1463. double avg2 = 0;
  1464. double avg3 = 0;
  1465. double avg4 = 0;
  1466. double avg5 = 0;
  1467. DataTable dt = new DataTable(tag);
  1468. dt.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
  1469. dt.Columns.Add(PdnResources.GetString("Menu.packet.text"));
  1470. dt.Columns.Add(PdnResources.GetString("Menu.Completelydecarburizedlayer.text"));
  1471. dt.Columns.Add(PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text"));
  1472. dt.Columns.Add(PdnResources.GetString("Menu.Partiallydecarburizedlayer.text"));
  1473. dt.Columns.Add(PdnResources.GetString("Menu.Totaldecarburizationlayer.text"));
  1474. dt.Columns.Add(PdnResources.GetString("Menu.Freeferritedepth.text"));
  1475. dt.Columns.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Averagedezationlayer.text"));
  1476. dt.Columns.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Meanfreeferritedepth.text"));
  1477. dt.Columns.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.iondepth.text"));
  1478. for (int j = 0; j < this.pointList.Count; j++)
  1479. {
  1480. PointF[] pf = pointList[j];
  1481. DataRow dataRow = dt.NewRow();
  1482. dataRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
  1483. dataRow[PdnResources.GetString("Menu.packet.text")] = "L" + (j + 1);
  1484. if (pf[2] == PointF.Empty)
  1485. dataRow[PdnResources.GetString("Menu.Completelydecarburizedlayer.text")] = 0;
  1486. else
  1487. {
  1488. double dis1 = BasicCalculationHelper.GetDistance(pf[2], pf[0], 10) * unitLength;
  1489. dataRow[PdnResources.GetString("Menu.Completelydecarburizedlayer.text")] = dis1;
  1490. avg1 += dis1;
  1491. }
  1492. if (pf[3] == PointF.Empty)
  1493. dataRow[PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text")] = 0;
  1494. else
  1495. {
  1496. double dis2 = BasicCalculationHelper.GetDistance(pf[3], pf[0], 10) * unitLength;
  1497. dataRow[PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text")] = dis2;
  1498. avg2 += dis2;
  1499. }
  1500. if (pf[2] == PointF.Empty)
  1501. dataRow[PdnResources.GetString("Menu.Partiallydecarburizedlayer.text")] = 0;
  1502. else
  1503. {
  1504. double dis3 = BasicCalculationHelper.GetDistance(pf[1], pf[2], 10) * unitLength;
  1505. dataRow[PdnResources.GetString("Menu.Partiallydecarburizedlayer.text")] = dis3;
  1506. avg3 += dis3;
  1507. }
  1508. double dis4 = BasicCalculationHelper.GetDistance(pf[1], pf[0], 10) * unitLength;
  1509. dataRow[PdnResources.GetString("Menu.Totaldecarburizationlayer.text")] = dis4;
  1510. avg4 += dis4;
  1511. if (pf[4] != PointF.Empty && pf[5] != PointF.Empty)
  1512. {
  1513. double dis5 = BasicCalculationHelper.GetDistance(pf[4], pf[5], 10) * unitLength;
  1514. dataRow[PdnResources.GetString("Menu.Freeferritedepth.text")] = dis5;
  1515. avg5 += dis5;
  1516. }
  1517. else
  1518. dataRow[PdnResources.GetString("Menu.Freeferritedepth.text")] = 0;
  1519. dt.Rows.Add(dataRow);
  1520. }
  1521. DataRow avgRow = dt.NewRow();
  1522. avgRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
  1523. avgRow[PdnResources.GetString("Menu.packet.text")] = PdnResources.GetString("Menu.Image.Average.Text");
  1524. avgRow[PdnResources.GetString("Menu.Completelydecarburizedlayer.text")] = avg1 / lineCount;
  1525. avgRow[PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text")] = avg2 / lineCount;
  1526. avgRow[PdnResources.GetString("Menu.Partiallydecarburizedlayer.text")] = avg3 / lineCount;
  1527. avgRow[PdnResources.GetString("Menu.Totaldecarburizationlayer.text")] = avg4 / lineCount;
  1528. avgRow[PdnResources.GetString("Menu.Freeferritedepth.text")] = avg5 / lineCount;
  1529. dt.Rows.Add(avgRow);
  1530. if(dt.Rows.Count > 1)
  1531. {
  1532. double avgTuotan = 0;
  1533. double avgZiyou = 0;
  1534. double maxTuotan = 0;
  1535. for (int k = 0; k < dt.Rows.Count - 1; k++)
  1536. {
  1537. double temp = double.Parse(dt.Rows[k][5].ToString());
  1538. avgTuotan += temp;
  1539. avgZiyou += double.Parse(dt.Rows[k][6].ToString());
  1540. if (temp > maxTuotan)
  1541. maxTuotan = temp;
  1542. }
  1543. foreach (DataRow dtRow in dt.Rows)
  1544. {
  1545. dtRow[PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Averagedezationlayer.text")] = Math.Round(avgTuotan / (dt.Rows.Count - 1), 10);
  1546. dtRow[PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Meanfreeferritedepth.text")] = Math.Round(avgZiyou / (dt.Rows.Count - 1), 10);
  1547. dtRow[PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.iondepth.text")] = Math.Round(maxTuotan, 10);
  1548. }
  1549. }
  1550. resultTableList.Insert(rowIndex, dt);
  1551. }
  1552. }
  1553. }
  1554. }
  1555. //新增
  1556. else
  1557. {
  1558. ListViewItem listViewItem = new ListViewItem();
  1559. listViewItem.Name = tag;
  1560. listViewItem.SubItems[0].Text = imgName;
  1561. this.listView2.Items.Add(listViewItem);
  1562. this.listView2.SelectedItems.Clear();
  1563. this.listView2.Items[this.listView2.Items.Count - 1].Selected = true;
  1564. if (this.pointList.Count > 0)
  1565. {
  1566. //重新计算平均值
  1567. double avg1 = 0;
  1568. double avg2 = 0;
  1569. double avg3 = 0;
  1570. double avg4 = 0;
  1571. double avg5 = 0;
  1572. DataTable dt = new DataTable(tag);
  1573. dt.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
  1574. dt.Columns.Add(PdnResources.GetString("Menu.packet.text"));
  1575. dt.Columns.Add(PdnResources.GetString("Menu.Completelydecarburizedlayer.text"));
  1576. dt.Columns.Add(PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text"));
  1577. dt.Columns.Add(PdnResources.GetString("Menu.Partiallydecarburizedlayer.text"));
  1578. dt.Columns.Add(PdnResources.GetString("Menu.Totaldecarburizationlayer.text"));
  1579. dt.Columns.Add(PdnResources.GetString("Menu.Freeferritedepth.text"));
  1580. dt.Columns.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Averagedezationlayer.text"));
  1581. dt.Columns.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Meanfreeferritedepth.text"));
  1582. dt.Columns.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.iondepth.text"));
  1583. for (int i = 0; i < this.pointList.Count; i++)
  1584. {
  1585. PointF[] pf = pointList[i];
  1586. DataRow dataRow = dt.NewRow();
  1587. dataRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
  1588. dataRow[PdnResources.GetString("Menu.packet.text")] = "L" + (i + 1);
  1589. if (pf[2] == PointF.Empty)
  1590. dataRow[PdnResources.GetString("Menu.Completelydecarburizedlayer.text")] = 0;
  1591. else
  1592. {
  1593. double dis1 = BasicCalculationHelper.GetDistance(pf[2], pf[0], 10) * unitLength;
  1594. dataRow[PdnResources.GetString("Menu.Completelydecarburizedlayer.text")] = dis1;
  1595. avg1 += dis1;
  1596. }
  1597. if (pf[3] == PointF.Empty)
  1598. dataRow[PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text")] = 0;
  1599. else
  1600. {
  1601. double dis2 = BasicCalculationHelper.GetDistance(pf[3], pf[0], 10) * unitLength;
  1602. dataRow[PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text")] = dis2;
  1603. avg2 += dis2;
  1604. }
  1605. if (pf[2] == PointF.Empty)
  1606. dataRow[PdnResources.GetString("Menu.Partiallydecarburizedlayer.text")] = 0;
  1607. else
  1608. {
  1609. double dis3 = BasicCalculationHelper.GetDistance(pf[1], pf[2], 10) * unitLength;
  1610. dataRow[PdnResources.GetString("Menu.Partiallydecarburizedlayer.text")] = dis3;
  1611. avg3 += dis3;
  1612. }
  1613. double dis4 = BasicCalculationHelper.GetDistance(pf[1], pf[0], 10) * unitLength;
  1614. dataRow[PdnResources.GetString("Menu.Totaldecarburizationlayer.text")] = dis4;
  1615. avg4 += dis4;
  1616. if (pf[4] != PointF.Empty && pf[5] != PointF.Empty)
  1617. {
  1618. double dis5 = BasicCalculationHelper.GetDistance(pf[4], pf[5], 10) * unitLength;
  1619. dataRow[PdnResources.GetString("Menu.Freeferritedepth.text")] = dis5;
  1620. avg5 += dis5;
  1621. }
  1622. else
  1623. dataRow[PdnResources.GetString("Menu.Freeferritedepth.text")] = 0;
  1624. dt.Rows.Add(dataRow);
  1625. }
  1626. DataRow avgRow = dt.NewRow();
  1627. avgRow[PdnResources.GetString("Menu.picture.Text")] = imgName;
  1628. avgRow[PdnResources.GetString("Menu.packet.text")] = PdnResources.GetString("Menu.Image.Average.Text");
  1629. avgRow[PdnResources.GetString("Menu.Completelydecarburizedlayer.text")] = avg1 / lineCount;
  1630. avgRow[PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text")] = avg2 / lineCount;
  1631. avgRow[PdnResources.GetString("Menu.Partiallydecarburizedlayer.text")] = avg3 / lineCount;
  1632. avgRow[PdnResources.GetString("Menu.Totaldecarburizationlayer.text")] = avg4 / lineCount;
  1633. avgRow[PdnResources.GetString("Menu.Freeferritedepth.text")] = avg5 / lineCount;
  1634. dt.Rows.Add(avgRow);
  1635. if (dt.Rows.Count > 1)
  1636. {
  1637. double avgTuotan = 0;
  1638. double avgZiyou = 0;
  1639. double maxTuotan = 0;
  1640. for (int k = 0; k < dt.Rows.Count - 1; k++)
  1641. {
  1642. double temp = double.Parse(dt.Rows[k][5].ToString());
  1643. avgTuotan += temp;
  1644. avgZiyou += double.Parse(dt.Rows[k][6].ToString());
  1645. if (temp > maxTuotan)
  1646. maxTuotan = temp;
  1647. }
  1648. foreach (DataRow dtRow in dt.Rows)
  1649. {
  1650. dtRow[PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Averagedezationlayer.text")] = Math.Round(avgTuotan / (dt.Rows.Count - 1), 10);
  1651. dtRow[PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Meanfreeferritedepth.text")] = Math.Round(avgZiyou / (dt.Rows.Count - 1), 10);
  1652. dtRow[PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.iondepth.text")] = Math.Round(maxTuotan, 10);
  1653. }
  1654. }
  1655. resultTableList.Add(dt);
  1656. }
  1657. }
  1658. RefreshDataGridView2();
  1659. //保存处理后的图片
  1660. double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
  1661. List<Bitmap> tempBit = new List<Bitmap>();
  1662. Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
  1663. originalBit.Tag = pantographRatio;
  1664. tempBit.Add(originalBit);
  1665. Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
  1666. Graphics graphics = Graphics.FromImage(newBit);
  1667. if (this.documentWorkspace.phaseModels != null && this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)
  1668. {
  1669. Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.phaseModels[0].mat);
  1670. graphics.DrawImage(processedBit, new PointF(0, 0));
  1671. }
  1672. Draw(graphics);
  1673. newBit.Tag = pantographRatio;
  1674. tempBit.Add(newBit);
  1675. if (bitDic.ContainsKey(tag))
  1676. bitDic[tag] = tempBit;
  1677. else
  1678. bitDic.Add(tag, tempBit);
  1679. //拼接中间数据
  1680. List<List<string>> dataList = new List<List<string>>();
  1681. List<string> columnName = new List<string>();
  1682. columnName.Add(PdnResources.GetString("Menu.packet.text"));
  1683. columnName.Add(PdnResources.GetString("Menu.Completelydecarburizedlayer.text"));
  1684. columnName.Add(PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text"));
  1685. columnName.Add(PdnResources.GetString("Menu.Partiallydecarburizedlayer.text"));
  1686. columnName.Add(PdnResources.GetString("Menu.Totaldecarburizationlayer.text"));
  1687. columnName.Add(PdnResources.GetString("Menu.Freeferritedepth.text"));
  1688. columnName.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Averagedezationlayer.text"));
  1689. columnName.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Meanfreeferritedepth.text"));
  1690. columnName.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.iondepth.text"));
  1691. dataList.Add(columnName);
  1692. if (this.pointList.Count > 0)
  1693. {
  1694. for (int i = 0; i < this.pointList.Count; i++)
  1695. {
  1696. PointF[] pf = pointList[i];
  1697. List<string> strList = new List<string>();
  1698. strList.Add("L" + (i + 1));
  1699. if (pf[2] == PointF.Empty)
  1700. strList.Add("0");
  1701. else
  1702. strList.Add((BasicCalculationHelper.GetDistance(pf[2], pf[0], 10) * unitLength).ToString());
  1703. if (pf[3] == PointF.Empty)
  1704. strList.Add("0");
  1705. else
  1706. strList.Add((BasicCalculationHelper.GetDistance(pf[3], pf[0], 10) * unitLength).ToString());
  1707. if (pf[2] == PointF.Empty)
  1708. strList.Add("0");
  1709. else
  1710. strList.Add((BasicCalculationHelper.GetDistance(pf[1], pf[2], 10) * unitLength).ToString());
  1711. strList.Add((BasicCalculationHelper.GetDistance(pf[1], pf[0], 10) * unitLength).ToString());
  1712. if (pf[4] != PointF.Empty && pf[5] != PointF.Empty)
  1713. strList.Add((BasicCalculationHelper.GetDistance(pf[4], pf[5], 10) * unitLength).ToString());
  1714. else
  1715. strList.Add("0");
  1716. dataList.Add(strList);
  1717. }
  1718. }
  1719. if (dataList.Count > 1)
  1720. {
  1721. double avgTuotan = 0;
  1722. double avgZiyou = 0;
  1723. double maxTuotan = 0;
  1724. for (int k = 1; k < dataList.Count; k++)
  1725. {
  1726. double temp = double.Parse(dataList[k][4].ToString());
  1727. avgTuotan += temp;
  1728. avgZiyou += double.Parse(dataList[k][5].ToString());
  1729. if (temp > maxTuotan)
  1730. maxTuotan = temp;
  1731. }
  1732. for (int l = 1; l < dataList.Count; l++)
  1733. {
  1734. dataList[l].Add(Math.Round(avgTuotan / (dataList.Count - 1), 10).ToString());
  1735. dataList[l].Add(Math.Round(avgZiyou / (dataList.Count - 1), 10).ToString());
  1736. dataList[l].Add(Math.Round(maxTuotan, 10).ToString());
  1737. }
  1738. }
  1739. bool isExist = false;//是否已存在进行替换
  1740. int modelIndex = -1;//要替换的下标
  1741. for (int j = 0; j < tempDataModel.Count; j++)
  1742. {
  1743. if (tempDataModel[j].tagName.Equals(tag))
  1744. {
  1745. isExist = true;
  1746. modelIndex = j;
  1747. break;
  1748. }
  1749. }
  1750. if (isExist && modelIndex > -1)
  1751. tempDataModel[modelIndex].dataList = dataList;
  1752. else
  1753. {
  1754. ExportProjectModel newModel = new ExportProjectModel();
  1755. newModel.tagName = tag;
  1756. newModel.picName = imgName;
  1757. newModel.dataList = dataList;
  1758. tempDataModel.Add(newModel);
  1759. }
  1760. }
  1761. else
  1762. {
  1763. MessageBox.Show(PdnResources.GetString("Menu.Pleasedrawthemeasuringlinefirst.text"));
  1764. }
  1765. }
  1766. else
  1767. {
  1768. MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapictaurefirst.Text"));
  1769. }
  1770. }
  1771. /// <summary>
  1772. /// 刷新分析结果表
  1773. /// </summary>
  1774. private void RefreshDataGridView2()
  1775. {
  1776. this.dataGridView2.Rows.Clear();
  1777. if (this.showAll)
  1778. {
  1779. if (this.resultTableList.Count > 0)
  1780. {
  1781. foreach (DataTable dt in resultTableList)
  1782. {
  1783. for(int i = 0; i < dt.Rows.Count; i++)
  1784. {
  1785. DataGridViewRow row = new DataGridViewRow();
  1786. row.Height = 31;
  1787. row.Cells.Add(CreateTextBoxCell(dt.Rows[i][0].ToString(), ""));
  1788. row.Cells.Add(CreateTextBoxCell(dt.Rows[i][1].ToString(), ""));
  1789. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][2].ToString()) ? "0" :
  1790. dt.Rows[i][2].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1791. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][3].ToString()) ? "0" :
  1792. dt.Rows[i][3].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1793. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][4].ToString()) ? "0" :
  1794. dt.Rows[i][4].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1795. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][5].ToString()) ? "0" :
  1796. dt.Rows[i][5].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1797. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][6].ToString()) ? "0" :
  1798. dt.Rows[i][6].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1799. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][7].ToString()) ? "0" :
  1800. dt.Rows[i][7].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1801. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][8].ToString()) ? "0" :
  1802. dt.Rows[i][8].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1803. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][9].ToString()) ? "0" :
  1804. dt.Rows[i][9].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1805. this.dataGridView2.Rows.Add(row);
  1806. }
  1807. }
  1808. }
  1809. }
  1810. else
  1811. {
  1812. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  1813. {
  1814. for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
  1815. {
  1816. string tableName = this.listView2.SelectedItems[i].Name;
  1817. foreach (DataTable dt in resultTableList)
  1818. {
  1819. if (dt.TableName.Equals(tableName))
  1820. {
  1821. for (int j = 0; j < dt.Rows.Count; j++)
  1822. {
  1823. DataGridViewRow row = new DataGridViewRow();
  1824. row.Height = 31;
  1825. row.Cells.Add(CreateTextBoxCell(dt.Rows[j][0].ToString(), ""));
  1826. row.Cells.Add(CreateTextBoxCell(dt.Rows[j][1].ToString(), ""));
  1827. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][2].ToString()) ? "0" :
  1828. dt.Rows[j][2].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1829. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][3].ToString()) ? "0" :
  1830. dt.Rows[j][3].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1831. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][4].ToString()) ? "0" :
  1832. dt.Rows[j][4].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1833. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][5].ToString()) ? "0" :
  1834. dt.Rows[j][5].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1835. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][6].ToString()) ? "0" :
  1836. dt.Rows[j][6].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1837. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][7].ToString()) ? "0" :
  1838. dt.Rows[j][7].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1839. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][8].ToString()) ? "0" :
  1840. dt.Rows[j][8].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1841. row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][9].ToString()) ? "0" :
  1842. dt.Rows[j][9].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  1843. this.dataGridView2.Rows.Add(row);
  1844. }
  1845. }
  1846. }
  1847. }
  1848. }
  1849. }
  1850. }
  1851. /// <summary>
  1852. /// 添加测量线按钮
  1853. /// </summary>
  1854. /// <param name="sender"></param>
  1855. /// <param name="e"></param>
  1856. private void button3_Click(object sender, EventArgs e)
  1857. {
  1858. operationK = 0;
  1859. selected = -1;
  1860. this.documentWorkspace.Refresh();
  1861. }
  1862. /// <summary>
  1863. /// 选择测量线按钮
  1864. /// </summary>
  1865. /// <param name="sender"></param>
  1866. /// <param name="e"></param>
  1867. private void button4_Click(object sender, EventArgs e)
  1868. {
  1869. operationK = 1;
  1870. }
  1871. /// <summary>
  1872. /// 删除测量线按钮
  1873. /// </summary>
  1874. /// <param name="sender"></param>
  1875. /// <param name="e"></param>
  1876. private void button5_Click(object sender, EventArgs e)
  1877. {
  1878. if (selected > -1)
  1879. {
  1880. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodmeasurementline.text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1881. if (dr == DialogResult.OK)
  1882. {
  1883. this.pointList.Remove(this.pointList[selected]);
  1884. this.rectangleFList.Remove(this.rectangleFList[selected]);
  1885. selected = -1;
  1886. lineCount--;
  1887. RefreshDataGridView1();
  1888. this.documentWorkspace.Refresh();
  1889. }
  1890. }
  1891. else
  1892. MessageBox.Show(PdnResources.GetString("Menu.Pleaseseleceletedfirst.text"));
  1893. }
  1894. /// <summary>
  1895. /// 按键DELETE删除测量线
  1896. /// </summary>
  1897. /// <param name="sender"></param>
  1898. /// <param name="e"></param>
  1899. protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
  1900. {
  1901. if (keyData == Keys.Delete)
  1902. {
  1903. if (selected > -1)
  1904. {
  1905. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodmeasurementline.text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1906. if (dr == DialogResult.OK)
  1907. {
  1908. this.pointList.Remove(this.pointList[selected]);
  1909. this.rectangleFList.Remove(this.rectangleFList[selected]);
  1910. selected = -1;
  1911. lineCount--;
  1912. RefreshDataGridView1();
  1913. this.documentWorkspace.Refresh();
  1914. }
  1915. }
  1916. else
  1917. MessageBox.Show(PdnResources.GetString("Menu.Pleaseseleceletedfirst.text"));
  1918. }
  1919. return true;
  1920. //return base.ProcessCmdKey(ref msg, keyData);
  1921. }
  1922. /// <summary>
  1923. /// 全部显示按钮
  1924. /// </summary>
  1925. /// <param name="sender"></param>
  1926. /// <param name="e"></param>
  1927. private void button6_Click(object sender, EventArgs e)
  1928. {
  1929. if(this.button6.Text == PdnResources.GetString("Menu.Showall.text"))
  1930. {
  1931. this.button6.Text = PdnResources.GetString("Menu.Cancelshowall.text");
  1932. this.showAll = true;
  1933. RefreshDataGridView2();
  1934. }
  1935. else if (this.button6.Text == PdnResources.GetString("Menu.Cancelshowall.text"))
  1936. {
  1937. this.button6.Text = PdnResources.GetString("Menu.Showall.text");
  1938. this.showAll = false;
  1939. RefreshDataGridView2();
  1940. }
  1941. }
  1942. /// <summary>
  1943. /// 删除按钮
  1944. /// </summary>
  1945. /// <param name="sender"></param>
  1946. /// <param name="e"></param>
  1947. private void button7_Click(object sender, EventArgs e)
  1948. {
  1949. if(this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  1950. {
  1951. DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Determineallanalysisrlete.text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1952. if (dr == DialogResult.OK)
  1953. {
  1954. for (int i = 0; i < this.listView2.SelectedItems.Count; i++)
  1955. {
  1956. string tableName = this.listView2.SelectedItems[i].Name;
  1957. foreach (DataTable dt in resultTableList)
  1958. {
  1959. if (dt.TableName.Equals(tableName))
  1960. {
  1961. resultTableList.Remove(dt);
  1962. break;
  1963. }
  1964. }
  1965. if (bitDic.ContainsKey(tableName))
  1966. bitDic.Remove(tableName);
  1967. foreach (ExportProjectModel model in this.tempDataModel)
  1968. {
  1969. if (model.tagName.Equals(tableName))
  1970. {
  1971. this.tempDataModel.Remove(model);
  1972. break;
  1973. }
  1974. }
  1975. }
  1976. foreach (ListViewItem item in this.listView2.Items)
  1977. {
  1978. if (item.Selected)
  1979. this.listView2.Items.Remove(item);
  1980. }
  1981. RefreshDataGridView2();
  1982. }
  1983. }
  1984. }
  1985. /// <summary>
  1986. /// 生成报告按钮
  1987. /// </summary>
  1988. /// <param name="sender"></param>
  1989. /// <param name="e"></param>
  1990. private void button8_Click(object sender, EventArgs e)
  1991. {
  1992. if (this.checkBox1.Checked)
  1993. this.button1.PerformClick();
  1994. if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  1995. {
  1996. //获取word书签与excel单元格的关系,以字典方式存储
  1997. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  1998. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  1999. if (mic_module_infos != null && mic_module_infos.Count > 0)
  2000. {
  2001. foreach (mic_module_infos info in mic_module_infos)
  2002. {
  2003. tagInfos.Add(info.tag_name, info.cell_position);
  2004. }
  2005. }
  2006. //分析结果
  2007. List<List<string>> analysisContent = new List<List<string>>();
  2008. List<string> contentHead = new List<string>();
  2009. contentHead.Add(PdnResources.GetString("Menu.picture.Text"));
  2010. contentHead.Add(PdnResources.GetString("Menu.packet.text"));
  2011. contentHead.Add(PdnResources.GetString("Menu.Completelydecarburizedlayer.text"));
  2012. contentHead.Add(PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text"));
  2013. contentHead.Add(PdnResources.GetString("Menu.Partiallydecarburizedlayer.text"));
  2014. contentHead.Add(PdnResources.GetString("Menu.Totaldecarburizationlayer.text"));
  2015. contentHead.Add(PdnResources.GetString("Menu.Freeferritedepth.text"));
  2016. contentHead.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Averagedezationlayer.text"));
  2017. contentHead.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Meanfreeferritedepth.text"));
  2018. contentHead.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.iondepth.text"));
  2019. analysisContent.Add(contentHead);
  2020. foreach (DataGridViewRow item in this.dataGridView2.Rows)
  2021. {
  2022. List<string> content = new List<string>();
  2023. content.Add(item.Cells[0].Value.ToString());
  2024. content.Add(item.Cells[1].Value.ToString());
  2025. content.Add(item.Cells[2].Value.ToString());
  2026. content.Add(item.Cells[3].Value.ToString());
  2027. content.Add(item.Cells[4].Value.ToString());
  2028. content.Add(item.Cells[5].Value.ToString());
  2029. content.Add(item.Cells[6].Value.ToString());
  2030. content.Add(item.Cells[7].Value.ToString());
  2031. content.Add(item.Cells[8].Value.ToString());
  2032. content.Add(item.Cells[9].Value.ToString());
  2033. analysisContent.Add(content);
  2034. }
  2035. //图片
  2036. bitList = new List<Bitmap>();
  2037. if (this.showAll)
  2038. {
  2039. foreach(KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  2040. {
  2041. bitList.Add(kv.Value[0]);
  2042. bitList.Add(kv.Value[1]);
  2043. }
  2044. }
  2045. else
  2046. {
  2047. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  2048. {
  2049. foreach (ListViewItem item in this.listView2.SelectedItems)
  2050. {
  2051. if (bitDic.ContainsKey(item.Name))
  2052. {
  2053. bitList.Add(bitDic[item.Name][0]);
  2054. bitList.Add(bitDic[item.Name][1]);
  2055. }
  2056. }
  2057. }
  2058. }
  2059. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
  2060. }
  2061. else
  2062. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  2063. }
  2064. /// <summary>
  2065. /// 导出结果按钮
  2066. /// </summary>
  2067. /// <param name="sender"></param>
  2068. /// <param name="e"></param>
  2069. private void button9_Click(object sender, EventArgs e)
  2070. {
  2071. if (this.listView2.Items.Count > 0)
  2072. {
  2073. SaveFileDialog exe = new SaveFileDialog();
  2074. exe.Filter = "Execl files (*.xlsx)|*.xlsx";
  2075. exe.FilterIndex = 0;
  2076. exe.RestoreDirectory = true;
  2077. exe.Title = "Export Excel File";
  2078. exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
  2079. exe.FileName = "金相法ASTME1077"+ PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddHHmmss");
  2080. DialogResult dr = exe.ShowDialog();
  2081. if (dr != DialogResult.OK)
  2082. return;
  2083. DataTable dtb = new DataTable();
  2084. dtb.Columns.Add(PdnResources.GetString("Menu.picture.Text"));
  2085. dtb.Columns.Add(PdnResources.GetString("Menu.packet.text"));
  2086. dtb.Columns.Add(PdnResources.GetString("Menu.Completelydecarburizedlayer.text"));
  2087. dtb.Columns.Add(PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text"));
  2088. dtb.Columns.Add(PdnResources.GetString("Menu.Partiallydecarburizedlayer.text"));
  2089. dtb.Columns.Add(PdnResources.GetString("Menu.Totaldecarburizationlayer.text"));
  2090. dtb.Columns.Add(PdnResources.GetString("Menu.Freeferritedepth.text"));
  2091. dtb.Columns.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Averagedezationlayer.text"));
  2092. dtb.Columns.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Meanfreeferritedepth.text"));
  2093. dtb.Columns.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.iondepth.text"));
  2094. for (int i = 0; i < this.dataGridView2.Rows.Count; i++)
  2095. {
  2096. DataRow dataRow = dtb.NewRow();
  2097. dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView2.Rows[i].Cells[0].Value;
  2098. dataRow[PdnResources.GetString("Menu.packet.text")] = this.dataGridView2.Rows[i].Cells[1].Value;
  2099. dataRow[PdnResources.GetString("Menu.Completelydecarburizedlayer.text")] = this.dataGridView2.Rows[i].Cells[2].Value;
  2100. dataRow[PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text")] = this.dataGridView2.Rows[i].Cells[3].Value;
  2101. dataRow[PdnResources.GetString("Menu.Partiallydecarburizedlayer.text")] = this.dataGridView2.Rows[i].Cells[4].Value;
  2102. dataRow[PdnResources.GetString("Menu.Totaldecarburizationlayer.text")] = this.dataGridView2.Rows[i].Cells[5].Value;
  2103. dataRow[PdnResources.GetString("Menu.Freeferritedepth.text")] = this.dataGridView2.Rows[i].Cells[6].Value;
  2104. dataRow[PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Averagedezationlayer.text")] = this.dataGridView2.Rows[i].Cells[7].Value;
  2105. dataRow[PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Meanfreeferritedepth.text")] = this.dataGridView2.Rows[i].Cells[8].Value;
  2106. dataRow[PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.iondepth.text")] = this.dataGridView2.Rows[i].Cells[9].Value;
  2107. dtb.Rows.Add(dataRow);
  2108. }
  2109. List<DataTable> list = new List<DataTable>();
  2110. list.Add(dtb);
  2111. this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
  2112. }
  2113. else
  2114. MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text")+"!");
  2115. }
  2116. /// <summary>
  2117. /// 图像索引切换选中事件
  2118. /// </summary>
  2119. /// <param name="sender"></param>
  2120. /// <param name="e"></param>
  2121. private void listView1_SelectedIndexChanged(object sender, EventArgs e)
  2122. {
  2123. if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
  2124. {
  2125. unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);
  2126. this.documentWorkspace.phaseModels.Clear();
  2127. /// <summary>
  2128. /// 选中图片的mat
  2129. OpenCvSharp.Mat imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
  2130. Document document = Document.FromImageMat(imageMat.Clone());
  2131. this.documentWorkspace.Document = document;
  2132. this.documentWorkspace.Visible = true;
  2133. //this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList;
  2134. //this.documentWorkspace.phaseModels = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].phaseModels;
  2135. if (this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].phaseModels.Count == 0)
  2136. {
  2137. this.documentWorkspace.phaseModels = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].phaseModels;
  2138. }
  2139. else
  2140. {
  2141. this.documentWorkspace.phaseModels.Add(this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].AnalysisPhaseModel);
  2142. }
  2143. this.commonControlButtons.Visible = true;
  2144. pointList = new List<PointF[]>();
  2145. rectangleFList = new List<RectangleF>();
  2146. lineCount = 0;
  2147. this.dataGridView1.Rows.Clear();
  2148. }
  2149. }
  2150. /// <summary>
  2151. /// 添加测量线按钮失去焦点
  2152. /// </summary>
  2153. /// <param name="sender"></param>
  2154. /// <param name="e"></param>
  2155. private void button3_LostFocus(object sender, EventArgs e)
  2156. {
  2157. operationK = -1;
  2158. selected = -1;
  2159. this.documentWorkspace.Refresh();
  2160. }
  2161. /// <summary>
  2162. /// 限制只可以输入0-9数字以及退格键
  2163. /// </summary>
  2164. /// <param name="sender"></param>
  2165. /// <param name="e"></param>
  2166. private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  2167. {
  2168. if (e.KeyChar != '\b')//这是允许输入退格键 
  2169.             {
  2170. int len = this.textBox1.Text.Length;
  2171. if (len < 1 && e.KeyChar == '0')
  2172. {
  2173. e.Handled = true;
  2174. }
  2175. else if ((e.KeyChar < '0') || (e.KeyChar > '9'))//这是允许输入0-9数字 
  2176.                 {
  2177. e.Handled = true;
  2178. }
  2179. }
  2180. }
  2181. /// <summary>
  2182. /// 对输入值做限制
  2183. /// </summary>
  2184. /// <param name="sender"></param>
  2185. /// <param name="e"></param>
  2186. private void textBox1_KeyUp(object sender, KeyEventArgs e)
  2187. {
  2188. if (string.IsNullOrEmpty(this.textBox1.Text))
  2189. this.textBox1.Text = "1";
  2190. if (Convert.ToInt32(this.textBox1.Text) > 50)
  2191. this.textBox1.Text = "50";
  2192. this.trackBar1.Value = Convert.ToInt32(this.textBox1.Text);
  2193. }
  2194. /// <summary>
  2195. /// 限制只可以输入0-9数字以及退格键
  2196. /// </summary>
  2197. /// <param name="sender"></param>
  2198. /// <param name="e"></param>
  2199. private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
  2200. {
  2201. if (e.KeyChar != '\b')//这是允许输入退格键 
  2202.             {
  2203. int len = this.textBox1.Text.Length;
  2204. if (len < 1 && e.KeyChar == '0')
  2205. {
  2206. e.Handled = true;
  2207. }
  2208. else if ((e.KeyChar < '0') || (e.KeyChar > '9'))//这是允许输入0-9数字 
  2209.                 {
  2210. e.Handled = true;
  2211. }
  2212. }
  2213. }
  2214. /// <summary>
  2215. /// 对输入值做限制
  2216. /// </summary>
  2217. /// <param name="sender"></param>
  2218. /// <param name="e"></param>
  2219. private void textBox2_KeyUp(object sender, KeyEventArgs e)
  2220. {
  2221. if (string.IsNullOrEmpty(this.textBox2.Text))
  2222. this.textBox2.Text = "1";
  2223. if (Convert.ToInt32(this.textBox2.Text) > 50)
  2224. this.textBox2.Text = "50";
  2225. this.trackBar2.Value = Convert.ToInt32(this.textBox2.Text);
  2226. }
  2227. /// <summary>
  2228. /// 基准线panel被点击
  2229. /// </summary>
  2230. /// <param name="sender"></param>
  2231. /// <param name="e"></param>
  2232. private void panel1_Click(object sender, EventArgs e)
  2233. {
  2234. this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
  2235. this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.colorsForm1Changed));
  2236. this.colorsForm1.ShowDialog();
  2237. }
  2238. private void colorsForm1Changed(object sender, EventArgs e)
  2239. {
  2240. this.panel1.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();
  2241. this.colorsForm1.Close();
  2242. this.documentWorkspace.Refresh();
  2243. }
  2244. /// <summary>
  2245. /// 钢样表面panel被点击
  2246. /// </summary>
  2247. /// <param name="sender"></param>
  2248. /// <param name="e"></param>
  2249. private void panel2_Click(object sender, EventArgs e)
  2250. {
  2251. this.colorsForm2.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
  2252. this.colorsForm2.setSaveBtn_Click(new System.EventHandler(this.colorsForm2Changed));
  2253. this.colorsForm2.ShowDialog();
  2254. }
  2255. private void colorsForm2Changed(object sender, EventArgs e)
  2256. {
  2257. this.panel2.BackColor = this.colorsForm2.UserPrimaryColor.ToColor();
  2258. this.colorsForm2.Close();
  2259. this.documentWorkspace.Refresh();
  2260. }
  2261. /// <summary>
  2262. /// 完全脱碳层panel被点击
  2263. /// </summary>
  2264. /// <param name="sender"></param>
  2265. /// <param name="e"></param>
  2266. private void panel3_Click(object sender, EventArgs e)
  2267. {
  2268. this.colorsForm3.UserPrimaryColor = ColorBgra.FromColor(this.panel3.BackColor);
  2269. this.colorsForm3.setSaveBtn_Click(new System.EventHandler(this.colorsForm3Changed));
  2270. this.colorsForm3.ShowDialog();
  2271. }
  2272. private void colorsForm3Changed(object sender, EventArgs e)
  2273. {
  2274. this.panel3.BackColor = this.colorsForm3.UserPrimaryColor.ToColor();
  2275. this.colorsForm3.Close();
  2276. this.documentWorkspace.Refresh();
  2277. }
  2278. /// <summary>
  2279. /// 有效脱碳层panel被点击
  2280. /// </summary>
  2281. /// <param name="sender"></param>
  2282. /// <param name="e"></param>
  2283. private void panel4_Click(object sender, EventArgs e)
  2284. {
  2285. this.colorsForm4.UserPrimaryColor = ColorBgra.FromColor(this.panel4.BackColor);
  2286. this.colorsForm4.setSaveBtn_Click(new System.EventHandler(this.colorsForm4Changed));
  2287. this.colorsForm4.ShowDialog();
  2288. }
  2289. private void colorsForm4Changed(object sender, EventArgs e)
  2290. {
  2291. this.panel4.BackColor = this.colorsForm4.UserPrimaryColor.ToColor();
  2292. this.colorsForm4.Close();
  2293. this.documentWorkspace.Refresh();
  2294. }
  2295. /// <summary>
  2296. /// 部分脱碳层panel被点击
  2297. /// </summary>
  2298. /// <param name="sender"></param>
  2299. /// <param name="e"></param>
  2300. private void panel5_Click(object sender, EventArgs e)
  2301. {
  2302. this.colorsForm5.UserPrimaryColor = ColorBgra.FromColor(this.panel5.BackColor);
  2303. this.colorsForm5.setSaveBtn_Click(new System.EventHandler(this.colorsForm5Changed));
  2304. this.colorsForm5.ShowDialog();
  2305. }
  2306. private void colorsForm5Changed(object sender, EventArgs e)
  2307. {
  2308. this.panel5.BackColor = this.colorsForm5.UserPrimaryColor.ToColor();
  2309. this.colorsForm5.Close();
  2310. this.documentWorkspace.Refresh();
  2311. }
  2312. /// <summary>
  2313. /// 自由铁素体深度panel被点击
  2314. /// </summary>
  2315. /// <param name="sender"></param>
  2316. /// <param name="e"></param>
  2317. private void panel6_Click(object sender, EventArgs e)
  2318. {
  2319. this.colorsForm6.UserPrimaryColor = ColorBgra.FromColor(this.panel6.BackColor);
  2320. this.colorsForm6.setSaveBtn_Click(new System.EventHandler(this.colorsForm6Changed));
  2321. this.colorsForm6.ShowDialog();
  2322. }
  2323. private void colorsForm6Changed(object sender, EventArgs e)
  2324. {
  2325. this.panel6.BackColor = this.colorsForm6.UserPrimaryColor.ToColor();
  2326. this.colorsForm6.Close();
  2327. this.documentWorkspace.Refresh();
  2328. }
  2329. /// <summary>
  2330. /// 线长滚动条滚动事件
  2331. /// </summary>
  2332. /// <param name="sender"></param>
  2333. /// <param name="e"></param>
  2334. private void trackBar1_Scroll(object sender, EventArgs e)
  2335. {
  2336. this.textBox1.Text = "" + this.trackBar1.Value;
  2337. }
  2338. private void trackBar1_ValueChanged(object sender, EventArgs e)
  2339. {
  2340. this.documentWorkspace.Refresh();
  2341. }
  2342. /// <summary>
  2343. /// 线宽滚动条滚动事件
  2344. /// </summary>
  2345. /// <param name="sender"></param>
  2346. /// <param name="e"></param>
  2347. private void trackBar2_Scroll(object sender, EventArgs e)
  2348. {
  2349. this.textBox2.Text = "" + this.trackBar2.Value;
  2350. }
  2351. private void trackBar2_ValueChanged(object sender, EventArgs e)
  2352. {
  2353. this.documentWorkspace.Refresh();
  2354. }
  2355. /// <summary>
  2356. /// 完全脱碳层选择框选中事件
  2357. /// </summary>
  2358. /// <param name="sender"></param>
  2359. /// <param name="e"></param>
  2360. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  2361. {
  2362. if(this.pointList.Count > 0)
  2363. {
  2364. if (this.checkBox2.Checked && this.checkBox3.Checked)
  2365. {
  2366. foreach(PointF[] pf in pointList)
  2367. {
  2368. pf[2] = new PointF((pf[0].X + pf[3].X) / 2f, (pf[0].Y + pf[3].Y) / 2f);
  2369. }
  2370. }
  2371. if (this.checkBox2.Checked && !this.checkBox3.Checked)
  2372. {
  2373. foreach (PointF[] pf in pointList)
  2374. {
  2375. pf[2] = new PointF((pf[0].X + pf[1].X) / 2f, (pf[0].Y + pf[1].Y) / 2f);
  2376. }
  2377. }
  2378. if (!this.checkBox2.Checked)
  2379. {
  2380. foreach (PointF[] pf in pointList)
  2381. {
  2382. pf[2] = PointF.Empty;
  2383. }
  2384. }
  2385. RefreshDataGridView1();
  2386. this.documentWorkspace.Refresh();
  2387. }
  2388. }
  2389. /// <summary>
  2390. /// 有效脱碳层选择框选中事件
  2391. /// </summary>
  2392. /// <param name="sender"></param>
  2393. /// <param name="e"></param>
  2394. private void checkBox3_CheckedChanged(object sender, EventArgs e)
  2395. {
  2396. if (this.pointList.Count > 0)
  2397. {
  2398. if (this.checkBox3.Checked && this.checkBox2.Checked)
  2399. {
  2400. foreach (PointF[] pf in pointList)
  2401. {
  2402. pf[3] = new PointF((pf[2].X + pf[1].X) / 2f, (pf[2].Y + pf[1].Y) / 2f);
  2403. }
  2404. }
  2405. if (this.checkBox3.Checked && !this.checkBox2.Checked)
  2406. {
  2407. foreach (PointF[] pf in pointList)
  2408. {
  2409. pf[3] = new PointF((pf[0].X + pf[1].X) / 2f, (pf[0].Y + pf[1].Y) / 2f);
  2410. }
  2411. }
  2412. if (!this.checkBox3.Checked)
  2413. {
  2414. foreach (PointF[] pf in pointList)
  2415. {
  2416. pf[3] = PointF.Empty;
  2417. }
  2418. }
  2419. RefreshDataGridView1();
  2420. this.documentWorkspace.Refresh();
  2421. }
  2422. }
  2423. /// <summary>
  2424. /// 小数数字框值改变
  2425. /// </summary>
  2426. /// <param name="sender"></param>
  2427. /// <param name="e"></param>
  2428. private void numericUpDown1_ValueChanged(object sender, EventArgs e)
  2429. {
  2430. if (this.numericUpDown1.Value > this.numericUpDown1.Maximum)
  2431. this.numericUpDown1.Value = this.numericUpDown1.Maximum;
  2432. if (this.numericUpDown1.Value < this.numericUpDown1.Minimum)
  2433. this.numericUpDown1.Value = this.numericUpDown1.Minimum;
  2434. RefreshDataGridView1();
  2435. RefreshDataGridView2();
  2436. this.documentWorkspace.Refresh();
  2437. }
  2438. /// <summary>
  2439. /// 鼠标按下
  2440. /// </summary>
  2441. /// <param name="sender"></param>
  2442. /// <param name="e"></param>
  2443. private void BoxMouseDownHandler(object sender, MouseEventArgs e)
  2444. {
  2445. PointF downPoint = this.documentWorkspace.GetScalePoint(e.Location);
  2446. if (operationK == 0)
  2447. {
  2448. if(e.Button == MouseButtons.Left)
  2449. {
  2450. clickCount += 1;
  2451. if (clickCount == 1)
  2452. {
  2453. startPoint = endPoint = downPoint;
  2454. nowLine = new PointF[6];
  2455. nowLine[0] = startPoint;
  2456. nowLine[1] = endPoint;
  2457. pointList.Add(nowLine);
  2458. }
  2459. else if (clickCount == 3)
  2460. {
  2461. RectangleF rectangleF = CalcOtherRectangle(pointList[lineCount]);
  2462. rectangleFList.Add(rectangleF);
  2463. operationK = -1;
  2464. clickCount = 0;
  2465. lineCount++;
  2466. AddContentToDataGridView();
  2467. }
  2468. }
  2469. else if(clickCount == 2 && e.Button == MouseButtons.Right)
  2470. {
  2471. pointList[lineCount][4] = PointF.Empty;
  2472. pointList[lineCount][5] = PointF.Empty;
  2473. RectangleF rectangleF = CalcOtherRectangle(pointList[lineCount]);
  2474. rectangleFList.Add(rectangleF);
  2475. operationK = -1;
  2476. clickCount = 0;
  2477. lineCount++;
  2478. AddContentToDataGridView();
  2479. }
  2480. }
  2481. else if (operationK == 1 && e.Button == MouseButtons.Left)
  2482. {
  2483. lastPoint.X = downPoint.X;
  2484. lastPoint.Y = downPoint.Y;
  2485. tempPoint.X = downPoint.X;
  2486. tempPoint.Y = downPoint.Y;
  2487. for (int i = rectangleFList.Count - 1; i >= 0; i--)
  2488. {
  2489. if (rectangleFList[i].Contains(downPoint))
  2490. {
  2491. selected = i;
  2492. canMove = true;
  2493. }
  2494. }
  2495. if (selected > -1 && pointList != null && pointList.Count > 0)
  2496. {
  2497. int tempLess = (int)(InvariantData.rectless * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1)) * 5;
  2498. int tempPlus = (int)(InvariantData.rectplus * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1)) * 5;
  2499. if (new RectangleF(pointList[selected][0].X - tempLess, pointList[selected][0].Y - tempLess, tempPlus, tempPlus).Contains(downPoint))
  2500. movePointIndex = 0;
  2501. else if (new RectangleF(pointList[selected][1].X - tempLess, pointList[selected][1].Y - tempLess, tempPlus, tempPlus).Contains(downPoint))
  2502. movePointIndex = 1;
  2503. else if (pointList[selected][2] != PointF.Empty && new RectangleF(pointList[selected][2].X - tempLess, pointList[selected][2].Y - tempLess, tempPlus, tempPlus).Contains(downPoint))
  2504. movePointIndex = 2;
  2505. else if (pointList[selected][3] != PointF.Empty && new RectangleF(pointList[selected][3].X - tempLess, pointList[selected][3].Y - tempLess, tempPlus, tempPlus).Contains(downPoint))
  2506. movePointIndex = 3;
  2507. else if (pointList[selected][4] != PointF.Empty && new RectangleF(pointList[selected][4].X - tempLess, pointList[selected][4].Y - tempLess, tempPlus, tempPlus).Contains(downPoint))
  2508. movePointIndex = 4;
  2509. else if (pointList[selected][4] != PointF.Empty && pointList[selected][5] != PointF.Empty && new RectangleF(pointList[selected][5].X - tempLess, pointList[selected][5].Y - tempLess, tempPlus, tempPlus).Contains(downPoint))
  2510. movePointIndex = 5;
  2511. else
  2512. movePointIndex = -1;
  2513. this.documentWorkspace.Refresh();
  2514. }
  2515. if (canMove)
  2516. return;
  2517. selected = -1;
  2518. }
  2519. }
  2520. /// <summary>
  2521. /// 鼠标移动
  2522. /// </summary>
  2523. /// <param name="sender"></param>
  2524. /// <param name="e"></param>
  2525. private void BoxMouseMoveHandler(object sender, MouseEventArgs e)
  2526. {
  2527. this.documentWorkspace.panel.Cursor = Cursors.Default;
  2528. PointF movePoint = this.documentWorkspace.GetScalePoint(e.Location);
  2529. if (operationK == 0)
  2530. {
  2531. if (clickCount == 1)
  2532. {
  2533. this.endPoint = movePoint;
  2534. pointList[lineCount][1] = endPoint;
  2535. }
  2536. else if (clickCount == 2)
  2537. {
  2538. pointList[lineCount][4] = movePoint;
  2539. pointList[lineCount][5] = CalCulateDropFeet(pointList[lineCount]);
  2540. }
  2541. this.documentWorkspace.Refresh();
  2542. }
  2543. if (operationK == 1 && selected > -1 && canMove && e.Button == MouseButtons.Left)
  2544. {
  2545. float dx = movePoint.X - lastPoint.X;
  2546. float dy = movePoint.Y - lastPoint.Y;
  2547. float dxTemp = movePoint.X - tempPoint.X;
  2548. float dyTemp = movePoint.Y - tempPoint.Y;
  2549. lastPoint.X = movePoint.X;
  2550. lastPoint.Y = movePoint.Y;
  2551. if (movePointIndex == -1)
  2552. {
  2553. RectangleF rectangleF = new RectangleF();
  2554. rectangleF = rectangleFList[selected];
  2555. if (rectangleF.Contains(movePoint))
  2556. this.documentWorkspace.panel.Cursor = Cursors.SizeAll;
  2557. rectangleF.X += dx;
  2558. rectangleF.Y += dy;
  2559. rectangleFList[selected] = rectangleF;
  2560. if(pointList[selected][4] != PointF.Empty)
  2561. {
  2562. for (int i = 0; i < pointList[selected].Count(); i++)
  2563. {
  2564. if (pointList[selected][i] == PointF.Empty)
  2565. continue;
  2566. pointList[selected][i].X += dx;
  2567. pointList[selected][i].Y += dy;
  2568. }
  2569. }
  2570. else
  2571. {
  2572. for (int i = 0; i < 4; i++)
  2573. {
  2574. if (pointList[selected][i] == PointF.Empty)
  2575. continue;
  2576. pointList[selected][i].X += dx;
  2577. pointList[selected][i].Y += dy;
  2578. }
  2579. }
  2580. }
  2581. else if (movePointIndex == 0)
  2582. {
  2583. pointList[selected][0].X += dx;
  2584. pointList[selected][0].Y += dy;
  2585. if (checkBox2.Checked && checkBox3.Checked)
  2586. {
  2587. pointList[selected][2] = new PointF((2 * pointList[selected][0].X + pointList[selected][1].X) / 3f,
  2588. (2 * pointList[selected][0].Y + pointList[selected][1].Y) / 3f);
  2589. pointList[selected][3] = new PointF((pointList[selected][0].X + 2 * pointList[selected][1].X) / 3f,
  2590. (pointList[selected][0].Y + 2 * pointList[selected][1].Y) / 3f);
  2591. }
  2592. else if (checkBox2.Checked && !checkBox3.Checked)
  2593. {
  2594. pointList[selected][2] = new PointF((pointList[selected][0].X + pointList[selected][1].X) / 2f,
  2595. (pointList[selected][0].Y + pointList[selected][1].Y) / 2f);
  2596. pointList[selected][3] = PointF.Empty;
  2597. }
  2598. else if (!checkBox2.Checked && checkBox3.Checked)
  2599. {
  2600. pointList[selected][3] = new PointF((pointList[selected][0].X + pointList[selected][1].X) / 2f,
  2601. (pointList[selected][0].Y + pointList[selected][1].Y) / 2f);
  2602. pointList[selected][2] = PointF.Empty;
  2603. }
  2604. else
  2605. {
  2606. pointList[selected][2] = PointF.Empty;
  2607. pointList[selected][3] = PointF.Empty;
  2608. }
  2609. if(pointList[selected][4] != PointF.Empty)
  2610. pointList[selected][5] = CalCulateDropFeet(pointList[selected]);
  2611. rectangleFList[selected] = CalcOtherRectangle(pointList[selected]);
  2612. }
  2613. else if (movePointIndex == 1)
  2614. {
  2615. pointList[selected][1].X += dx;
  2616. pointList[selected][1].Y += dy;
  2617. if (checkBox2.Checked && checkBox3.Checked)
  2618. {
  2619. pointList[selected][2] = new PointF((2 * pointList[selected][0].X + pointList[selected][1].X) / 3f,
  2620. (2 * pointList[selected][0].Y + pointList[selected][1].Y) / 3f);
  2621. pointList[selected][3] = new PointF((pointList[selected][0].X + 2 * pointList[selected][1].X) / 3f,
  2622. (pointList[selected][0].Y + 2 * pointList[selected][1].Y) / 3f);
  2623. }
  2624. else if (checkBox2.Checked && !checkBox3.Checked)
  2625. {
  2626. pointList[selected][2] = new PointF((pointList[selected][0].X + pointList[selected][1].X) / 2f,
  2627. (pointList[selected][0].Y + pointList[selected][1].Y) / 2f);
  2628. pointList[selected][3] = PointF.Empty;
  2629. }
  2630. else if (!checkBox2.Checked && checkBox3.Checked)
  2631. {
  2632. pointList[selected][3] = new PointF((pointList[selected][0].X + pointList[selected][1].X) / 2f,
  2633. (pointList[selected][0].Y + pointList[selected][1].Y) / 2f);
  2634. pointList[selected][2] = PointF.Empty;
  2635. }
  2636. else
  2637. {
  2638. pointList[selected][2] = PointF.Empty;
  2639. pointList[selected][3] = PointF.Empty;
  2640. }
  2641. if (pointList[selected][4] != PointF.Empty)
  2642. pointList[selected][5] = CalCulateDropFeet(pointList[selected]);
  2643. rectangleFList[selected] = CalcOtherRectangle(pointList[selected]);
  2644. }
  2645. else if (movePointIndex == 2)
  2646. {
  2647. //测量线是一条垂线
  2648. if (pointList[selected][0].X == pointList[selected][1].X)
  2649. {
  2650. pointList[selected][2].Y += dy;
  2651. if (pointList[selected][3] == PointF.Empty)
  2652. pointList[selected][2].Y = FormatCoordinate(pointList[selected][0].Y, pointList[selected][1].Y, pointList[selected][2].Y);
  2653. else
  2654. pointList[selected][2].Y = FormatCoordinate(pointList[selected][0].Y, pointList[selected][3].Y, pointList[selected][2].Y);
  2655. }
  2656. //测量线是一条平行线
  2657. else if (pointList[selected][0].Y == pointList[selected][1].Y)
  2658. {
  2659. pointList[selected][2].X += dx;
  2660. if (pointList[selected][3] == PointF.Empty)
  2661. pointList[selected][2].X = FormatCoordinate(pointList[selected][0].X, pointList[selected][1].X, pointList[selected][2].X);
  2662. else
  2663. pointList[selected][2].X = FormatCoordinate(pointList[selected][0].X, pointList[selected][3].X, pointList[selected][2].X);
  2664. }
  2665. //其他情况
  2666. else
  2667. {
  2668. float k = (pointList[selected][1].Y - pointList[selected][0].Y) / (pointList[selected][1].X - pointList[selected][0].X);
  2669. float b = pointList[selected][0].Y - k * pointList[selected][0].X;
  2670. if (Math.Abs(dxTemp) >= Math.Abs(dyTemp))
  2671. {
  2672. pointList[selected][2].X += dx;
  2673. if (pointList[selected][3] == PointF.Empty)
  2674. pointList[selected][2].X = FormatCoordinate(pointList[selected][0].X, pointList[selected][1].X, pointList[selected][2].X);
  2675. else
  2676. pointList[selected][2].X = FormatCoordinate(pointList[selected][0].X, pointList[selected][3].X, pointList[selected][2].X);
  2677. pointList[selected][2].Y = k * pointList[selected][2].X + b;
  2678. }
  2679. else
  2680. {
  2681. pointList[selected][2].Y += dy;
  2682. if (pointList[selected][3] == PointF.Empty)
  2683. pointList[selected][2].Y = FormatCoordinate(pointList[selected][0].Y, pointList[selected][1].Y, pointList[selected][2].Y);
  2684. else
  2685. pointList[selected][2].Y = FormatCoordinate(pointList[selected][0].Y, pointList[selected][3].Y, pointList[selected][2].Y);
  2686. pointList[selected][2].X = (pointList[selected][2].Y - b) / k;
  2687. }
  2688. }
  2689. }
  2690. else if (movePointIndex == 3)
  2691. {
  2692. //测量线是一条垂线
  2693. if (pointList[selected][0].X == pointList[selected][1].X)
  2694. {
  2695. pointList[selected][3].Y += dy;
  2696. if (pointList[selected][2] == PointF.Empty)
  2697. pointList[selected][3].Y = FormatCoordinate(pointList[selected][0].Y, pointList[selected][1].Y, pointList[selected][3].Y);
  2698. else
  2699. pointList[selected][3].Y = FormatCoordinate(pointList[selected][2].Y, pointList[selected][1].Y, pointList[selected][3].Y);
  2700. }
  2701. //测量线是一条平行线
  2702. else if (pointList[selected][0].Y == pointList[selected][1].Y)
  2703. {
  2704. pointList[selected][3].X += dx;
  2705. if (pointList[selected][2] == PointF.Empty)
  2706. pointList[selected][3].X = FormatCoordinate(pointList[selected][0].X, pointList[selected][1].X, pointList[selected][3].X);
  2707. else
  2708. pointList[selected][3].X = FormatCoordinate(pointList[selected][2].X, pointList[selected][1].X, pointList[selected][3].X);
  2709. }
  2710. //其他情况
  2711. else
  2712. {
  2713. float k = (pointList[selected][1].Y - pointList[selected][0].Y) / (pointList[selected][1].X - pointList[selected][0].X);
  2714. float b = pointList[selected][0].Y - k * pointList[selected][0].X;
  2715. if (Math.Abs(dxTemp) >= Math.Abs(dyTemp))
  2716. {
  2717. pointList[selected][3].X += dx;
  2718. if (pointList[selected][2] == PointF.Empty)
  2719. pointList[selected][3].X = FormatCoordinate(pointList[selected][0].X, pointList[selected][1].X, pointList[selected][3].X);
  2720. else
  2721. pointList[selected][3].X = FormatCoordinate(pointList[selected][2].X, pointList[selected][1].X, pointList[selected][3].X);
  2722. pointList[selected][3].Y = k * pointList[selected][3].X + b;
  2723. }
  2724. else
  2725. {
  2726. pointList[selected][3].Y += dy;
  2727. if (pointList[selected][2] == PointF.Empty)
  2728. pointList[selected][3].Y = FormatCoordinate(pointList[selected][0].Y, pointList[selected][1].Y, pointList[selected][3].Y);
  2729. else
  2730. pointList[selected][3].Y = FormatCoordinate(pointList[selected][2].Y, pointList[selected][1].Y, pointList[selected][3].Y);
  2731. pointList[selected][3].X = (pointList[selected][3].Y - b) / k;
  2732. }
  2733. }
  2734. }
  2735. else if (movePointIndex == 4)
  2736. {
  2737. pointList[selected][4].X += dx;
  2738. pointList[selected][4].Y += dy;
  2739. pointList[selected][5] = CalCulateDropFeet(pointList[selected]);
  2740. rectangleFList[selected] = CalcOtherRectangle(pointList[selected]);
  2741. }
  2742. else if (movePointIndex == 5)
  2743. {
  2744. float lineLength = this.trackBar1.Value / 2f;
  2745. double angle = Math.Round(BasicCalculationHelper.AngleText(pointList[selected][0], pointList[selected][1], new PointF(pointList[selected][0].X + lineLength, pointList[selected][0].Y)), 10);
  2746. //判断第二个点相对于第一个点的象限
  2747. int x2 = (int)(pointList[selected][1].X - pointList[selected][0].X);
  2748. if (x2 == 0)
  2749. x2 = 1;
  2750. int y2 = (int)(pointList[selected][1].Y - pointList[selected][0].Y);
  2751. if (y2 == 0)
  2752. y2 = 1;
  2753. int i2 = 0;
  2754. if (x2 > 0 && y2 > 0) //第4象限
  2755. {
  2756. i2 = 4;
  2757. }
  2758. else if (x2 > 0 && y2 < 0) //第1象限
  2759. {
  2760. i2 = 1;
  2761. }
  2762. else if (x2 < 0 && y2 < 0) //第2象限
  2763. {
  2764. i2 = 2;
  2765. }
  2766. else if (x2 < 0 && y2 > 0) //第3象限
  2767. {
  2768. i2 = 3;
  2769. }
  2770. double sAngle2;
  2771. double eAngle2;
  2772. if (i2 == 1 || i2 == 2)
  2773. {
  2774. sAngle2 = 270 - angle;
  2775. eAngle2 = 90 - angle;
  2776. }
  2777. else
  2778. {
  2779. sAngle2 = 270 + angle;
  2780. eAngle2 = 90 + angle;
  2781. }
  2782. if (!double.IsNaN(sAngle2) && !double.IsNaN(eAngle2))
  2783. {
  2784. PointF assistPoint1 = BasicCalculationHelper.GetAnglePoint(new PointF((pointList[selected][0].X + lineLength), pointList[selected][0].Y), pointList[selected][0], sAngle2);
  2785. PointF assistPoint2 = BasicCalculationHelper.GetAnglePoint(new PointF((pointList[selected][0].X + lineLength), pointList[selected][0].Y), pointList[selected][0], eAngle2);
  2786. //钢表面是一条垂线
  2787. if (assistPoint1.X == assistPoint2.X)
  2788. {
  2789. pointList[selected][5].Y += dy;
  2790. pointList[selected][4].Y += dy;
  2791. }
  2792. //钢表面是一条平行线
  2793. else if (assistPoint1.Y == assistPoint2.Y)
  2794. {
  2795. pointList[selected][5].X += dx;
  2796. pointList[selected][4].X += dx;
  2797. }
  2798. //其他情况
  2799. else
  2800. {
  2801. float k = (assistPoint2.Y - assistPoint1.Y) / (assistPoint2.X - assistPoint1.X);
  2802. float b = assistPoint1.Y - k * assistPoint1.X;
  2803. if (Math.Abs(dxTemp) >= Math.Abs(dyTemp))
  2804. {
  2805. pointList[selected][5].X += dx;
  2806. float oldLocationY = pointList[selected][5].Y;
  2807. pointList[selected][5].Y = k * pointList[selected][5].X + b;
  2808. float offsetY = pointList[selected][5].Y - oldLocationY;
  2809. pointList[selected][4].X += dx;
  2810. pointList[selected][4].Y += offsetY;
  2811. }
  2812. else
  2813. {
  2814. pointList[selected][5].Y += dy;
  2815. float oldLocationX = pointList[selected][5].X;
  2816. pointList[selected][5].X = (pointList[selected][5].Y - b) / k;
  2817. float offsetX = pointList[selected][5].X - oldLocationX;
  2818. pointList[selected][4].X += offsetX;
  2819. pointList[selected][4].Y += dy;
  2820. }
  2821. }
  2822. rectangleFList[selected] = CalcOtherRectangle(pointList[selected]);
  2823. }
  2824. }
  2825. this.documentWorkspace.Refresh();
  2826. }
  2827. }
  2828. /// <summary>
  2829. /// 鼠标抬起
  2830. /// </summary>
  2831. /// <param name="sender"></param>
  2832. /// <param name="e"></param>
  2833. private void BoxMouseUpHandler(object sender, MouseEventArgs e)
  2834. {
  2835. if(e.Button == MouseButtons.Left)
  2836. {
  2837. if (operationK == 0)
  2838. {
  2839. if(clickCount == 2)
  2840. {
  2841. if (startPoint != null && endPoint != null && startPoint != endPoint)
  2842. {
  2843. if (checkBox2.Checked && checkBox3.Checked)
  2844. {
  2845. pointList[lineCount][2] = new PointF((2 * startPoint.X + endPoint.X) / 3f, (2 * startPoint.Y + endPoint.Y) / 3f);
  2846. pointList[lineCount][3] = new PointF((startPoint.X + 2 * endPoint.X) / 3f, (startPoint.Y + 2 * endPoint.Y) / 3f);
  2847. }
  2848. else if (checkBox2.Checked && !checkBox3.Checked)
  2849. {
  2850. pointList[lineCount][2] = new PointF((startPoint.X + endPoint.X) / 2f, (startPoint.Y + endPoint.Y) / 2f);
  2851. }
  2852. else if (!checkBox2.Checked && checkBox3.Checked)
  2853. {
  2854. pointList[lineCount][3] = new PointF((startPoint.X + endPoint.X) / 2f, (startPoint.Y + endPoint.Y) / 2f);
  2855. }
  2856. }
  2857. else
  2858. {
  2859. pointList.RemoveAt(pointList.Count - 1);
  2860. operationK = -1;
  2861. clickCount = 0;
  2862. }
  2863. this.documentWorkspace.Refresh();
  2864. }
  2865. }
  2866. else if (operationK == 1)
  2867. {
  2868. canMove = false;
  2869. movePointIndex = -1;
  2870. RefreshDataGridView1();
  2871. }
  2872. }
  2873. }
  2874. /// <summary>
  2875. /// 绘制事件
  2876. /// </summary>
  2877. /// <param name="sender"></param>
  2878. /// <param name="e"></param>
  2879. private void BoxPaintHandler(object sender, PaintEventArgs e)
  2880. {
  2881. if (this.documentWorkspace.CompositionSurface != null)
  2882. {
  2883. Rectangle rc = this.documentWorkspace.panel.ClientRectangle;
  2884. int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);
  2885. int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);
  2886. int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;
  2887. int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;
  2888. e.Graphics.TranslateTransform(x, y);
  2889. e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);
  2890. Draw(e.Graphics);
  2891. e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
  2892. e.Graphics.TranslateTransform(-x, -y);
  2893. }
  2894. }
  2895. // <summary>
  2896. /// 存储字号与颜色字典
  2897. /// </summary>
  2898. public Dictionary<string, Color> colourFont = new Dictionary<string, Color>() { { "20", Color.Black } };
  2899. /// <summary>
  2900. /// 绘制
  2901. /// </summary>
  2902. private void Draw(Graphics graphics)
  2903. {
  2904. graphics.SmoothingMode = SmoothingMode.AntiAlias;
  2905. Pen standardPen = new Pen(this.panel1.BackColor, this.trackBar2.Value);//基准线画笔
  2906. Pen surfacePen = new Pen(this.panel2.BackColor, this.trackBar2.Value);//钢样表面画笔
  2907. Pen completePen = new Pen(this.panel3.BackColor, this.trackBar2.Value);//完全脱碳层画笔
  2908. Pen validPen = new Pen(this.panel4.BackColor, this.trackBar2.Value);//有效脱碳层画笔
  2909. Pen partPen = new Pen(this.panel5.BackColor, this.trackBar2.Value);//部分脱碳层画笔
  2910. Pen freePen = new Pen(this.panel6.BackColor, this.trackBar2.Value);//自由铁素体深度画笔
  2911. Pen borderPen = new Pen(Color.Black);//填充点外圈
  2912. SolidBrush insideBrush = new SolidBrush(Color.White);//填充点内圈
  2913. Pen rectPen = new Pen(Color.Black);
  2914. rectPen.DashStyle = DashStyle.Custom;
  2915. float[] dashArray = { 2.0f,3.0f };
  2916. rectPen.DashPattern = dashArray;
  2917. if (pointList.Count > 0)
  2918. {
  2919. foreach(PointF[] pointFs in pointList)
  2920. {
  2921. PointF[] pf = pointFs;
  2922. if (pointFs.Count() > 1 && pointFs[0] != pointFs[1])
  2923. {
  2924. float lineLength = this.trackBar1.Value / 2f;
  2925. double angle = Math.Round(BasicCalculationHelper.AngleText(pointFs[0], pointFs[1], new PointF(pointFs[0].X + lineLength, pointFs[0].Y)), 10);
  2926. //判断第二个点相对于第一个点的象限
  2927. int x2 = (int)(pointFs[1].X - pointFs[0].X);
  2928. if (x2 == 0)
  2929. x2 = 1;
  2930. int y2 = (int)(pointFs[1].Y - pointFs[0].Y);
  2931. if (y2 == 0)
  2932. y2 = 1;
  2933. int i2 = 0;
  2934. if (x2 > 0 && y2 > 0) //第4象限
  2935. {
  2936. i2 = 4;
  2937. }
  2938. else if (x2 > 0 && y2 < 0) //第1象限
  2939. {
  2940. i2 = 1;
  2941. }
  2942. else if (x2 < 0 && y2 < 0) //第2象限
  2943. {
  2944. i2 = 2;
  2945. }
  2946. else if (x2 < 0 && y2 > 0) //第3象限
  2947. {
  2948. i2 = 3;
  2949. }
  2950. double sAngle1;
  2951. double eAngle1;
  2952. double sAngle2;
  2953. double eAngle2;
  2954. if (i2 == 1 || i2 == 2)
  2955. {
  2956. sAngle1 = 360 - angle;
  2957. eAngle1 = 180 - angle;
  2958. sAngle2 = 270 - angle;
  2959. eAngle2 = 90 - angle;
  2960. }
  2961. else
  2962. {
  2963. sAngle1 = angle;
  2964. eAngle1 = 180 + angle;
  2965. sAngle2 = 270 + angle;
  2966. eAngle2 = 90 + angle;
  2967. }
  2968. graphics.DrawLine(standardPen, pointFs[0], pointFs[1]);
  2969. if (!double.IsNaN(sAngle1) && !double.IsNaN(eAngle1) && !double.IsNaN(sAngle2) && !double.IsNaN(eAngle2))
  2970. {
  2971. PointF assistPoint1 = BasicCalculationHelper.GetAnglePoint(new PointF((pointFs[0].X + lineLength), pointFs[0].Y), pointFs[0], sAngle2);
  2972. PointF assistPoint2 = BasicCalculationHelper.GetAnglePoint(new PointF((pointFs[0].X + lineLength), pointFs[0].Y), pointFs[0], eAngle2);
  2973. PointF assistPoint3 = BasicCalculationHelper.GetAnglePoint(new PointF((pointFs[1].X + lineLength), pointFs[1].Y), pointFs[1], sAngle2);
  2974. PointF assistPoint4 = BasicCalculationHelper.GetAnglePoint(new PointF((pointFs[1].X + lineLength), pointFs[1].Y), pointFs[1], eAngle2);
  2975. graphics.DrawLine(surfacePen, assistPoint1, assistPoint2);
  2976. graphics.DrawLine(partPen, assistPoint3, assistPoint4);
  2977. if (this.checkBox2.Checked)
  2978. {
  2979. if (i2 == 1 || i2 == 2)
  2980. {
  2981. if (this.checkBox6.Checked)
  2982. {
  2983. graphics.DrawString(double.Parse(CreateTextBoxCell(BasicCalculationHelper.GetDistance(pf[1], pf[2], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength + "", "").Value.ToString()).ToString("F" + this.numericUpDown1.Value), new Font("宋体", float.Parse(colourFont.Keys.First()), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(colourFont.Values.First()), assistPoint4.X, assistPoint4.Y - 10);
  2984. }
  2985. }
  2986. else
  2987. {
  2988. if (this.checkBox6.Checked)
  2989. {
  2990. graphics.DrawString(double.Parse(CreateTextBoxCell(BasicCalculationHelper.GetDistance(pf[1], pf[2], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength + "", "").Value.ToString()).ToString("F" + this.numericUpDown1.Value), new Font("宋体", float.Parse(colourFont.Keys.First()), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(colourFont.Values.First()), assistPoint3.X, assistPoint3.Y - 10);
  2991. }
  2992. }
  2993. }
  2994. }
  2995. if (pointFs[2] != PointF.Empty && checkBox2.Checked)
  2996. {
  2997. if (!double.IsNaN(sAngle1) && !double.IsNaN(eAngle1) && !double.IsNaN(sAngle2) && !double.IsNaN(eAngle2))
  2998. {
  2999. PointF assistPoint5 = BasicCalculationHelper.GetAnglePoint(new PointF((pointFs[2].X + lineLength), pointFs[2].Y), pointFs[2], sAngle2);
  3000. PointF assistPoint6 = BasicCalculationHelper.GetAnglePoint(new PointF((pointFs[2].X + lineLength), pointFs[2].Y), pointFs[2], eAngle2);
  3001. graphics.DrawLine(completePen, assistPoint5, assistPoint6);
  3002. if (i2 == 1 || i2 == 2)
  3003. {
  3004. if (this.checkBox4.Checked)
  3005. {
  3006. graphics.DrawString(double.Parse(CreateTextBoxCell(BasicCalculationHelper.GetDistance(pf[2], pf[0], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength + "", "").Value.ToString()).ToString("F" + this.numericUpDown1.Value), new Font("宋体", float.Parse(colourFont.Keys.First()), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(colourFont.Values.First()), assistPoint6.X, assistPoint6.Y - 10);
  3007. }
  3008. }
  3009. else
  3010. {
  3011. if (this.checkBox4.Checked)
  3012. {
  3013. graphics.DrawString(double.Parse(CreateTextBoxCell(BasicCalculationHelper.GetDistance(pf[2], pf[0], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength + "", "").Value.ToString()).ToString("F" + this.numericUpDown1.Value), new Font("宋体", float.Parse(colourFont.Keys.First()), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(colourFont.Values.First()), assistPoint5.X, assistPoint5.Y - 10);
  3014. }
  3015. }
  3016. }
  3017. }
  3018. if (pointFs[3] != PointF.Empty && checkBox3.Checked)
  3019. {
  3020. if (!double.IsNaN(sAngle1) && !double.IsNaN(eAngle1) && !double.IsNaN(sAngle2) && !double.IsNaN(eAngle2))
  3021. {
  3022. PointF assistPoint7 = BasicCalculationHelper.GetAnglePoint(new PointF((pointFs[3].X + lineLength), pointFs[3].Y), pointFs[3], sAngle2);
  3023. PointF assistPoint8 = BasicCalculationHelper.GetAnglePoint(new PointF((pointFs[3].X + lineLength), pointFs[3].Y), pointFs[3], eAngle2);
  3024. graphics.DrawLine(validPen, assistPoint7, assistPoint8);
  3025. if (i2 == 1 || i2 == 2)
  3026. {
  3027. if (this.checkBox5.Checked)
  3028. {
  3029. graphics.DrawString(double.Parse(CreateTextBoxCell(BasicCalculationHelper.GetDistance(pf[3], pf[0], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength + "", "").Value.ToString()).ToString("F" + this.numericUpDown1.Value), new Font("宋体", float.Parse(colourFont.Keys.First()), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(colourFont.Values.First()), assistPoint8.X, assistPoint8.Y - 10);
  3030. }
  3031. }
  3032. else
  3033. {
  3034. if (this.checkBox5.Checked)
  3035. {
  3036. graphics.DrawString(double.Parse(CreateTextBoxCell(BasicCalculationHelper.GetDistance(pf[3], pf[0], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength + "", "").Value.ToString()).ToString("F" + this.numericUpDown1.Value), new Font("宋体", float.Parse(colourFont.Keys.First()), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(colourFont.Values.First()), assistPoint7.X, assistPoint7.Y - 10);
  3037. }
  3038. }
  3039. }
  3040. }
  3041. if(pointFs[4] != PointF.Empty && pointFs[5] != PointF.Empty)
  3042. graphics.DrawLine(freePen, pointFs[4], pointFs[5]);
  3043. if (i2 == 1 || i2 == 2)
  3044. {
  3045. if (this.checkBox7.Checked)
  3046. {
  3047. if (BasicCalculationHelper.GetDistance(pf[4], pf[5], Convert.ToInt32(this.numericUpDown1.Value)) != 0)
  3048. {
  3049. graphics.DrawString(double.Parse(CreateTextBoxCell(BasicCalculationHelper.GetDistance(pf[4], pf[5], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength + "", "").Value.ToString()).ToString("F" + this.numericUpDown1.Value), new Font("宋体", float.Parse(colourFont.Keys.First()), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(colourFont.Values.First()), pointFs[5].X, pointFs[5].Y - 10);
  3050. }
  3051. }
  3052. }
  3053. else
  3054. {
  3055. if (this.checkBox7.Checked)
  3056. {
  3057. if (BasicCalculationHelper.GetDistance(pf[4], pf[5], Convert.ToInt32(this.numericUpDown1.Value)) != 0)
  3058. {
  3059. graphics.DrawString(double.Parse(CreateTextBoxCell(BasicCalculationHelper.GetDistance(pf[4], pf[5], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength + "", "").Value.ToString()).ToString("F" + this.numericUpDown1.Value), new Font("宋体", float.Parse(colourFont.Keys.First()), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(colourFont.Values.First()), pointFs[4].X, pointFs[4].Y - 10);
  3060. }
  3061. }
  3062. }
  3063. }
  3064. }
  3065. if (selected > -1)
  3066. {
  3067. int tempLess = (int)(InvariantData.rectless * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1));
  3068. int tempPlus = (int)(InvariantData.rectplus * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1));
  3069. graphics.DrawRectangle(borderPen, new Rectangle((int)(pointList[selected][0].X - tempLess), (int)(pointList[selected][0].Y - tempLess), tempPlus, tempPlus));
  3070. graphics.FillRectangle(insideBrush, new RectangleF(pointList[selected][0].X - tempLess, pointList[selected][0].Y - tempLess, tempPlus, tempPlus));
  3071. graphics.DrawRectangle(borderPen, new Rectangle((int)(pointList[selected][1].X - tempLess), (int)(pointList[selected][1].Y - tempLess), tempPlus, tempPlus));
  3072. graphics.FillRectangle(insideBrush, new RectangleF(pointList[selected][1].X - tempLess, pointList[selected][1].Y - tempLess, tempPlus, tempPlus));
  3073. if (pointList[selected][2] != PointF.Empty && checkBox2.Checked)
  3074. {
  3075. graphics.DrawRectangle(borderPen, new Rectangle((int)(pointList[selected][2].X - tempLess), (int)(pointList[selected][2].Y - tempLess), tempPlus, tempPlus));
  3076. graphics.FillRectangle(insideBrush, new RectangleF(pointList[selected][2].X - tempLess, pointList[selected][2].Y - tempLess, tempPlus, tempPlus));
  3077. }
  3078. if (pointList[selected][3] != PointF.Empty && checkBox3.Checked)
  3079. {
  3080. graphics.DrawRectangle(borderPen, new Rectangle((int)(pointList[selected][3].X - tempLess), (int)(pointList[selected][3].Y - tempLess), tempPlus, tempPlus));
  3081. graphics.FillRectangle(insideBrush, new RectangleF(pointList[selected][3].X - tempLess, pointList[selected][3].Y - tempLess, tempPlus, tempPlus));
  3082. }
  3083. if(pointList[selected][4] != PointF.Empty && pointList[selected][5] != PointF.Empty)
  3084. {
  3085. graphics.DrawRectangle(borderPen, new Rectangle((int)(pointList[selected][4].X - tempLess), (int)(pointList[selected][4].Y - tempLess), tempPlus, tempPlus));
  3086. graphics.FillRectangle(insideBrush, new RectangleF(pointList[selected][4].X - tempLess, pointList[selected][4].Y - tempLess, tempPlus, tempPlus));
  3087. graphics.DrawRectangle(borderPen, new Rectangle((int)(pointList[selected][5].X - tempLess), (int)(pointList[selected][5].Y - tempLess), tempPlus, tempPlus));
  3088. graphics.FillRectangle(insideBrush, new RectangleF(pointList[selected][5].X - tempLess, pointList[selected][5].Y - tempLess, tempPlus, tempPlus));
  3089. }
  3090. graphics.DrawRectangle(rectPen, rectangleFList[selected].X, rectangleFList[selected].Y, rectangleFList[selected].Width, rectangleFList[selected].Height);
  3091. }
  3092. }
  3093. standardPen.Dispose();
  3094. surfacePen.Dispose();
  3095. completePen.Dispose();
  3096. validPen.Dispose();
  3097. partPen.Dispose();
  3098. borderPen.Dispose();
  3099. insideBrush.Dispose();
  3100. rectPen.Dispose();
  3101. freePen.Dispose();
  3102. }
  3103. private void checkBox4_CheckedChanged(object sender, EventArgs e)
  3104. {
  3105. this.documentWorkspace.Refresh();
  3106. }
  3107. private void checkBox5_CheckedChanged(object sender, EventArgs e)
  3108. {
  3109. this.documentWorkspace.Refresh();
  3110. }
  3111. private void checkBox6_CheckedChanged(object sender, EventArgs e)
  3112. {
  3113. this.documentWorkspace.Refresh();
  3114. }
  3115. private void checkBox7_CheckedChanged(object sender, EventArgs e)
  3116. {
  3117. this.documentWorkspace.Refresh();
  3118. }
  3119. /// <summary>
  3120. /// 计算外接矩形
  3121. /// </summary>
  3122. private RectangleF CalcOtherRectangle(PointF[] pointfArr)
  3123. {
  3124. RectangleF rectangleF = new RectangleF();
  3125. if (pointfArr[4] != PointF.Empty)
  3126. {
  3127. float[] pointX = new float[] { pointfArr[0].X, pointfArr[1].X, pointfArr[4].X, pointfArr[5].X };
  3128. rectangleF.X = (int)pointX.Min();
  3129. float[] pointY = new float[] { pointfArr[0].Y, pointfArr[1].Y, pointfArr[4].Y, pointfArr[5].Y };
  3130. rectangleF.Y = (int)pointY.Min();
  3131. rectangleF.Width = (int)Math.Abs(pointX.Max() - pointX.Min());
  3132. rectangleF.Height = (int)Math.Abs(pointY.Max() - pointY.Min());
  3133. int tempLess = (int)(InvariantData.rectless * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1)) * 5;
  3134. int tempPlus = (int)(InvariantData.rectplus * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1)) * 5;
  3135. return new RectangleF(rectangleF.X - tempLess, rectangleF.Y - tempLess, rectangleF.Width + tempPlus, rectangleF.Height + tempPlus);
  3136. }
  3137. else
  3138. {
  3139. if (pointfArr[0].X > pointfArr[1].X)
  3140. rectangleF.X = pointfArr[1].X;
  3141. else
  3142. rectangleF.X = pointfArr[0].X;
  3143. if (pointfArr[0].Y > pointfArr[1].Y)
  3144. rectangleF.Y = pointfArr[1].Y;
  3145. else
  3146. rectangleF.Y = pointfArr[0].Y;
  3147. rectangleF.Width = Math.Abs(pointfArr[1].X - pointfArr[0].X);
  3148. rectangleF.Height = Math.Abs(pointfArr[1].Y - pointfArr[0].Y);
  3149. int tempLess = (int)(InvariantData.rectless * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1)) * 5;
  3150. int tempPlus = (int)(InvariantData.rectplus * (this.documentWorkspace.ScaleFactor.Ratio < 1 ? 1 / this.documentWorkspace.ScaleFactor.Ratio : 1)) * 5;
  3151. return new RectangleF(rectangleF.X - tempLess, rectangleF.Y - tempLess, rectangleF.Width + tempPlus, rectangleF.Height + tempPlus);
  3152. }
  3153. }
  3154. /// <summary>
  3155. /// 向数据展示表插入数据
  3156. /// </summary>
  3157. private void AddContentToDataGridView()
  3158. {
  3159. PointF[] pf = pointList[lineCount - 1];
  3160. DataGridViewRow row = new DataGridViewRow();
  3161. row.Height = 33;
  3162. row.Cells.Add(CreateTextBoxCell("L" + (lineCount), ""));
  3163. //完全脱碳层
  3164. if (pf[2] == PointF.Empty)
  3165. row.Cells.Add(CreateTextBoxCell("0", ""));
  3166. else
  3167. row.Cells.Add(CreateTextBoxCell(Math.Round((BasicCalculationHelper.GetDistance(pf[2], pf[0], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength), (int)this.numericUpDown1.Value)/*.ToString("F" + this.numericUpDown1.Value)*/ + "", ""));
  3168. //有效脱碳层
  3169. if (pf[3] == PointF.Empty)
  3170. row.Cells.Add(CreateTextBoxCell("0", ""));
  3171. else
  3172. row.Cells.Add(CreateTextBoxCell(Math.Round((BasicCalculationHelper.GetDistance(pf[3], pf[0], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength), (int)this.numericUpDown1.Value)/*.ToString("F" + this.numericUpDown1.Value)*/ + "", ""));
  3173. //部分脱碳层
  3174. if (pf[2] == PointF.Empty)
  3175. row.Cells.Add(CreateTextBoxCell("0", ""));
  3176. else
  3177. row.Cells.Add(CreateTextBoxCell(Math.Round((BasicCalculationHelper.GetDistance(pf[1], pf[2], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength), (int)this.numericUpDown1.Value)/*.ToString("F" + this.numericUpDown1.Value)*/ + "", ""));
  3178. //总脱碳层
  3179. row.Cells.Add(CreateTextBoxCell(Math.Round((BasicCalculationHelper.GetDistance(pf[1], pf[0], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength), (int)this.numericUpDown1.Value)/*.ToString("F" + this.numericUpDown1.Value)*/ + "", ""));
  3180. //自由铁素体深度
  3181. if (pf[4] != PointF.Empty && pf[5] != PointF.Empty)
  3182. row.Cells.Add(CreateTextBoxCell(Math.Round((BasicCalculationHelper.GetDistance(pf[4], pf[5], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength), (int)this.numericUpDown1.Value)/*.ToString("F" + this.numericUpDown1.Value)*/ + "", ""));
  3183. else
  3184. row.Cells.Add(CreateTextBoxCell("0", ""));
  3185. if (this.dataGridView1.Rows.Count == 0)
  3186. {
  3187. this.dataGridView1.Rows.Add(row);
  3188. DataGridViewRow rowAvg = new DataGridViewRow();
  3189. rowAvg.Height = 33;
  3190. rowAvg.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.Image.Average.Text"), ""));
  3191. rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(1), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  3192. rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(2), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  3193. rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(3), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  3194. rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(4), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  3195. rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(5), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  3196. this.dataGridView1.Rows.Add(rowAvg);
  3197. }
  3198. else
  3199. {
  3200. this.dataGridView1.Rows.Insert(lineCount - 1, row);
  3201. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[1].Value = Math.Round(CalculateAverage(1), Convert.ToInt32(this.numericUpDown1.Value));
  3202. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[2].Value = Math.Round(CalculateAverage(2), Convert.ToInt32(this.numericUpDown1.Value));
  3203. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[3].Value = Math.Round(CalculateAverage(3), Convert.ToInt32(this.numericUpDown1.Value));
  3204. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[4].Value = Math.Round(CalculateAverage(4), Convert.ToInt32(this.numericUpDown1.Value));
  3205. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[5].Value = Math.Round(CalculateAverage(5), Convert.ToInt32(this.numericUpDown1.Value));
  3206. }
  3207. if(this.dataGridView1.Rows.Count > 1)
  3208. {
  3209. double avgTuotan = 0;
  3210. double avgZiyou = 0;
  3211. double maxTuotan = 0;
  3212. for (int i = 0; i < this.dataGridView1.Rows.Count - 1; i++)
  3213. {
  3214. double temp = double.Parse(this.dataGridView1.Rows[i].Cells[4].Value.ToString());
  3215. avgTuotan += temp;
  3216. avgZiyou += double.Parse(this.dataGridView1.Rows[i].Cells[5].Value.ToString());
  3217. if (temp > maxTuotan)
  3218. maxTuotan = temp;
  3219. }
  3220. foreach (DataGridViewRow dtRow in this.dataGridView1.Rows)
  3221. {
  3222. dtRow.Cells[6].Value = Math.Round(avgTuotan / (this.dataGridView1.Rows.Count - 1), Convert.ToInt32(this.numericUpDown1.Value));
  3223. dtRow.Cells[7].Value = Math.Round(avgZiyou / (this.dataGridView1.Rows.Count - 1), Convert.ToInt32(this.numericUpDown1.Value));
  3224. dtRow.Cells[8].Value = Math.Round(maxTuotan, Convert.ToInt32(this.numericUpDown1.Value));
  3225. }
  3226. }
  3227. this.dataGridView1.ClearSelection();
  3228. this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 2].Selected = true;
  3229. }
  3230. /// <summary>
  3231. /// 计算指定索引列的平均值
  3232. /// </summary>
  3233. /// <param name="ColumnIndex"></param>
  3234. /// <returns></returns>
  3235. private double CalculateAverage(int ColumnIndex)
  3236. {
  3237. double sum = 0;
  3238. double avg = 0;
  3239. if (this.dataGridView1.Rows.Count > 0)
  3240. {
  3241. for (int i = 0; i < lineCount; i++)
  3242. {
  3243. try
  3244. {
  3245. double cellValue = double.Parse(string.IsNullOrEmpty(this.dataGridView1.Rows[i].Cells[ColumnIndex].Value.ToString()) ? "0" :
  3246. this.dataGridView1.Rows[i].Cells[ColumnIndex].Value.ToString());
  3247. sum += cellValue;
  3248. }
  3249. catch (Exception e)
  3250. {
  3251. continue;
  3252. }
  3253. }
  3254. avg = sum / lineCount;
  3255. }
  3256. return avg;
  3257. }
  3258. /// <summary>
  3259. /// 分析结果列表选择切换
  3260. /// </summary>
  3261. /// <param name="sender"></param>
  3262. /// <param name="e"></param>
  3263. private void listView2_SelectedIndexChanged(object sender, EventArgs e)
  3264. {
  3265. if (this.showAll)
  3266. return;
  3267. RefreshDataGridView2();
  3268. }
  3269. /// <summary>
  3270. /// 刷新数据展示表
  3271. /// </summary>
  3272. private void RefreshDataGridView1()
  3273. {
  3274. int selectedRowIndex = -1;
  3275. if (this.dataGridView1.Rows.Count > 0)
  3276. selectedRowIndex = this.dataGridView1.SelectedRows[0].Index;
  3277. this.dataGridView1.Rows.Clear();
  3278. for(int i = 0; i < pointList.Count; i++)
  3279. {
  3280. PointF[] pf = pointList[i];
  3281. DataGridViewRow row = new DataGridViewRow();
  3282. row.Height = 33;
  3283. row.Cells.Add(CreateTextBoxCell("L" + (i + 1), ""));
  3284. //完全脱碳层
  3285. if (pf[2] == PointF.Empty)
  3286. row.Cells.Add(CreateTextBoxCell("0", ""));
  3287. else
  3288. row.Cells.Add(CreateTextBoxCell(Math.Round((BasicCalculationHelper.GetDistance(pf[2], pf[0], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength), (int)this.numericUpDown1.Value)/*.ToString("F" + this.numericUpDown1.Value)*/ + "", ""));
  3289. //有效脱碳层
  3290. if (pf[3] == PointF.Empty)
  3291. row.Cells.Add(CreateTextBoxCell("0", ""));
  3292. else
  3293. row.Cells.Add(CreateTextBoxCell(Math.Round((BasicCalculationHelper.GetDistance(pf[3], pf[0], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength), (int)this.numericUpDown1.Value)/*.ToString("F" + this.numericUpDown1.Value)*/ + "", ""));
  3294. //部分脱碳层
  3295. if (pf[2] == PointF.Empty)
  3296. row.Cells.Add(CreateTextBoxCell("0", ""));
  3297. else
  3298. row.Cells.Add(CreateTextBoxCell(Math.Round((BasicCalculationHelper.GetDistance(pf[1], pf[2], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength), (int)this.numericUpDown1.Value)/*.ToString("F" + this.numericUpDown1.Value)*/ + "", ""));
  3299. //总脱碳层
  3300. row.Cells.Add(CreateTextBoxCell(Math.Round((BasicCalculationHelper.GetDistance(pf[1], pf[0], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength), (int)this.numericUpDown1.Value)/*.ToString("F" + this.numericUpDown1.Value)*/ + "", ""));
  3301. //自由铁素体深度
  3302. if (pf[4] != PointF.Empty && pf[5] != PointF.Empty)
  3303. row.Cells.Add(CreateTextBoxCell(Math.Round((BasicCalculationHelper.GetDistance(pf[4], pf[5], Convert.ToInt32(this.numericUpDown1.Value)) * unitLength), (int)this.numericUpDown1.Value)/*.ToString("F" + this.numericUpDown1.Value)*/ + "", ""));
  3304. else
  3305. row.Cells.Add(CreateTextBoxCell("0", ""));
  3306. this.dataGridView1.Rows.Add(row);
  3307. }
  3308. if (this.dataGridView1.Rows.Count > 0)
  3309. {
  3310. DataGridViewRow rowAvg = new DataGridViewRow();
  3311. rowAvg.Height = 33;
  3312. rowAvg.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.Image.Average.Text"), ""));
  3313. rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(1), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  3314. rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(2), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  3315. rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(3), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  3316. rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(4), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  3317. rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(5), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));
  3318. this.dataGridView1.Rows.Add(rowAvg);
  3319. }
  3320. if (this.dataGridView1.Rows.Count > 1)
  3321. {
  3322. double avgTuotan = 0;
  3323. double avgZiyou = 0;
  3324. double maxTuotan = 0;
  3325. for (int i = 0; i < this.dataGridView1.Rows.Count - 1; i++)
  3326. {
  3327. double temp = double.Parse(this.dataGridView1.Rows[i].Cells[4].Value.ToString());
  3328. avgTuotan += temp;
  3329. avgZiyou += double.Parse(this.dataGridView1.Rows[i].Cells[5].Value.ToString());
  3330. if (temp > maxTuotan)
  3331. maxTuotan = temp;
  3332. }
  3333. foreach (DataGridViewRow dtRow in this.dataGridView1.Rows)
  3334. {
  3335. dtRow.Cells[6].Value = Math.Round(avgTuotan / (this.dataGridView1.Rows.Count - 1), Convert.ToInt32(this.numericUpDown1.Value));
  3336. dtRow.Cells[7].Value = Math.Round(avgZiyou / (this.dataGridView1.Rows.Count - 1), Convert.ToInt32(this.numericUpDown1.Value));
  3337. dtRow.Cells[8].Value = Math.Round(maxTuotan, Convert.ToInt32(this.numericUpDown1.Value));
  3338. }
  3339. }
  3340. this.dataGridView1.ClearSelection();
  3341. if (selectedRowIndex > this.dataGridView1.Rows.Count - 1)
  3342. selectedRowIndex = this.dataGridView1.Rows.Count - 1;
  3343. if (selectedRowIndex < 0)
  3344. selectedRowIndex = 0;
  3345. if (this.dataGridView1.Rows.Count > 0)
  3346. this.dataGridView1.Rows[selectedRowIndex].Selected = true;
  3347. }
  3348. /// <summary>
  3349. /// 格式化坐标点
  3350. /// </summary>
  3351. /// <param name="coordinateA">参考点1</param>
  3352. /// <param name="coordinateB">参考点2</param>
  3353. /// <param name="basicCoordinate">需比对的点</param>
  3354. /// <returns></returns>
  3355. private float FormatCoordinate(float coordinateA, float coordinateB, float basicCoordinate)
  3356. {
  3357. float coordinate = basicCoordinate;
  3358. float[] pointArr = new float[] { coordinateA, coordinateB };
  3359. if (coordinate > pointArr.Max() - 3)
  3360. coordinate = pointArr.Max() - 3;
  3361. if (coordinate < pointArr.Min() + 3)
  3362. coordinate = pointArr.Min() + 3;
  3363. return coordinate;
  3364. }
  3365. /// <summary>
  3366. /// 计算数组内线外的一点到钢表面的垂足
  3367. /// </summary>
  3368. /// <param name="pointfArr"></param>
  3369. /// <returns></returns>
  3370. private PointF CalCulateDropFeet(PointF[] pointfArr)
  3371. {
  3372. PointF dropFeetPoint = PointF.Empty;
  3373. float lineLength = this.trackBar1.Value / 2f;
  3374. double angle = Math.Round(BasicCalculationHelper.AngleText(pointfArr[0], pointfArr[1], new PointF(pointfArr[0].X + lineLength, pointfArr[0].Y)), 10);
  3375. //判断第二个点相对于第一个点的象限
  3376. int x2 = (int)(pointfArr[1].X - pointfArr[0].X);
  3377. if (x2 == 0)
  3378. x2 = 1;
  3379. int y2 = (int)(pointfArr[1].Y - pointfArr[0].Y);
  3380. if (y2 == 0)
  3381. y2 = 1;
  3382. int i2 = 0;
  3383. if (x2 > 0 && y2 > 0) //第4象限
  3384. {
  3385. i2 = 4;
  3386. }
  3387. else if (x2 > 0 && y2 < 0) //第1象限
  3388. {
  3389. i2 = 1;
  3390. }
  3391. else if (x2 < 0 && y2 < 0) //第2象限
  3392. {
  3393. i2 = 2;
  3394. }
  3395. else if (x2 < 0 && y2 > 0) //第3象限
  3396. {
  3397. i2 = 3;
  3398. }
  3399. double sAngle2;
  3400. double eAngle2;
  3401. if (i2 == 1 || i2 == 2)
  3402. {
  3403. sAngle2 = 270 - angle;
  3404. eAngle2 = 90 - angle;
  3405. }
  3406. else
  3407. {
  3408. sAngle2 = 270 + angle;
  3409. eAngle2 = 90 + angle;
  3410. }
  3411. if (!double.IsNaN(sAngle2) && !double.IsNaN(eAngle2))
  3412. {
  3413. PointF assistPoint1 = BasicCalculationHelper.GetAnglePoint(new PointF((pointfArr[0].X + lineLength), pointfArr[0].Y), pointfArr[0], sAngle2);
  3414. PointF assistPoint2 = BasicCalculationHelper.GetAnglePoint(new PointF((pointfArr[0].X + lineLength), pointfArr[0].Y), pointfArr[0], eAngle2);
  3415. dropFeetPoint = BasicCalculationHelper.GetDropFeet(assistPoint1, assistPoint2, pointfArr[4]);
  3416. }
  3417. return dropFeetPoint;
  3418. }
  3419. /// <summary>
  3420. /// 导出项目按钮
  3421. /// </summary>
  3422. /// <param name="sender"></param>
  3423. /// <param name="e"></param>
  3424. private void button10_Click(object sender, EventArgs e)
  3425. {
  3426. try
  3427. {
  3428. if (this.analyzeSettingModel == null)
  3429. {
  3430. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");
  3431. return;
  3432. }
  3433. //获取项目工程内的文件夹路径
  3434. ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.SteelDecarburization.Text", this.analyzeSettingModel.savePath);
  3435. if (item != null)
  3436. {
  3437. //向文件夹内保存图片和报告
  3438. if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))
  3439. {
  3440. //获取word书签与excel单元格的关系,以字典方式存储
  3441. List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);
  3442. Dictionary<string, string> tagInfos = new Dictionary<string, string>();
  3443. if (mic_module_infos != null && mic_module_infos.Count > 0)
  3444. {
  3445. foreach (mic_module_infos info in mic_module_infos)
  3446. {
  3447. tagInfos.Add(info.tag_name, info.cell_position);
  3448. }
  3449. }
  3450. //分析结果
  3451. List<List<string>> analysisContent = new List<List<string>>();
  3452. List<string> contentHead = new List<string>();
  3453. contentHead.Add(PdnResources.GetString("Menu.picture.Text"));
  3454. contentHead.Add(PdnResources.GetString("Menu.packet.text"));
  3455. contentHead.Add(PdnResources.GetString("Menu.Completelydecarburizedlayer.text"));
  3456. contentHead.Add(PdnResources.GetString("Menu.Effectivedecarbonizationlayer.text"));
  3457. contentHead.Add(PdnResources.GetString("Menu.Partiallydecarburizedlayer.text"));
  3458. contentHead.Add(PdnResources.GetString("Menu.Totaldecarburizationlayer.text"));
  3459. contentHead.Add(PdnResources.GetString("Menu.Freeferritedepth.text"));
  3460. contentHead.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Averagedezationlayer.text"));
  3461. contentHead.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Meanfreeferritedepth.text"));
  3462. contentHead.Add(PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.iondepth.text"));
  3463. analysisContent.Add(contentHead);
  3464. foreach (DataGridViewRow rowItem in this.dataGridView2.Rows)
  3465. {
  3466. List<string> content = new List<string>();
  3467. content.Add(rowItem.Cells[0].Value.ToString());
  3468. content.Add(rowItem.Cells[1].Value.ToString());
  3469. content.Add(rowItem.Cells[2].Value.ToString());
  3470. content.Add(rowItem.Cells[3].Value.ToString());
  3471. content.Add(rowItem.Cells[4].Value.ToString());
  3472. content.Add(rowItem.Cells[5].Value.ToString());
  3473. content.Add(rowItem.Cells[6].Value.ToString());
  3474. content.Add(rowItem.Cells[7].Value.ToString());
  3475. content.Add(rowItem.Cells[8].Value.ToString());
  3476. content.Add(rowItem.Cells[9].Value.ToString());
  3477. analysisContent.Add(content);
  3478. }
  3479. //图片
  3480. bitList = new List<Bitmap>();
  3481. if (this.showAll)
  3482. {
  3483. foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)
  3484. {
  3485. bitList.Add(kv.Value[0]);
  3486. bitList.Add(kv.Value[1]);
  3487. }
  3488. }
  3489. else
  3490. {
  3491. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  3492. {
  3493. foreach (ListViewItem rowItem in this.listView2.SelectedItems)
  3494. {
  3495. if (bitDic.ContainsKey(rowItem.Name))
  3496. {
  3497. bitList.Add(bitDic[rowItem.Name][0]);
  3498. bitList.Add(bitDic[rowItem.Name][1]);
  3499. }
  3500. }
  3501. }
  3502. }
  3503. //中间数据
  3504. if (!this.showAll)
  3505. {
  3506. if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
  3507. {
  3508. List<ExportProjectModel> exportModel = new List<ExportProjectModel>();
  3509. foreach (ListViewItem rowItem in this.listView2.SelectedItems)
  3510. {
  3511. foreach (ExportProjectModel model in this.tempDataModel)
  3512. {
  3513. if (model.tagName.Equals(rowItem.Name))
  3514. {
  3515. ExportProjectModel tempModel = new ExportProjectModel();
  3516. tempModel.tagName = model.tagName;
  3517. tempModel.picName = model.picName;
  3518. tempModel.dataList = model.dataList;
  3519. exportModel.Add(tempModel);
  3520. break;
  3521. }
  3522. }
  3523. }
  3524. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);
  3525. }
  3526. }
  3527. else
  3528. this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, item.path, item.code);
  3529. }
  3530. else
  3531. {
  3532. MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
  3533. return;
  3534. }
  3535. //保存项目信息到数据库
  3536. this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
  3537. }
  3538. }
  3539. catch (Exception)
  3540. {
  3541. }
  3542. }
  3543. #region 参数保存及提取
  3544. /// <summary>
  3545. /// 保存参数的key,value和type
  3546. /// </summary>
  3547. /// <param name="param_key"></param>
  3548. /// <param name="param_value"></param>
  3549. /// <param name="param_type"></param>
  3550. private void saveParamValue(string param_key, string param_value, int param_type)
  3551. {
  3552. bool foundItem = false;
  3553. foreach (var item in this.analysisModel.ListParam)
  3554. {
  3555. if (item.param_key.Equals(param_key) && item.menuId == this.menuId)
  3556. {
  3557. item.param_value = param_value;
  3558. item.setValue();
  3559. foundItem = true;
  3560. break;
  3561. }
  3562. }
  3563. if (!foundItem)
  3564. {
  3565. GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();
  3566. analysisItem.menuId = this.menuId;
  3567. analysisItem.param_key = param_key;
  3568. analysisItem.param_type = param_type;
  3569. analysisItem.param_value = param_value;
  3570. analysisItem.setValue();
  3571. this.analysisModel.ListParam.Add(analysisItem);
  3572. }
  3573. }
  3574. /// <summary>
  3575. /// 保存界面中的参数到model
  3576. /// </summary>
  3577. private void saveDialogParamValues()
  3578. {
  3579. saveParamValue(ParamKey_Report, checkBox1.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//报告设置
  3580. saveParamValue(ParamKey_LineLength, trackBar1 != null ? trackBar1.Value.ToString() : "40", (int)Base.Dtryt.Interger);//线长
  3581. saveParamValue(ParamKey_LineWidth, trackBar2 != null ? trackBar2.Value.ToString() : "3", (int)Base.Dtryt.Interger);//线宽
  3582. saveParamValue(ParamKey_Baseline, panel1.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//基准线颜色
  3583. saveParamValue(ParamKey_Surface, panel2.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//钢样表面颜色
  3584. saveParamValue(ParamKey_Free, checkBox7.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//自由
  3585. saveParamValue(ParamKey_FreeColour, panel6.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//自由颜色
  3586. saveParamValue(ParamKey_Whole, checkBox4.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//完全
  3587. saveParamValue(ParamKey_WholeColour, panel3.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//完全颜色
  3588. saveParamValue(ParamKey_Valid, checkBox5.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//有效
  3589. saveParamValue(ParamKey_ValidColour, panel4.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//有效颜色
  3590. saveParamValue(ParamKey_Part, checkBox6.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//部分
  3591. saveParamValue(ParamKey_PartColour, panel5.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//部分颜色
  3592. saveParamValue(ParamKey_WholeGauge, checkBox2.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//完全测量
  3593. saveParamValue(ParamKey_ValidGauge, checkBox3.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//有效测量
  3594. saveParamValue(ParamKey_DecimalPlace, numericUpDown1 != null ? numericUpDown1.Value.ToString() : "", (int)Base.Dtryt.Decimal);//保留小数位数
  3595. }
  3596. /// <summary>
  3597. /// 获取保存的参数
  3598. /// </summary>
  3599. private void GetListParamModel()
  3600. {
  3601. if (this.analysisModel != null)
  3602. {
  3603. for (int i = 0; i < this.analysisModel.ListParam.Count; i++)
  3604. {
  3605. switch (this.analysisModel.ListParam[i].param_key)
  3606. {
  3607. case ParamKey_Report:
  3608. checkBox1.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3609. break;
  3610. case ParamKey_LineLength:
  3611. trackBar1.Value = (int)this.analysisModel.ListParam[i].value;
  3612. textBox1.Text = "" + trackBar1.Value;
  3613. break;
  3614. case ParamKey_LineWidth:
  3615. trackBar2.Value = (int)this.analysisModel.ListParam[i].value;
  3616. textBox2.Text = "" + trackBar2.Value;
  3617. break;
  3618. case ParamKey_Baseline:
  3619. panel1.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
  3620. break;
  3621. case ParamKey_Surface:
  3622. panel2.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
  3623. break;
  3624. case ParamKey_Free:
  3625. checkBox7.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3626. break;
  3627. case ParamKey_FreeColour:
  3628. panel6.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
  3629. break;
  3630. case ParamKey_Whole:
  3631. checkBox4.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3632. break;
  3633. case ParamKey_WholeColour:
  3634. panel3.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
  3635. break;
  3636. case ParamKey_Valid:
  3637. checkBox5.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3638. break;
  3639. case ParamKey_ValidColour:
  3640. panel4.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
  3641. break;
  3642. case ParamKey_Part:
  3643. checkBox6.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3644. break;
  3645. case ParamKey_PartColour:
  3646. panel5.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);
  3647. break;
  3648. case ParamKey_WholeGauge:
  3649. checkBox2.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3650. break;
  3651. case ParamKey_ValidGauge:
  3652. checkBox3.Checked = (Boolean)this.analysisModel.ListParam[i].value;
  3653. break;
  3654. case ParamKey_DecimalPlace:
  3655. numericUpDown1.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);
  3656. break;
  3657. }
  3658. }
  3659. }
  3660. }
  3661. private void MetallographicMethod1077Dialog_FormClosing(object sender, FormClosingEventArgs e)
  3662. {
  3663. #region [开启脚本录制]
  3664. if (appWorkspace.startScriptRecording)
  3665. {
  3666. getScriptRecording();
  3667. }
  3668. #endregion
  3669. this.saveDialogParamValues();
  3670. //xml保存路径
  3671. string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";
  3672. GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));
  3673. foreach (var analysisItem in this.analysisModel.ListParam)
  3674. {
  3675. bool foundItem = false;
  3676. foreach (var item in analysisModelXml.ListParam)
  3677. {
  3678. if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)
  3679. {
  3680. item.param_value = analysisItem.param_value;
  3681. foundItem = true;
  3682. break;
  3683. }
  3684. }
  3685. if (!foundItem)
  3686. analysisModelXml.ListParam.Add(analysisItem.cloneModel());
  3687. }
  3688. //按路径和名称保存xml文件
  3689. string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);
  3690. //保存xml
  3691. FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);
  3692. }
  3693. #endregion
  3694. #region [脚本相关]
  3695. private void getValue(string key, object value)
  3696. {
  3697. switch (key)
  3698. {
  3699. case "parameter1":
  3700. trackBar1.Value = Convert.ToInt32(value);
  3701. textBox1.Text = value.ToString();
  3702. break;
  3703. case "parameter2":
  3704. trackBar2.Value = Convert.ToInt32(value);
  3705. textBox2.Text = value.ToString();
  3706. break;
  3707. case "parameter3":
  3708. panel1.BackColor = Color.FromArgb((int)value);
  3709. break;
  3710. case "parameter4":
  3711. checkBox4.Checked = Convert.ToBoolean(value);
  3712. break;
  3713. case "parameter5":
  3714. panel3.BackColor = Color.FromArgb((int)value);
  3715. break;
  3716. case "parameter6":
  3717. panel2.BackColor = Color.FromArgb((int)value);
  3718. break;
  3719. case "parameter7":
  3720. checkBox5.Checked = Convert.ToBoolean(value);
  3721. break;
  3722. case "parameter8":
  3723. panel4.BackColor = Color.FromArgb((int)value);
  3724. break;
  3725. case "parameter9":
  3726. checkBox6.Checked = Convert.ToBoolean(value);
  3727. break;
  3728. case "parameter10":
  3729. panel5.BackColor = Color.FromArgb((int)value);
  3730. break;
  3731. case "parameter11":
  3732. checkBox2.Checked = Convert.ToBoolean(value);
  3733. break;
  3734. case "parameter12":
  3735. checkBox3.Checked = Convert.ToBoolean(value);
  3736. break;
  3737. case "parameter13":
  3738. panel6.BackColor = Color.FromArgb((int)value);
  3739. break;
  3740. case "parameter14":
  3741. checkBox7.Checked = Convert.ToBoolean(value);
  3742. break;
  3743. case "OpenWhileExportReport":
  3744. checkBox1.Checked = Convert.ToBoolean(value);
  3745. break;
  3746. case "CalculatorDecimalDigits":
  3747. numericUpDown1.Value = Convert.ToDecimal(value);
  3748. break;
  3749. }
  3750. }
  3751. #endregion
  3752. #region [脚本录制]
  3753. private void getScriptRecording()
  3754. {
  3755. string className = InvariantData.path_Action + ".Action" + menuId;
  3756. ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);
  3757. List<Args> args = param.Lists;
  3758. foreach (var item in args)
  3759. {
  3760. item.value = setScriptRecording(item.key);
  3761. }
  3762. appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
  3763. }
  3764. private object setScriptRecording(string key)
  3765. {
  3766. object value = null;
  3767. switch (key)
  3768. {
  3769. case "parameter1":
  3770. value = trackBar1.Value;
  3771. break;
  3772. case "parameter2":
  3773. value = trackBar2.Value;
  3774. break;
  3775. case "parameter3":
  3776. value = panel1.BackColor.ToArgb();
  3777. break;
  3778. case "parameter4":
  3779. value = checkBox4.Checked;
  3780. break;
  3781. case "parameter5":
  3782. value = panel3.BackColor.ToArgb();
  3783. break;
  3784. case "parameter6":
  3785. value = panel2.BackColor.ToArgb();
  3786. break;
  3787. case "parameter7":
  3788. value = checkBox5.Checked;
  3789. break;
  3790. case "parameter8":
  3791. value = panel4.BackColor.ToArgb();
  3792. break;
  3793. case "parameter9":
  3794. value = checkBox6.Checked;
  3795. break;
  3796. case "parameter10":
  3797. value = panel5.BackColor.ToArgb();
  3798. break;
  3799. case "parameter11":
  3800. value = checkBox2.Checked;
  3801. break;
  3802. case "parameter12":
  3803. value = checkBox3.Checked;
  3804. break;
  3805. case "parameter13":
  3806. value = panel6.BackColor.ToArgb();
  3807. break;
  3808. case "parameter14":
  3809. value = checkBox7.Checked;
  3810. break;
  3811. case "OpenWhileExportReport":
  3812. value = checkBox1.Checked;
  3813. break;
  3814. case "CalculatorDecimalDigits":
  3815. value = numericUpDown1.Value;
  3816. break;
  3817. }
  3818. return value;
  3819. }
  3820. #endregion
  3821. }
  3822. }