MetallographicMethod1077Dialog.cs 206 KB

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