| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450 | using Metis.ParameterSet;using OpenCvSharp.Extensions;using PaintDotNet.Base;using PaintDotNet.Base.CommTool;using PaintDotNet.Base.Functionodel;using PaintDotNet.CustomControl;using PaintDotNet.Data.Param;using PaintDotNet.DbOpreate.DbBll;using PaintDotNet.DbOpreate.DbModel;using PaintDotNet.Instrument;using System;using System.Collections;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.Entity.Migrations.Infrastructure;using System.Diagnostics.Contracts;using System.Drawing;using System.Drawing.Drawing2D;using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace PaintDotNet.DedicatedAnalysis{    /// <summary>    /// 边部质量    /// </summary>    internal class QualityOfEdgeDialog : PdnBaseForm    {        #region 基础控件        private Button button1;        private CheckBox checkBox1;        private Button button2;        private GroupBox groupBox2;        private ListView listView1;        private GroupBox groupBox3;        private GroupBox groupBox4;        private Button button5;        private Button button4;        private Button button3;        private GroupBox groupBox5;        private TextBox textBox2;        private Label label2;        private GroupBox groupBox6;        private Panel panel1;        private Label label4;        private Label label3;        private Panel panel2;        private GroupBox groupBox8;        private DataGridView dataGridView1;        private GroupBox groupBox9;        private Button button6;        private Button button7;        private ListView listView2;        private DataGridView dataGridView2;        private Button button9;        private Button button8;        private NumericUpDown numericUpDown1;        private Label label8;        private Label label9;        private Label label10;        private ImageList imageList1;        private IContainer components;        private GroupBox groupBox1;        private TrackBar trackBar2;        private Label label5;        private ComboBox comboBox1;        private Label label1;        private Label label11;        private TextBox textBox3;        private Label label7;        private TextBox textBox1;        private Label label6;        private RichTextBox richTextBox1;        private Button button10;        #endregion        /// <summary>        /// 调色板        /// </summary>        PaintDotNet.ColorsForm colorsForm1;        PaintDotNet.ColorsForm colorsForm2;        /// <summary>        /// 主控件        /// </summary>        private AppWorkspace appWorkspace;        /// <summary>        /// 图像面板        /// </summary>        private DocumentWorkspaceWindow documentWorkspace;        /// <summary>        /// 公共按钮        /// </summary>        private CommonControlButtons commonControlButtons;        /// <summary>        /// 选中图片的bitmap        /// </summary>        private Bitmap bitmap;        /// <summary>        /// 0:添加 1:选择 2:删除        /// </summary>        private int operationK = -1;        /// <summary>        /// 被选择的线        /// </summary>        private int selected = -1;        /// <summary>        /// 起止点        /// </summary>        private System.Drawing.PointF startPoint, endPoint;        /// <summary>        /// 存储所有线的点集合        /// </summary>        private List<PointF[]> pointList = new List<PointF[]>();        /// <summary>        /// 存储各测量线对象的外接矩形        /// </summary>        public List<RectangleF> rectangleFList = new List<RectangleF>();        /// <summary>        /// 存储当前线的点集合        /// </summary>        private PointF[] nowLine;        /// <summary>        /// 线的总数        /// </summary>        private int lineCount = 0;        /// <summary>        /// 计算结果的表格集合        /// </summary>        private List<DataTable> resultTableList = new List<DataTable>();        /// <summary>        /// 保存用于生成报告的图片        /// </summary>        private List<Bitmap> bitList;        /// <summary>        /// 储存点击保存结果后的所有原图与分析图        /// </summary>        private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();        /// <summary>        /// 是否显示全部        /// </summary>        private bool showAll = false;        /// <summary>        /// 辅助计算偏移量-移动线两端的点        /// </summary>        private PointF lastPoint = new PointF(0, 0);        /// <summary>        /// 辅助计算偏移量-移动线中间的点        /// </summary>        private PointF tempPoint = new PointF(0, 0);        /// <summary>        /// 判断图形是否可移动        /// </summary>        private bool canMove = false;        /// <summary>        /// 移动线上的哪一个点        /// </summary>        private int movePointIndex = -1;        /// <summary>        /// 点击次数        /// </summary>        private int clickCount = 0;        /// <summary>        /// 水印字号下拉选        /// </summary>        int[] fontSizes = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };        /// <summary>        /// 单位标尺-微米        /// </summary>        private double unitLengthUm = 1;        /// <summary>        /// 单位标尺-毫米        /// </summary>        private double unitLengthMm = 1;        /// <summary>        /// 三点角度        /// </summary>        private double threePointAngle;        /// <summary>        /// 厚度        /// </summary>        private double thickness;        /// <summary>        /// 厚度        /// </summary>        private double otherThickness;        /// <summary>        /// burr        /// </summary>        private double burr;        /// <summary>        /// 基础计算结果的集合        /// </summary>        private List<Dictionary<string, double>> calcDic;        private ToolTip toolTip1;        /// <summary>        /// 中间数据        /// </summary>        private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();        private NumericUpDown comboBox2;        private int defaultIndex = -1;        private int menuId;        private string menuName;        /// <summary>        /// 是否脚本运行        /// </summary>        private Boolean initScriptValues = false;        // <summary>        /// 保存窗口参数        /// </summary>        private GrainSizeAnalysisModel analysisModel;        private const string ParamKey_Report = "report";//报告设置        private const string ParamKey_Brand = "brand";//合金牌号        private const string ParamKey_ReelNumber = "reelNumber";//卷号        private const string ParamKey_Remarks = "remarks";//备注        private const string ParamKey_LineWidth = "lineWidth";//线宽        private const string ParamKey_LineColour = "lineColour";//线颜色        private const string ParamKey_FontStyle = "fontStyle";//字体        private const string ParamKey_FontSize = "fontSize";//字号        private const string ParamKey_FontColour = "fontColour";//字颜色        private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数        public QualityOfEdgeDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem)        {            this.menuId = menuItem.MenuId;            this.menuName = menuItem.Text;            string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";            GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));            this.analysisModel = analysisModelXml.cloneListParamModel(this.menuId);            foreach (var item in this.analysisModel.ListParam)                item.setValue();            this.appWorkspace = appWorkspace;            InitializeComponent();            InitializeLanguageText();            InitGridHeader();            InitOtherTools();            //如果是脚本执行,将参数带入            if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null)            {                this.initScriptValues = true;//ScriptAutomatic                                             //Boolean initScriptValues = true;                                             ////在这里反射出对应功能的参数类                string className = InvariantData.path_Action + ".Action" + menuId;                ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);                foreach (Args arg in param.Lists)                {                    Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key));                    if (param1.value != null)                        arg.Value = param1.value;                    getValue(arg.key, arg.Value);                }                appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数            }            else            {//读取上次关闭窗口时保存的参数                GetListParamModel();            }            InitPicList();            InitCommonButtonEvent();            AddPictureBoxEvent();            SetAnalyzeModelFromXml("Template.Manager.item3.QualityOfEdge");        }        private void ShowImgEvent(object sender, EventArgs e)        {            listView1.Focus();            if (this.defaultIndex != -1)            {                this.listView1.Items[defaultIndex].Focused = true;                this.listView1.Items[defaultIndex].Selected = true;            }        }        private void comboBox1_MouseEnter(object sender, EventArgs e)        {            toolTip1.SetToolTip(comboBox1, comboBox1.Text);        }        private void InitializeLanguageText()         {            this.Text = PdnResources.GetString("Menu.DedicatedAnalysis.NonferrousMetal.QualityOfEdge.Text");            this.button10.Text = PdnResources.GetString("Menu.Exportproject.text");            this.button6.Text = PdnResources.GetString("Menu.Showall.text");            this.button7.Text = PdnResources.GetString("Menu.Edit.Delete.Text");            this.button8.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");            this.button9.Text = PdnResources.GetString("Menu.Exportresults.text");            this.label8.Text = PdnResources.GetString("Menu.Decimal.text") + ":";            this.groupBox9.Text = PdnResources.GetString("Menu.Analysisresult.text");            this.groupBox8.Text = PdnResources.GetString("Menu.Resultspreview.text");            this.label3.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.Linecolor.text") + ":";            this.label4.Text = PdnResources.GetString("Menu.fontcolor.text") + ":";            this.label1.Text = PdnResources.GetString("Menu.Font.text") + ":";            this.label5.Text = PdnResources.GetString("Menu.Fontsize.text") + ":";            this.groupBox6.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.Measurementstyle.text");            this.label2.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";            this.label6.Text = PdnResources.GetString("Menu.alloydesignation.text") + ":";            this.label7.Text = PdnResources.GetString("Menu.volumenumber.text") + ":";            this.label11.Text = PdnResources.GetString("Menu.Remark.text") + ":";            this.groupBox5.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.Measurementcontent.text");            this.button3.Text = PdnResources.GetString("Menu.Addmeasuringline.text");            this.button4.Text = PdnResources.GetString("Menu.Selectmeasurementline.text");            this.button5.Text = PdnResources.GetString("Menu.Deletemeasurementline.text");            this.groupBox4.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.Measuringlinecontrol.text");            this.groupBox3.Text = PdnResources.GetString("Menu.Preview.text");            this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");            this.button1.Text = PdnResources.GetString("Menu.Setting.Text");            this.checkBox1.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");            this.button2.Text = PdnResources.GetString("Menu.Saveresult.text");            this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");        }        private void InitializeComponent()        {            this.components = new System.ComponentModel.Container();            this.groupBox1 = new System.Windows.Forms.GroupBox();            this.button2 = new System.Windows.Forms.Button();            this.checkBox1 = new System.Windows.Forms.CheckBox();            this.button1 = new System.Windows.Forms.Button();            this.groupBox2 = new System.Windows.Forms.GroupBox();            this.listView1 = new System.Windows.Forms.ListView();            this.imageList1 = new System.Windows.Forms.ImageList(this.components);            this.groupBox3 = new System.Windows.Forms.GroupBox();            this.groupBox4 = new System.Windows.Forms.GroupBox();            this.button5 = new System.Windows.Forms.Button();            this.button4 = new System.Windows.Forms.Button();            this.button3 = new System.Windows.Forms.Button();            this.groupBox5 = new System.Windows.Forms.GroupBox();            this.richTextBox1 = new System.Windows.Forms.RichTextBox();            this.label11 = new System.Windows.Forms.Label();            this.textBox3 = new System.Windows.Forms.TextBox();            this.label7 = new System.Windows.Forms.Label();            this.textBox1 = new System.Windows.Forms.TextBox();            this.label6 = new System.Windows.Forms.Label();            this.trackBar2 = new System.Windows.Forms.TrackBar();            this.textBox2 = new System.Windows.Forms.TextBox();            this.label2 = new System.Windows.Forms.Label();            this.groupBox6 = new System.Windows.Forms.GroupBox();            this.comboBox2 = new System.Windows.Forms.NumericUpDown();            this.label5 = new System.Windows.Forms.Label();            this.comboBox1 = new System.Windows.Forms.ComboBox();            this.label1 = new System.Windows.Forms.Label();            this.panel2 = new System.Windows.Forms.Panel();            this.panel1 = new System.Windows.Forms.Panel();            this.label4 = new System.Windows.Forms.Label();            this.label3 = new System.Windows.Forms.Label();            this.groupBox8 = new System.Windows.Forms.GroupBox();            this.dataGridView1 = new System.Windows.Forms.DataGridView();            this.groupBox9 = new System.Windows.Forms.GroupBox();            this.button10 = new System.Windows.Forms.Button();            this.label10 = new System.Windows.Forms.Label();            this.label9 = new System.Windows.Forms.Label();            this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();            this.label8 = new System.Windows.Forms.Label();            this.button9 = new System.Windows.Forms.Button();            this.button8 = new System.Windows.Forms.Button();            this.dataGridView2 = new System.Windows.Forms.DataGridView();            this.listView2 = new System.Windows.Forms.ListView();            this.button7 = new System.Windows.Forms.Button();            this.button6 = new System.Windows.Forms.Button();            this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);            this.groupBox1.SuspendLayout();            this.groupBox2.SuspendLayout();            this.groupBox4.SuspendLayout();            this.groupBox5.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();            this.groupBox6.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.comboBox2)).BeginInit();            this.groupBox8.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();            this.groupBox9.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();            ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();            this.SuspendLayout();            //             // groupBox1            //             this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)             | System.Windows.Forms.AnchorStyles.Right)));            this.groupBox1.Controls.Add(this.button2);            this.groupBox1.Controls.Add(this.checkBox1);            this.groupBox1.Controls.Add(this.button1);            this.groupBox1.Location = new System.Drawing.Point(14, 3);            this.groupBox1.Name = "groupBox1";            this.groupBox1.Size = new System.Drawing.Size(1081, 50);            this.groupBox1.TabIndex = 1;            this.groupBox1.TabStop = false;            //             // button2            //             this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Right)));            this.button2.Location = new System.Drawing.Point(985, 14);            this.button2.Name = "button2";            this.button2.Size = new System.Drawing.Size(84, 30);            this.button2.TabIndex = 2;            this.button2.UseVisualStyleBackColor = true;            this.button2.Click += new System.EventHandler(this.button2_Click);            //             // checkBox1            //             this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)));            this.checkBox1.AutoSize = true;            this.checkBox1.Location = new System.Drawing.Point(141, 21);            this.checkBox1.Name = "checkBox1";            this.checkBox1.Size = new System.Drawing.Size(15, 14);            this.checkBox1.TabIndex = 1;            this.checkBox1.UseVisualStyleBackColor = true;            //             // button1            //             this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)));            this.button1.Location = new System.Drawing.Point(15, 14);            this.button1.Name = "button1";            this.button1.Size = new System.Drawing.Size(84, 30);            this.button1.TabIndex = 0;            this.button1.UseVisualStyleBackColor = true;            this.button1.Click += new System.EventHandler(this.button1_Click);            //             // groupBox2            //             this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)));            this.groupBox2.Controls.Add(this.listView1);            this.groupBox2.Location = new System.Drawing.Point(14, 60);            this.groupBox2.Name = "groupBox2";            this.groupBox2.Size = new System.Drawing.Size(135, 497);            this.groupBox2.TabIndex = 2;            this.groupBox2.TabStop = false;            //             // listView1            //             this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)             | System.Windows.Forms.AnchorStyles.Right)));            this.listView1.HideSelection = false;            this.listView1.LargeImageList = this.imageList1;            this.listView1.Location = new System.Drawing.Point(5, 17);            this.listView1.MultiSelect = false;            this.listView1.Name = "listView1";            this.listView1.Size = new System.Drawing.Size(124, 474);            this.listView1.TabIndex = 0;            this.listView1.UseCompatibleStateImageBehavior = false;            this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);            //             // imageList1            //             this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;            this.imageList1.ImageSize = new System.Drawing.Size(64, 64);            this.imageList1.TransparentColor = System.Drawing.Color.Transparent;            //             // groupBox3            //             this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)             | System.Windows.Forms.AnchorStyles.Right)));            this.groupBox3.Location = new System.Drawing.Point(527, 60);            this.groupBox3.Name = "groupBox3";            this.groupBox3.Size = new System.Drawing.Size(568, 496);            this.groupBox3.TabIndex = 3;            this.groupBox3.TabStop = false;            //             // groupBox4            //             this.groupBox4.Controls.Add(this.button5);            this.groupBox4.Controls.Add(this.button4);            this.groupBox4.Controls.Add(this.button3);            this.groupBox4.Location = new System.Drawing.Point(156, 60);            this.groupBox4.Name = "groupBox4";            this.groupBox4.Size = new System.Drawing.Size(353, 58);            this.groupBox4.TabIndex = 4;            this.groupBox4.TabStop = false;            //             // button5            //             this.button5.Location = new System.Drawing.Point(203, 20);            this.button5.Name = "button5";            this.button5.Size = new System.Drawing.Size(75, 23);            this.button5.TabIndex = 2;            this.button5.UseVisualStyleBackColor = true;            this.button5.Click += new System.EventHandler(this.button5_Click);            //             // button4            //             this.button4.Location = new System.Drawing.Point(109, 20);            this.button4.Name = "button4";            this.button4.Size = new System.Drawing.Size(75, 23);            this.button4.TabIndex = 1;            this.button4.UseVisualStyleBackColor = true;            this.button4.Click += new System.EventHandler(this.button4_Click);            //             // button3            //             this.button3.Location = new System.Drawing.Point(16, 20);            this.button3.Name = "button3";            this.button3.Size = new System.Drawing.Size(75, 23);            this.button3.TabIndex = 0;            this.button3.UseVisualStyleBackColor = true;            this.button3.Click += new System.EventHandler(this.button3_Click);            //             // groupBox5            //             this.groupBox5.Controls.Add(this.richTextBox1);            this.groupBox5.Controls.Add(this.label11);            this.groupBox5.Controls.Add(this.textBox3);            this.groupBox5.Controls.Add(this.label7);            this.groupBox5.Controls.Add(this.textBox1);            this.groupBox5.Controls.Add(this.label6);            this.groupBox5.Location = new System.Drawing.Point(156, 125);            this.groupBox5.Name = "groupBox5";            this.groupBox5.Size = new System.Drawing.Size(353, 107);            this.groupBox5.TabIndex = 5;            this.groupBox5.TabStop = false;            //             // richTextBox1            //             this.richTextBox1.Location = new System.Drawing.Point(78, 55);            this.richTextBox1.Name = "richTextBox1";            this.richTextBox1.Size = new System.Drawing.Size(256, 38);            this.richTextBox1.TabIndex = 5;            this.richTextBox1.Text = "";            //             // label11            //             this.label11.AutoSize = true;            this.label11.Location = new System.Drawing.Point(7, 58);            this.label11.Name = "label11";            this.label11.Size = new System.Drawing.Size(0, 12);            this.label11.TabIndex = 4;            //             // textBox3            //             this.textBox3.Location = new System.Drawing.Point(254, 24);            this.textBox3.Name = "textBox3";            this.textBox3.Size = new System.Drawing.Size(80, 21);            this.textBox3.TabIndex = 3;            //             // label7            //             this.label7.AutoSize = true;            this.label7.Location = new System.Drawing.Point(187, 27);            this.label7.Name = "label7";            this.label7.Size = new System.Drawing.Size(0, 12);            this.label7.TabIndex = 2;            //             // textBox1            //             this.textBox1.Location = new System.Drawing.Point(78, 24);            this.textBox1.Name = "textBox1";            this.textBox1.Size = new System.Drawing.Size(100, 21);            this.textBox1.TabIndex = 1;            //             // label6            //             this.label6.AutoSize = true;            this.label6.Location = new System.Drawing.Point(7, 27);            this.label6.Name = "label6";            this.label6.Size = new System.Drawing.Size(0, 12);            this.label6.TabIndex = 0;            //             // trackBar2            //             this.trackBar2.Cursor = System.Windows.Forms.Cursors.Hand;            this.trackBar2.Location = new System.Drawing.Point(44, 20);            this.trackBar2.Maximum = 50;            this.trackBar2.Minimum = 1;            this.trackBar2.Name = "trackBar2";            this.trackBar2.Size = new System.Drawing.Size(91, 45);            this.trackBar2.TabIndex = 5;            this.trackBar2.TickStyle = System.Windows.Forms.TickStyle.None;            this.trackBar2.Value = 3;            this.trackBar2.Scroll += new System.EventHandler(this.trackBar2_Scroll);            this.trackBar2.ValueChanged += new System.EventHandler(this.trackBar2_ValueChanged);            //             // textBox2            //             this.textBox2.Location = new System.Drawing.Point(132, 19);            this.textBox2.Name = "textBox2";            this.textBox2.Size = new System.Drawing.Size(35, 21);            this.textBox2.TabIndex = 3;            this.textBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox2_KeyPress);            this.textBox2.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox2_KeyUp);            //             // label2            //             this.label2.AutoSize = true;            this.label2.Location = new System.Drawing.Point(8, 24);            this.label2.Name = "label2";            this.label2.Size = new System.Drawing.Size(0, 12);            this.label2.TabIndex = 1;            //             // groupBox6            //             this.groupBox6.Controls.Add(this.comboBox2);            this.groupBox6.Controls.Add(this.label5);            this.groupBox6.Controls.Add(this.comboBox1);            this.groupBox6.Controls.Add(this.label1);            this.groupBox6.Controls.Add(this.textBox2);            this.groupBox6.Controls.Add(this.trackBar2);            this.groupBox6.Controls.Add(this.panel2);            this.groupBox6.Controls.Add(this.panel1);            this.groupBox6.Controls.Add(this.label2);            this.groupBox6.Controls.Add(this.label4);            this.groupBox6.Controls.Add(this.label3);            this.groupBox6.Location = new System.Drawing.Point(155, 238);            this.groupBox6.Name = "groupBox6";            this.groupBox6.Size = new System.Drawing.Size(353, 123);            this.groupBox6.TabIndex = 6;            this.groupBox6.TabStop = false;            //             // comboBox2            //             this.comboBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));            this.comboBox2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));            this.comboBox2.Location = new System.Drawing.Point(224, 58);            this.comboBox2.Maximum = new decimal(new int[] {            9999,            0,            0,            0});            this.comboBox2.Minimum = new decimal(new int[] {            1,            0,            0,            0});            this.comboBox2.Name = "comboBox2";            this.comboBox2.Size = new System.Drawing.Size(70, 21);            this.comboBox2.TabIndex = 12;            this.comboBox2.Value = new decimal(new int[] {            15,            0,            0,            0});            this.comboBox2.ValueChanged += new System.EventHandler(this.comboBox2_ValueChanged);            //             // label5            //             this.label5.AutoSize = true;            this.label5.Location = new System.Drawing.Point(186, 61);            this.label5.Name = "label5";            this.label5.Size = new System.Drawing.Size(0, 12);            this.label5.TabIndex = 9;            //             // comboBox1            //             this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;            this.comboBox1.FormattingEnabled = true;            this.comboBox1.Location = new System.Drawing.Point(54, 58);            this.comboBox1.Name = "comboBox1";            this.comboBox1.Size = new System.Drawing.Size(92, 20);            this.comboBox1.TabIndex = 8;            this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);            this.comboBox1.MouseEnter += new System.EventHandler(this.comboBox1_MouseEnter);            //             // label1            //             this.label1.AutoSize = true;            this.label1.Location = new System.Drawing.Point(8, 61);            this.label1.Name = "label1";            this.label1.Size = new System.Drawing.Size(0, 12);            this.label1.TabIndex = 7;            //             // panel2            //             this.panel2.BackColor = System.Drawing.SystemColors.ButtonHighlight;            this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;            this.panel2.Location = new System.Drawing.Point(71, 94);            this.panel2.Name = "panel2";            this.panel2.Size = new System.Drawing.Size(75, 18);            this.panel2.TabIndex = 6;            this.panel2.Click += new System.EventHandler(this.panel2_Click);            //             // panel1            //             this.panel1.BackColor = System.Drawing.SystemColors.ButtonHighlight;            this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;            this.panel1.Location = new System.Drawing.Point(252, 21);            this.panel1.Name = "panel1";            this.panel1.Size = new System.Drawing.Size(75, 18);            this.panel1.TabIndex = 5;            this.panel1.Click += new System.EventHandler(this.panel1_Click);            //             // label4            //             this.label4.AutoSize = true;            this.label4.Location = new System.Drawing.Point(8, 97);            this.label4.Name = "label4";            this.label4.Size = new System.Drawing.Size(0, 12);            this.label4.TabIndex = 1;            //             // label3            //             this.label3.AutoSize = true;            this.label3.Location = new System.Drawing.Point(186, 24);            this.label3.Name = "label3";            this.label3.Size = new System.Drawing.Size(0, 12);            this.label3.TabIndex = 0;            //             // groupBox8            //             this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)));            this.groupBox8.Controls.Add(this.dataGridView1);            this.groupBox8.Location = new System.Drawing.Point(155, 367);            this.groupBox8.Name = "groupBox8";            this.groupBox8.Size = new System.Drawing.Size(353, 189);            this.groupBox8.TabIndex = 8;            this.groupBox8.TabStop = false;            //             // dataGridView1            //             this.dataGridView1.AllowUserToAddRows = false;            this.dataGridView1.AllowUserToDeleteRows = false;            this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)));            this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;            this.dataGridView1.BackgroundColor = System.Drawing.Color.White;            this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;            this.dataGridView1.Location = new System.Drawing.Point(7, 21);            this.dataGridView1.MultiSelect = false;            this.dataGridView1.Name = "dataGridView1";            this.dataGridView1.RowHeadersVisible = false;            this.dataGridView1.RowTemplate.Height = 23;            this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;            this.dataGridView1.Size = new System.Drawing.Size(340, 162);            this.dataGridView1.TabIndex = 0;            //             // groupBox9            //             this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)             | System.Windows.Forms.AnchorStyles.Right)));            this.groupBox9.Controls.Add(this.button10);            this.groupBox9.Controls.Add(this.label10);            this.groupBox9.Controls.Add(this.label9);            this.groupBox9.Controls.Add(this.numericUpDown1);            this.groupBox9.Controls.Add(this.label8);            this.groupBox9.Controls.Add(this.button9);            this.groupBox9.Controls.Add(this.button8);            this.groupBox9.Controls.Add(this.dataGridView2);            this.groupBox9.Controls.Add(this.listView2);            this.groupBox9.Controls.Add(this.button7);            this.groupBox9.Controls.Add(this.button6);            this.groupBox9.Location = new System.Drawing.Point(14, 562);            this.groupBox9.Name = "groupBox9";            this.groupBox9.Size = new System.Drawing.Size(1081, 204);            this.groupBox9.TabIndex = 9;            this.groupBox9.TabStop = false;            //             // button10            //             this.button10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));            this.button10.Location = new System.Drawing.Point(941, 103);            this.button10.Name = "button10";            this.button10.Size = new System.Drawing.Size(128, 26);            this.button10.TabIndex = 10;            this.button10.UseVisualStyleBackColor = true;            this.button10.Click += new System.EventHandler(this.button10_Click);            //             // label10            //             this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));            this.label10.AutoSize = true;            this.label10.ForeColor = System.Drawing.SystemColors.ScrollBar;            this.label10.Location = new System.Drawing.Point(927, 9);            this.label10.Name = "label10";            this.label10.Size = new System.Drawing.Size(11, 192);            this.label10.TabIndex = 9;            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|";            //             // label9            //             this.label9.AutoSize = true;            this.label9.ForeColor = System.Drawing.SystemColors.ScrollBar;            this.label9.Location = new System.Drawing.Point(210, 9);            this.label9.Name = "label9";            this.label9.Size = new System.Drawing.Size(11, 192);            this.label9.TabIndex = 8;            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|";            //             // numericUpDown1            //             this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));            this.numericUpDown1.Location = new System.Drawing.Point(993, 162);            this.numericUpDown1.Maximum = new decimal(new int[] {            10,            0,            0,            0});            this.numericUpDown1.Name = "numericUpDown1";            this.numericUpDown1.Size = new System.Drawing.Size(70, 21);            this.numericUpDown1.TabIndex = 7;            this.numericUpDown1.Value = new decimal(new int[] {            3,            0,            0,            0});            this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);            //             // label8            //             this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));            this.label8.AutoSize = true;            this.label8.Location = new System.Drawing.Point(955, 167);            this.label8.Name = "label8";            this.label8.Size = new System.Drawing.Size(0, 12);            this.label8.TabIndex = 6;            //             // button9            //             this.button9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));            this.button9.Location = new System.Drawing.Point(941, 69);            this.button9.Name = "button9";            this.button9.Size = new System.Drawing.Size(128, 26);            this.button9.TabIndex = 5;            this.button9.UseVisualStyleBackColor = true;            this.button9.Click += new System.EventHandler(this.button9_Click);            //             // button8            //             this.button8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));            this.button8.Location = new System.Drawing.Point(941, 34);            this.button8.Name = "button8";            this.button8.Size = new System.Drawing.Size(128, 26);            this.button8.TabIndex = 4;            this.button8.UseVisualStyleBackColor = true;            this.button8.Click += new System.EventHandler(this.button8_Click);            //             // dataGridView2            //             this.dataGridView2.AllowUserToAddRows = false;            this.dataGridView2.AllowUserToDeleteRows = false;            this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)             | System.Windows.Forms.AnchorStyles.Right)));            this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;            this.dataGridView2.BackgroundColor = System.Drawing.Color.White;            this.dataGridView2.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;            this.dataGridView2.Location = new System.Drawing.Point(228, 20);            this.dataGridView2.MultiSelect = false;            this.dataGridView2.Name = "dataGridView2";            this.dataGridView2.RowHeadersVisible = false;            this.dataGridView2.RowTemplate.Height = 23;            this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;            this.dataGridView2.Size = new System.Drawing.Size(693, 176);            this.dataGridView2.TabIndex = 3;            //             // listView2            //             this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)));            this.listView2.HideSelection = false;            this.listView2.Location = new System.Drawing.Point(16, 56);            this.listView2.Name = "listView2";            this.listView2.Size = new System.Drawing.Size(181, 140);            this.listView2.TabIndex = 2;            this.listView2.UseCompatibleStateImageBehavior = false;            this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);            //             // button7            //             this.button7.Location = new System.Drawing.Point(145, 20);            this.button7.Name = "button7";            this.button7.Size = new System.Drawing.Size(52, 26);            this.button7.TabIndex = 1;            this.button7.UseVisualStyleBackColor = true;            this.button7.Click += new System.EventHandler(this.button7_Click);            //             // button6            //             this.button6.Location = new System.Drawing.Point(16, 20);            this.button6.Name = "button6";            this.button6.Size = new System.Drawing.Size(93, 26);            this.button6.TabIndex = 0;            this.button6.UseVisualStyleBackColor = true;            this.button6.Click += new System.EventHandler(this.button6_Click);            //             // QualityOfEdgeDialog            //             this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);            this.ClientSize = new System.Drawing.Size(1107, 771);            this.Controls.Add(this.groupBox9);            this.Controls.Add(this.groupBox8);            this.Controls.Add(this.groupBox6);            this.Controls.Add(this.groupBox5);            this.Controls.Add(this.groupBox4);            this.Controls.Add(this.groupBox3);            this.Controls.Add(this.groupBox2);            this.Controls.Add(this.groupBox1);            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;            this.Name = "QualityOfEdgeDialog";            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.QualityOfEdgeDialog_FormClosing);            this.Controls.SetChildIndex(this.groupBox1, 0);            this.Controls.SetChildIndex(this.groupBox2, 0);            this.Controls.SetChildIndex(this.groupBox3, 0);            this.Controls.SetChildIndex(this.groupBox4, 0);            this.Controls.SetChildIndex(this.groupBox5, 0);            this.Controls.SetChildIndex(this.groupBox6, 0);            this.Controls.SetChildIndex(this.groupBox8, 0);            this.Controls.SetChildIndex(this.groupBox9, 0);            this.groupBox1.ResumeLayout(false);            this.groupBox1.PerformLayout();            this.groupBox2.ResumeLayout(false);            this.groupBox4.ResumeLayout(false);            this.groupBox5.ResumeLayout(false);            this.groupBox5.PerformLayout();            ((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();            this.groupBox6.ResumeLayout(false);            this.groupBox6.PerformLayout();            ((System.ComponentModel.ISupportInitialize)(this.comboBox2)).EndInit();            this.groupBox8.ResumeLayout(false);            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();            this.groupBox9.ResumeLayout(false);            this.groupBox9.PerformLayout();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();            ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();            this.ResumeLayout(false);        }        /// <summary>        /// 初始化其他控件        /// </summary>        private void InitOtherTools()        {            //            //初始化图像控件            //            this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace);            this.documentWorkspace.Dock = DockStyle.Fill;            this.documentWorkspace.HookMouseEvents();            this.documentWorkspace.AuxiliaryLineEnabled = false;            this.documentWorkspace.Visible = false;            this.documentWorkspace.activeTool = Annotation.Enum.DrawToolType.NullTool;            this.groupBox3.Controls.Add(documentWorkspace);            //            //初始化操作按钮            //            this.commonControlButtons = new CommonControlButtons();            this.commonControlButtons.Dock = DockStyle.Top;            this.commonControlButtons.Height = 30;            this.commonControlButtons.HideZoomToWindowAndActualSize();            this.commonControlButtons.Visible = false;            this.groupBox3.Controls.Add(commonControlButtons);            //            //调色板            //            this.colorsForm1 = new ColorsForm();            this.colorsForm1.StartPosition = FormStartPosition.CenterScreen;            this.colorsForm1.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);            this.colorsForm2 = new ColorsForm();            this.colorsForm2.StartPosition = FormStartPosition.CenterScreen;            this.colorsForm2.UserPrimaryColorChanged += new ColorEventHandler(this.colorsFormUserPrimaryColorChanged);            //            //颜色panel给定初始值            //            this.panel1.BackColor = Color.Red;            this.panel2.BackColor = Color.Black;            //            //滚动条与输入框值匹配            //            this.textBox2.Text = "" + this.trackBar2.Value;            //            //绑定字体下拉            //            ArrayList fontsItems = new ArrayList();            System.Drawing.Text.InstalledFontCollection fonts = new System.Drawing.Text.InstalledFontCollection();            foreach (FontFamily fontFamily in fonts.Families)            {                fontsItems.Add(fontFamily.Name);            }            this.comboBox1.DataSource = fontsItems;            this.comboBox1.Text = "宋体";            //            //绑定字号            //            //this.comboBox2.DataSource = fontSizes;            //this.comboBox2.Text = 12 + "";        }        /// <summary>        /// 初始化图片列表数据        /// </summary>        public void InitPicList()        {            //初始化图片列表            for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)            {                this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail);                this.listView1.Items.Add("", i);                this.listView1.Items[i].ImageIndex = i;                this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();                this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();                if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))                {                    defaultIndex = i;                }            }            this.Shown += ShowImgEvent;        }        /// <summary>        /// 初始化表头        /// </summary>        private void InitGridHeader()        {            //            //结果预览表            //            this.dataGridView1.ColumnHeadersHeight = 30;            DataGridViewTextBoxColumn h1 = new DataGridViewTextBoxColumn();            h1.Width = 68;            DataGridViewTextBoxColumn h2 = new DataGridViewTextBoxColumn();            h2.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h2.Width = 67;            DataGridViewTextBoxColumn h3 = new DataGridViewTextBoxColumn();            h3.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h3.Width = 67;            DataGridViewTextBoxColumn h4 = new DataGridViewTextBoxColumn();            h4.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h4.Width = 67;            DataGridViewTextBoxColumn h5 = new DataGridViewTextBoxColumn();            h5.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h5.Width = 67;            this.dataGridView1.Columns.Add(h1);            this.dataGridView1.Columns.Add(h2);            this.dataGridView1.Columns.Add(h3);            this.dataGridView1.Columns.Add(h4);            this.dataGridView1.Columns.Add(h5);            DataGridViewHelper helper = new DataGridViewHelper(this.dataGridView1);            helper.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text")));            helper.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.thickness.text")));            helper.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, "BURR(μm)"));            helper.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, "I(%)"));            helper.Headers.Add(new DataGridViewHelper.TopHeader(4, 1, "β(°)"));            this.dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView1.Columns[0].ReadOnly = true;            this.dataGridView1.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;//文字居中            this.dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView1.Columns[1].ReadOnly = true;            this.dataGridView1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;            this.dataGridView1.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView1.Columns[2].ReadOnly = true;            this.dataGridView1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;            this.dataGridView1.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView1.Columns[3].ReadOnly = true;            this.dataGridView1.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;            this.dataGridView1.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView1.Columns[4].ReadOnly = true;            this.dataGridView1.Columns[4].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;            this.dataGridView1.AllowUserToResizeRows = false;            this.dataGridView1.AllowUserToResizeColumns = false;            //            //分析结果表            //            this.dataGridView2.ColumnHeadersHeight = 30;            DataGridViewTextBoxColumn h6 = new DataGridViewTextBoxColumn();            h6.Width = 80;            DataGridViewTextBoxColumn h7 = new DataGridViewTextBoxColumn();            //h7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h7.Width = 75;            DataGridViewTextBoxColumn h8 = new DataGridViewTextBoxColumn();            //h8.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h8.Width = 75;            DataGridViewTextBoxColumn h9 = new DataGridViewTextBoxColumn();            //h9.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h9.Width = 75;            DataGridViewTextBoxColumn h10 = new DataGridViewTextBoxColumn();            //h10.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h10.Width = 75;            DataGridViewTextBoxColumn h11 = new DataGridViewTextBoxColumn();            //h11.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h11.Width = 75;            DataGridViewTextBoxColumn h12 = new DataGridViewTextBoxColumn();            //h12.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h12.Width = 75;            DataGridViewTextBoxColumn h13 = new DataGridViewTextBoxColumn();            //h13.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h13.Width = 75;            DataGridViewTextBoxColumn h14 = new DataGridViewTextBoxColumn();            //h14.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h14.Width = 85;            this.dataGridView2.Columns.Add(h6);            this.dataGridView2.Columns.Add(h7);            this.dataGridView2.Columns.Add(h8);            this.dataGridView2.Columns.Add(h9);            this.dataGridView2.Columns.Add(h10);            this.dataGridView2.Columns.Add(h11);            this.dataGridView2.Columns.Add(h12);            this.dataGridView2.Columns.Add(h13);            this.dataGridView2.Columns.Add(h14);            DataGridViewHelper helper2 = new DataGridViewHelper(this.dataGridView2);            helper2.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.picture.Text")));            helper2.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.alloydesignation.text")));            helper2.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, PdnResources.GetString("Menu.volumenumber.text")));            helper2.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text")));            helper2.Headers.Add(new DataGridViewHelper.TopHeader(4, 1, PdnResources.GetString("Menu.thickness.text")));            helper2.Headers.Add(new DataGridViewHelper.TopHeader(5, 1, "BURR(μm)"));            helper2.Headers.Add(new DataGridViewHelper.TopHeader(6, 1, "I(%)"));            helper2.Headers.Add(new DataGridViewHelper.TopHeader(7, 1, "β(°)"));            helper2.Headers.Add(new DataGridViewHelper.TopHeader(8, 1, PdnResources.GetString("Menu.Remark.text")));            this.dataGridView2.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView2.Columns[0].ReadOnly = true;            this.dataGridView2.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView2.Columns[1].ReadOnly = true;            this.dataGridView2.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView2.Columns[2].ReadOnly = true;            this.dataGridView2.Columns[3].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView2.Columns[3].ReadOnly = true;            this.dataGridView2.Columns[4].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView2.Columns[4].ReadOnly = true;            this.dataGridView2.Columns[5].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView2.Columns[5].ReadOnly = true;            this.dataGridView2.Columns[6].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView2.Columns[6].ReadOnly = true;            this.dataGridView2.Columns[7].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView2.Columns[7].ReadOnly = true;            this.dataGridView2.Columns[8].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView2.Columns[8].ReadOnly = true;            this.dataGridView2.AllowUserToResizeRows = false;            this.dataGridView2.AllowUserToResizeColumns = false;            //            //左下表            //            this.listView2.View = View.Details;            ColumnHeader header0 = new ColumnHeader();            header0.Text = PdnResources.GetString("Menu.Resultlist.Text");            header0.Width = 175;            this.listView2.Columns.Add(header0);        }        /// <summary>        /// 初始化画布按键功能        /// </summary>        private void InitCommonButtonEvent()        {            this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);            this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);            this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);            this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);            this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);            this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);        }        private void zoomInButton_Click(object sender, EventArgs e)        {            this.documentWorkspace.ZoomIn();        }        private void zoomOutButton_Click(object sender, EventArgs e)        {            this.documentWorkspace.ZoomOut();        }        private void zoomToWindowButton_Click(object sender, EventArgs e)        {            this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;        }        private void actualSizeButton_Click(object sender, EventArgs e)        {            this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;            this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;        }        private void pointerButton_Click(object sender, EventArgs e)        {            this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;        }        private void mobileModeButton_Click(object sender, EventArgs e)        {            this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;        }        /// <summary>        /// 添加画布绑定事件        /// </summary>        private void AddPictureBoxEvent()        {            this.documentWorkspace.panel.MouseDown += new MouseEventHandler(this.BoxMouseDownHandler);            this.documentWorkspace.panel.MouseMove += new MouseEventHandler(this.BoxMouseMoveHandler);            this.documentWorkspace.panel.MouseUp += new MouseEventHandler(this.BoxMouseUpHandler);            this.documentWorkspace.panel.Paint += new PaintEventHandler(this.BoxPaintHandler);        }        /// <summary>        ///  调色板回调函数        /// </summary>        /// <param name="sender"></param>        /// <param name="ce"></param>        private void colorsFormUserPrimaryColorChanged(object sender, ColorEventArgs ce)        {        }        /// <summary>        /// 添加内容单元格        /// </summary>        /// <param name="text"></param>        /// <param name="tag"></param>        /// <returns></returns>        private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag)        {            DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();            textboxcell.Value = text;            textboxcell.Tag = tag;            return textboxcell;        }        /// <summary>        /// 设置按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button1_Click(object sender, EventArgs e)        {            AnalyzeSettingDialog metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.QualityOfEdge");            if (metallographicMethodSetDialog.hasModule)            {                metallographicMethodSetDialog.StartPosition = FormStartPosition.CenterScreen;                metallographicMethodSetDialog.ShowDialog();            }            else            {                metallographicMethodSetDialog = null;            }        }        /// <summary>        /// 保存结果按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button2_Click(object sender, EventArgs e)        {            if (this.listView1.SelectedItems.Count > 0)            {                string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();                string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];                bool replace = false;                int rowIndex = 0;                if (this.dataGridView1.Rows.Count > 0)                {                    if (this.listView2.Items.Count > 0)                    {                        foreach (ListViewItem item in this.listView2.Items)                        {                            if (item.Name.Equals(tag))                            {                                DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);                                if(dr == DialogResult.OK)                                {                                    replace = true;                                }                                else                                {                                    return;                                }                                break;                            }                        }                    }                    //有重名需要替换                    if (replace)                    {                        for(int i = 0; i < this.resultTableList.Count; i++)                        {                            if (this.resultTableList[i].TableName.Equals(tag))                            {                                rowIndex = i;                                this.resultTableList.Remove(this.resultTableList[i]);                                if (this.calcDic != null && this.calcDic.Count > 0)                                {                                    //重新计算平均值                                    double avg1 = 0;                                    double avg2 = 0;                                    double avg3 = 0;                                    double avg4 = 0;                                    DataTable dt = new DataTable(tag);                                    dt.Columns.Add(PdnResources.GetString("Menu.picture.Text"));                                    dt.Columns.Add(PdnResources.GetString("Menu.alloydesignation.text"));                                    dt.Columns.Add(PdnResources.GetString("Menu.volumenumber.text"));                                    dt.Columns.Add(PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text"));                                    dt.Columns.Add(PdnResources.GetString("Menu.thickness.text"));                                    dt.Columns.Add("BURR(μm)");                                    dt.Columns.Add("I(%)");                                    dt.Columns.Add("β(°)");                                    dt.Columns.Add(PdnResources.GetString("Menu.Remark.text"));                                    for (int j = 0; j < this.calcDic.Count; j++)                                    {                                        DataRow dataRow = dt.NewRow();                                        dataRow[PdnResources.GetString("Menu.picture.Text")] = imgName;                                        dataRow[PdnResources.GetString("Menu.alloydesignation.text")] = this.textBox1.Text;                                        dataRow[PdnResources.GetString("Menu.volumenumber.text")] = this.textBox3.Text;                                        dataRow[PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text")] = "L" + (j + 1);                                        double dis1 = 0;                                        calcDic[j].TryGetValue("thickness", out dis1);                                        dataRow[PdnResources.GetString("Menu.thickness.text")] = dis1;                                        avg1 += dis1;                                        double dis2 = 0;                                        calcDic[j].TryGetValue("burr", out dis2);                                        dataRow["BURR(μm)"] = dis2;                                        avg2 += dis2;                                        double dis3 = 0;                                        calcDic[j].TryGetValue("otherThickness", out dis3);                                        dataRow["I(%)"] = dis3;                                        avg3 += dis3;                                        double dis4 = 0;                                        calcDic[j].TryGetValue("threePointAngle", out dis4);                                        dataRow["β(°)"] = dis4;                                        avg4 += dis4;                                        dataRow[PdnResources.GetString("Menu.Remark.text")] = this.richTextBox1.Text;                                        dt.Rows.Add(dataRow);                                    }                                    //DataRow avgRow = dt.NewRow();                                    //avgRow[PdnResources.GetString("Menu.picture.Text")] = imgName;                                    //avgRow[PdnResources.GetString("Menu.alloydesignation.text")] = this.textBox1.Text;                                    //avgRow[PdnResources.GetString("Menu.volumenumber.text")] = this.textBox3.Text;                                    //avgRow[PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text")] = PdnResources.GetString("Menu.Image.Average.Text");                                    //avgRow[PdnResources.GetString("Menu.thickness.text")] = avg1 / lineCount;                                    //avgRow["BURR(μm)"] = avg2 / lineCount;                                    //avgRow["I(%)"] = avg3 / lineCount;                                    //avgRow["β(°)"] = avg4 / lineCount;                                    //avgRow[PdnResources.GetString("Menu.Remark.text")] = this.richTextBox1.Text;                                    //dt.Rows.Add(avgRow);                                    resultTableList.Insert(rowIndex, dt);                                }                            }                        }                    }                    //新增                    else                    {                        ListViewItem listViewItem = new ListViewItem();                        listViewItem.Name = tag;                        listViewItem.SubItems[0].Text = imgName;                        this.listView2.Items.Add(listViewItem);                        this.listView2.SelectedItems.Clear();                        this.listView2.Items[this.listView2.Items.Count - 1].Selected = true;                        if (this.calcDic != null && this.calcDic.Count > 0)                        {                            //重新计算平均值                            double avg1 = 0;                            double avg2 = 0;                            double avg3 = 0;                            double avg4 = 0;                            DataTable dt = new DataTable(tag);                            dt.Columns.Add(PdnResources.GetString("Menu.picture.Text"));                            dt.Columns.Add(PdnResources.GetString("Menu.alloydesignation.text"));                            dt.Columns.Add(PdnResources.GetString("Menu.volumenumber.text"));                            dt.Columns.Add(PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text"));                            dt.Columns.Add(PdnResources.GetString("Menu.thickness.text"));                            dt.Columns.Add("BURR(μm)");                            dt.Columns.Add("I(%)");                            dt.Columns.Add("β(°)");                            dt.Columns.Add(PdnResources.GetString("Menu.Remark.text"));                            for (int i = 0; i < this.calcDic.Count; i++)                            {                                DataRow dataRow = dt.NewRow();                                dataRow[PdnResources.GetString("Menu.picture.Text")] = imgName;                                dataRow[PdnResources.GetString("Menu.alloydesignation.text")] = this.textBox1.Text;                                dataRow[PdnResources.GetString("Menu.volumenumber.text")] = this.textBox3.Text;                                dataRow[PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text")] = "L" + (i + 1);                                double dis1 = 0;                                calcDic[i].TryGetValue("thickness", out dis1);                                dataRow[PdnResources.GetString("Menu.thickness.text")] = dis1;                                avg1 += dis1;                                double dis2 = 0;                                calcDic[i].TryGetValue("burr", out dis2);                                dataRow["BURR(μm)"] = dis2;                                avg2 += dis2;                                double dis3 = 0;                                calcDic[i].TryGetValue("otherThickness", out dis3);                                dataRow["I(%)"] = dis3;                                avg3 += dis3;                                double dis4 = 0;                                calcDic[i].TryGetValue("threePointAngle", out dis4);                                dataRow["β(°)"] = dis4;                                avg4 += dis4;                                dataRow[PdnResources.GetString("Menu.Remark.text")] = this.richTextBox1.Text;                                dt.Rows.Add(dataRow);                            }                            //DataRow avgRow = dt.NewRow();                            //avgRow[PdnResources.GetString("Menu.picture.Text")] = imgName;                            //avgRow[PdnResources.GetString("Menu.alloydesignation.text")] = this.textBox1.Text;                            //avgRow[PdnResources.GetString("Menu.volumenumber.text")] = this.textBox3.Text;                            //avgRow[PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text")] = PdnResources.GetString("Menu.Image.Average.Text");                            //avgRow[PdnResources.GetString("Menu.thickness.text")] = avg1 / lineCount;                            //avgRow["BURR(μm)"] = avg2 / lineCount;                            //avgRow["I(%)"] = avg3 / lineCount;                            //avgRow["β(°)"] = avg4 / lineCount;                            //avgRow[PdnResources.GetString("Menu.Remark.text")] = this.richTextBox1.Text;                            //dt.Rows.Add(avgRow);                            resultTableList.Add(dt);                        }                    }                    RefreshDataGridView2();                    //保存处理后的图片                    double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数                    List<Bitmap> tempBit = new List<Bitmap>();                    Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();                    originalBit.Tag = pantographRatio;                    tempBit.Add(originalBit);                    Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);                    Graphics graphics = Graphics.FromImage(newBit);                    if(this.documentWorkspace.phaseModels != null && this.documentWorkspace.phaseModels.Count > 0 && this.documentWorkspace.phaseModels[0].mat != null)                    {                        Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.phaseModels[0].mat);                        graphics.DrawImage(processedBit, new PointF(0, 0));                    }                    Draw(graphics);                    newBit.Tag = pantographRatio;                    tempBit.Add(newBit);                    if (bitDic.ContainsKey(tag))                        bitDic[tag] = tempBit;                    else                        bitDic.Add(tag, tempBit);                    //拼接中间数据                    List<List<string>> dataList = new List<List<string>>();                    List<string> columnName = new List<string>();                    columnName.Add(PdnResources.GetString("Menu.alloydesignation.text"));                    columnName.Add(PdnResources.GetString("Menu.volumenumber.text"));                    columnName.Add(PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text"));                    columnName.Add(PdnResources.GetString("Menu.thickness.text"));                    columnName.Add("BURR(μm)");                    columnName.Add("I(%)");                    columnName.Add("β(°)");                    columnName.Add(PdnResources.GetString("Menu.Remark.text"));                    columnName.Add(PdnResources.GetString("Menu.coordinateofthepoint1.Text"));                    columnName.Add(PdnResources.GetString("Menu.coordinateofthepoint2.Text"));                    columnName.Add(PdnResources.GetString("Menu.coordinateofthepoint3.Text"));                    columnName.Add(PdnResources.GetString("Menu.coordinateofthepoint4.Text"));                    columnName.Add(PdnResources.GetString("Menu.coordinateofthepoint5.Text"));                    columnName.Add(PdnResources.GetString("Menu.coordinateofthepoint6.Text"));                    columnName.Add(PdnResources.GetString("Menu.coordinateofthepoint7.Text"));                    columnName.Add(PdnResources.GetString("Menu.Tools.AuxiliaryLine.Text"));                    dataList.Add(columnName);                    if(this.calcDic != null && this.calcDic.Count > 0 && this.pointList != null && this.pointList.Count > 0)                    {                        for (int i = 0; i < this.calcDic.Count; i++)                        {                            List<string> strList = new List<string>();                            strList.Add(this.textBox1.Text);                            strList.Add(this.textBox3.Text);                            strList.Add("L" + (i + 1));                            double dis1 = 0;                            calcDic[i].TryGetValue("thickness", out dis1);                            strList.Add(dis1.ToString());                            double dis2 = 0;                            calcDic[i].TryGetValue("burr", out dis2);                            strList.Add(dis2.ToString());                            double dis3 = 0;                            calcDic[i].TryGetValue("otherThickness", out dis3);                            strList.Add(dis3.ToString());                            double dis4 = 0;                            calcDic[i].TryGetValue("threePointAngle", out dis4);                            strList.Add(dis4.ToString());                            strList.Add(this.richTextBox1.Text);                            strList.Add("X:" + this.pointList[i][0].X + ",Y:" + this.pointList[i][0].Y);                            strList.Add("X:" + this.pointList[i][1].X + ",Y:" + this.pointList[i][1].Y);                            strList.Add("X:" + this.pointList[i][2].X + ",Y:" + this.pointList[i][2].Y);                            strList.Add("X:" + this.pointList[i][3].X + ",Y:" + this.pointList[i][3].Y);                            strList.Add("X:" + this.pointList[i][4].X + ",Y:" + this.pointList[i][4].Y);                            strList.Add("X:" + this.pointList[i][5].X + ",Y:" + this.pointList[i][5].Y);                            strList.Add("X:" + this.pointList[i][6].X + ",Y:" + this.pointList[i][6].Y);                            double dis5 = 0;                            calcDic[i].TryGetValue("temp", out dis5);                            strList.Add(dis5.ToString());                            dataList.Add(strList);                        }                    }                    bool isExist = false;//是否已存在进行替换                    int modelIndex = -1;//要替换的下标                    for (int j = 0; j < tempDataModel.Count; j++)                    {                        if (tempDataModel[j].tagName.Equals(tag))                        {                            isExist = true;                            modelIndex = j;                            break;                        }                    }                    if (isExist && modelIndex > -1)                        tempDataModel[modelIndex].dataList = dataList;                    else                    {                        ExportProjectModel newModel = new ExportProjectModel();                        newModel.tagName = tag;                        newModel.picName = imgName;                        newModel.dataList = dataList;                        tempDataModel.Add(newModel);                    }                }                else                {                    MessageBox.Show(PdnResources.GetString("Menu.Pleasedrawthemeasuringlinefirst.text"));                }            }            else            {                MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapictaurefirst.Text"));            }        }        /// <summary>        /// 刷新分析结果表        /// </summary>        private void RefreshDataGridView2()        {            //需要求平均的集合            List<double> lstLand = new List<double>();            List<double> lstBurr = new List<double>();            List<double> lstI = new List<double>();            List<double> lstB = new List<double>();            //平均值            double avgLand = 0;            double avgBurr = 0;            double avgI = 0;            double avgB = 0;            this.dataGridView2.Rows.Clear();            if (this.showAll)            {                if (this.resultTableList.Count > 0)                {                    foreach (DataTable dt in resultTableList)                    {                        for (int i = 0; i < dt.Rows.Count; i++)                        {                            DataGridViewRow row = new DataGridViewRow();                            row.Height = 30;                            row.Cells.Add(CreateTextBoxCell(dt.Rows[i][0].ToString(), ""));                            row.Cells.Add(CreateTextBoxCell(dt.Rows[i][1].ToString(), ""));                            row.Cells.Add(CreateTextBoxCell(dt.Rows[i][2].ToString(), ""));                            row.Cells.Add(CreateTextBoxCell(dt.Rows[i][3].ToString(), ""));                            row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][4].ToString()) ? "0" :                                dt.Rows[i][4].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                            row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][5].ToString()) ? "0" :                                dt.Rows[i][5].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                            row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][6].ToString()) ? "0" :                                dt.Rows[i][6].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                            row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[i][7].ToString()) ? "0" :                                dt.Rows[i][7].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                            row.Cells.Add(CreateTextBoxCell(dt.Rows[i][8].ToString(), ""));                            lstLand.Add(double.Parse(dt.Rows[i][4].ToString()));                            lstBurr.Add(double.Parse(dt.Rows[i][5].ToString()));                            lstI.Add(double.Parse(dt.Rows[i][6].ToString()));                            lstB.Add(double.Parse(dt.Rows[i][7].ToString()));                            this.dataGridView2.Rows.Add(row);                        }                    }                }            }            else            {                if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)                {                    for (int i = 0; i < this.listView2.SelectedItems.Count; i++)                    {                        string tableName = this.listView2.SelectedItems[i].Name;                        foreach (DataTable dt in resultTableList)                        {                            if (dt.TableName.Equals(tableName))                            {                                for (int j = 0; j < dt.Rows.Count; j++)                                {                                    DataGridViewRow row = new DataGridViewRow();                                    row.Height = 30;                                    row.Cells.Add(CreateTextBoxCell(dt.Rows[j][0].ToString(), ""));                                    row.Cells.Add(CreateTextBoxCell(dt.Rows[j][1].ToString(), ""));                                    row.Cells.Add(CreateTextBoxCell(dt.Rows[j][2].ToString(), ""));                                    row.Cells.Add(CreateTextBoxCell(dt.Rows[j][3].ToString(), ""));                                    row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][4].ToString()) ? "0" :                                        dt.Rows[j][4].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                                    row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][5].ToString()) ? "0" :                                        dt.Rows[j][5].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                                    row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][6].ToString()) ? "0" :                                        dt.Rows[j][6].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                                    row.Cells.Add(CreateTextBoxCell(Math.Round(double.Parse(string.IsNullOrEmpty(dt.Rows[j][7].ToString()) ? "0" :                                        dt.Rows[j][7].ToString()), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                                    row.Cells.Add(CreateTextBoxCell(dt.Rows[j][8].ToString(), ""));                                    lstLand.Add(double.Parse(dt.Rows[j][4].ToString()));                                    lstBurr.Add(double.Parse(dt.Rows[j][5].ToString()));                                    lstI.Add(double.Parse(dt.Rows[j][6].ToString()));                                    lstB.Add(double.Parse(dt.Rows[j][7].ToString()));                                    this.dataGridView2.Rows.Add(row);                                }                            }                        }                    }                }            }            if (this.listView2.SelectedItems.Count > 0)            {                if (lstLand.Count > 0)                {                    avgLand = (double)lstLand.Average();                }                if (lstBurr.Count > 0)                {                    avgBurr = (double)lstBurr.Average();                }                if (lstI.Count > 0)                {                    avgI = (double)lstI.Average();                }                if (lstB.Count > 0)                {                    avgB = (double)lstB.Average();                }                this.dataGridView2.Rows.Add(PdnResources.GetString("Menu.comprehensive.text"),"","","", Math.Round(double.Parse(string.IsNullOrEmpty(avgLand.ToString()) ? "0" :                                        avgLand.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avgBurr.ToString()) ? "0" :                                        avgBurr.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avgI.ToString()) ? "0" :                                        avgI.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avgB.ToString()) ? "0" :                                        avgB.ToString()), Convert.ToInt32(this.numericUpDown1.Value)), "");            }        }        /// <summary>        /// 添加测量线按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button3_Click(object sender, EventArgs e)        {            operationK = 0;            selected = -1;            this.documentWorkspace.Refresh();        }        /// <summary>        /// 选择测量线按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button4_Click(object sender, EventArgs e)        {            operationK = 1;        }        /// <summary>        /// 删除测量线按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button5_Click(object sender, EventArgs e)        {            if (selected > -1)            {                DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodmeasurementline.text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);                if (dr == DialogResult.OK)                {                    this.pointList.Remove(this.pointList[selected]);                    this.rectangleFList.Remove(this.rectangleFList[selected]);                    this.calcDic.RemoveAt(selected);                    selected = -1;                    lineCount--;                    RefreshDataGridView1();                    this.documentWorkspace.Refresh();                }            }            else                MessageBox.Show(PdnResources.GetString("Menu.Pleaseseleceletedfirst.text"));        }        /// <summary>        /// 全部显示按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button6_Click(object sender, EventArgs e)        {            if(this.button6.Text == PdnResources.GetString("Menu.Showall.text"))            {                this.button6.Text = PdnResources.GetString("Menu.Cancelshowall.text");                this.showAll = true;                RefreshDataGridView2();            }            else if (this.button6.Text == PdnResources.GetString("Menu.Cancelshowall.text"))            {                this.button6.Text = PdnResources.GetString("Menu.Showall.text");                this.showAll = false;                RefreshDataGridView2();            }        }        /// <summary>        /// 删除按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button7_Click(object sender, EventArgs e)        {            if(this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)            {                DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Determineallanalysisrlete.text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);                if (dr == DialogResult.OK)                {                    for (int i = 0; i < this.listView2.SelectedItems.Count; i++)                    {                        string tableName = this.listView2.SelectedItems[i].Name;                        foreach (DataTable dt in resultTableList)                        {                            if (dt.TableName.Equals(tableName))                            {                                resultTableList.Remove(dt);                                break;                            }                        }                        if (bitDic.ContainsKey(tableName))                            bitDic.Remove(tableName);                        foreach (ExportProjectModel model in this.tempDataModel)                        {                            if (model.tagName.Equals(tableName))                            {                                this.tempDataModel.Remove(model);                                break;                            }                        }                    }                    foreach (ListViewItem item in this.listView2.Items)                    {                        if (item.Selected)                            this.listView2.Items.Remove(item);                    }                    RefreshDataGridView2();                }             }        }        /// <summary>        /// 生成报告按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button8_Click(object sender, EventArgs e)        {            if (dataGridView2.Rows.Count == 0)            {                MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text")+"!");                return;            }            if (this.checkBox1.Checked)                this.button1.PerformClick();            if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))            {                //获取word书签与excel单元格的关系,以字典方式存储                List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);                Dictionary<string, string> tagInfos = new Dictionary<string, string>();                if (mic_module_infos != null && mic_module_infos.Count > 0)                {                    foreach (mic_module_infos info in mic_module_infos)                    {                        tagInfos.Add(info.tag_name, info.cell_position);                    }                }                //分析结果                List<List<string>> analysisContent = new List<List<string>>();                List<string> contentHead = new List<string>();                contentHead.Add(PdnResources.GetString("Menu.picture.Text"));                contentHead.Add(PdnResources.GetString("Menu.alloydesignation.text"));                contentHead.Add(PdnResources.GetString("Menu.volumenumber.text"));                contentHead.Add(PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text"));                contentHead.Add(PdnResources.GetString("Menu.thickness.text"));                contentHead.Add("BURR(μm)");                contentHead.Add("I(%)");                contentHead.Add("β(°)");                contentHead.Add(PdnResources.GetString("Menu.Remark.text"));                analysisContent.Add(contentHead);                foreach (DataGridViewRow item in this.dataGridView2.Rows)                {                    List<string> content = new List<string>();                    content.Add(item.Cells[0].Value.ToString());                    content.Add(item.Cells[1].Value.ToString());                    content.Add(item.Cells[2].Value.ToString());                    content.Add(item.Cells[3].Value.ToString());                    content.Add(item.Cells[4].Value.ToString());                    content.Add(item.Cells[5].Value.ToString());                    content.Add(item.Cells[6].Value.ToString());                    content.Add(item.Cells[7].Value.ToString());                    content.Add(item.Cells[8].Value.ToString());                    analysisContent.Add(content);                }                //图片                bitList = new List<Bitmap>();                if (this.showAll)                {                    foreach(KeyValuePair<string, List<Bitmap>> kv in this.bitDic)                    {                        bitList.Add(kv.Value[0]);                        bitList.Add(kv.Value[1]);                    }                }                else                {                    if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)                    {                        foreach (ListViewItem item in this.listView2.SelectedItems)                        {                            if (bitDic.ContainsKey(item.Name))                            {                                bitList.Add(bitDic[item.Name][0]);                                bitList.Add(bitDic[item.Name][1]);                            }                        }                    }                }                                this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);            }            else                MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");        }        /// <summary>        /// 导出结果按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button9_Click(object sender, EventArgs e)        {            if (this.listView2.Items.Count > 0)            {                SaveFileDialog exe = new SaveFileDialog();                exe.Filter = "Execl files (*.xlsx)|*.xlsx";                exe.FilterIndex = 0;                exe.RestoreDirectory = true;                exe.Title = "Export Excel File";                exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);                exe.FileName = PdnResources.GetString("Menu.DedicatedAnalysis.NonferrousMetal.QualityOfEdge.Text")+ PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddHHmmss");                DialogResult dr = exe.ShowDialog();                if (dr == DialogResult.OK)                {                    DataTable dtb = new DataTable();                    dtb.Columns.Add(PdnResources.GetString("Menu.picture.Text"));                    dtb.Columns.Add(PdnResources.GetString("Menu.alloydesignation.text"));                    dtb.Columns.Add(PdnResources.GetString("Menu.volumenumber.text"));                    dtb.Columns.Add(PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text"));                    dtb.Columns.Add(PdnResources.GetString("Menu.thickness.text"));                    dtb.Columns.Add("BURR(μm)");                    dtb.Columns.Add("I(%)");                    dtb.Columns.Add("β(°)");                    dtb.Columns.Add(PdnResources.GetString("Menu.Remark.text"));                    for (int i = 0; i < this.dataGridView2.Rows.Count; i++)                    {                        DataRow dataRow = dtb.NewRow();                        dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView2.Rows[i].Cells[0].Value;                        dataRow[PdnResources.GetString("Menu.alloydesignation.text")] = this.dataGridView2.Rows[i].Cells[1].Value;                        dataRow[PdnResources.GetString("Menu.volumenumber.text")] = this.dataGridView2.Rows[i].Cells[2].Value;                        dataRow[PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text")] = this.dataGridView2.Rows[i].Cells[3].Value;                        dataRow[PdnResources.GetString("Menu.thickness.text")] = this.dataGridView2.Rows[i].Cells[4].Value;                        dataRow["BURR(μm)"] = this.dataGridView2.Rows[i].Cells[5].Value;                        dataRow["I(%)"] = this.dataGridView2.Rows[i].Cells[6].Value;                        dataRow["β(°)"] = this.dataGridView2.Rows[i].Cells[7].Value;                        dataRow[PdnResources.GetString("Menu.Remark.text")] = this.dataGridView2.Rows[i].Cells[8].Value;                        dtb.Rows.Add(dataRow);                    }                    List<DataTable> list = new List<DataTable>();                    list.Add(dtb);                    this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);                }            }            else                MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text")+"!");        }        /// <summary>        /// 图像索引切换选中事件        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void listView1_SelectedIndexChanged(object sender, EventArgs e)        {            if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)            {                //                //获取系统标尺-微米                //                unitLengthUm = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron);                //                //获取系统标尺-毫米                //                unitLengthMm = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Millimeter);                this.documentWorkspace.phaseModels.Clear();                this.bitmap = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();                Document document = Document.FromImage(bitmap);                this.documentWorkspace.Document = document;                this.documentWorkspace.Visible = true;                //this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList;                //this.documentWorkspace.phaseModels = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].phaseModels;                if (this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].phaseModels.Count == 0)                {                    this.documentWorkspace.phaseModels = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].phaseModels;                }                else                {                    this.documentWorkspace.phaseModels.Add(this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].AnalysisPhaseModel);                }                this.commonControlButtons.Visible = true;                pointList = new List<PointF[]>();                rectangleFList = new List<RectangleF>();                calcDic = new List<Dictionary<string, double>>();                lineCount = 0;                clickCount = 0;                operationK = -1;                selected = -1;                this.dataGridView1.Rows.Clear();            }        }        /// <summary>        /// 限制只可以输入0-9数字以及退格键        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)        {            if (e.KeyChar != '\b')//这是允许输入退格键             {                if ((e.KeyChar < '0') || (e.KeyChar > '9'))//这是允许输入0-9数字                 {                    e.Handled = true;                }            }        }        /// <summary>        /// 对输入值做限制        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void textBox2_KeyUp(object sender, KeyEventArgs e)        {            if (string.IsNullOrEmpty(this.textBox2.Text))                this.textBox2.Text = "1";            if (Convert.ToInt32(this.textBox2.Text) > 50)                this.textBox2.Text = "50";            this.trackBar2.Value = Convert.ToInt32(this.textBox2.Text);        }        /// <summary>        /// 线段颜色panel被点击        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void panel1_Click(object sender, EventArgs e)        {            this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);            this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.colorsForm1Changed));            this.colorsForm1.ShowDialog();        }        private void colorsForm1Changed(object sender, EventArgs e)        {            this.panel1.BackColor = this.colorsForm1.UserPrimaryColor.ToColor();            this.colorsForm1.Close();            this.documentWorkspace.Refresh();        }        /// <summary>        /// 字体颜色panel被点击        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void panel2_Click(object sender, EventArgs e)        {            this.colorsForm2.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);            this.colorsForm2.setSaveBtn_Click(new System.EventHandler(this.colorsForm2Changed));            this.colorsForm2.ShowDialog();        }        private void colorsForm2Changed(object sender, EventArgs e)        {            this.panel2.BackColor = this.colorsForm2.UserPrimaryColor.ToColor();            this.colorsForm2.Close();            this.documentWorkspace.Refresh();        }        /// <summary>        /// 线宽滚动条滚动事件        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void trackBar2_Scroll(object sender, EventArgs e)        {            this.textBox2.Text = "" + this.trackBar2.Value;        }        private void trackBar2_ValueChanged(object sender, EventArgs e)        {            this.documentWorkspace.Refresh();        }        /// <summary>        /// 小数数字框值改变        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void numericUpDown1_ValueChanged(object sender, EventArgs e)        {            if (this.numericUpDown1.Value > this.numericUpDown1.Maximum)                this.numericUpDown1.Value = this.numericUpDown1.Maximum;            if (this.numericUpDown1.Value < this.numericUpDown1.Minimum)                this.numericUpDown1.Value = this.numericUpDown1.Minimum;            RefreshDataGridView1();            RefreshDataGridView2();        }        /// <summary>        /// 鼠标按下        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void BoxMouseDownHandler(object sender, MouseEventArgs e)        {            PointF downPoint = this.documentWorkspace.GetScalePoint(e.Location);            if (operationK >= 0 && e.Button == MouseButtons.Left)            {                if (operationK == 0)                {                    clickCount += 1;                    if (clickCount == 1)                    {                        startPoint = endPoint = downPoint;                        nowLine = new PointF[7];                        nowLine[0] = startPoint;                        nowLine[1] = endPoint;                        pointList.Add(nowLine);                    }                    else if (clickCount == 2)                    {                        if (this.startPoint == this.endPoint)                        {                            clickCount = 0;                            pointList.RemoveAt(pointList.Count - 1);                            this.nowLine = new PointF[7];                        }                        else                        {                            pointList[lineCount][2] = downPoint;                        }                    }                    else if (clickCount == 3)                    {                        pointList[lineCount][3] = downPoint;                    }                    else if(clickCount == 4)                    {                        pointList[lineCount][4] = downPoint;                    }                    else if (clickCount == 5)                    {                        pointList[lineCount][5] = downPoint;                    }                    else if (clickCount == 6)                    {                        pointList[lineCount][6] = downPoint;                        lastPoint.X = downPoint.X;                        lastPoint.Y = downPoint.Y;                        tempPoint.X = downPoint.X;                        tempPoint.Y = downPoint.Y;                    }                    else if (clickCount == 7)                    {                        RectangleF rectangleF = CalcOtherRectangle(pointList[lineCount]);                        rectangleFList.Add(rectangleF);                        operationK = -1;                        selected = -1;                        clickCount = 0;                        lineCount++;                        AddContentToDataGridView();                    }                }                else if (operationK == 1)                {                    lastPoint.X = downPoint.X;                    lastPoint.Y = downPoint.Y;                    tempPoint.X = downPoint.X;                    tempPoint.Y = downPoint.Y;                    for (int i = rectangleFList.Count - 1; i >= 0; i--)                    {                        if (rectangleFList[i].Contains(downPoint))                        {                            selected = i;                            canMove = true;                        }                    }                    if(selected > -1)                    {                        if (new RectangleF(pointList[selected][0].X - 3, pointList[selected][0].Y - 3, 7, 7).Contains(downPoint))                            movePointIndex = 0;                        else if (new RectangleF(pointList[selected][1].X - 3, pointList[selected][1].Y - 3, 7, 7).Contains(downPoint))                            movePointIndex = 1;                        else if (new RectangleF(pointList[selected][2].X - 3, pointList[selected][2].Y - 3, 7, 7).Contains(downPoint))                            movePointIndex = 2;                        else if (new RectangleF(pointList[selected][3].X - 3, pointList[selected][3].Y - 3, 7, 7).Contains(downPoint))                            movePointIndex = 3;                        else if (new RectangleF(pointList[selected][4].X - 3, pointList[selected][4].Y - 3, 7, 7).Contains(downPoint))                            movePointIndex = 4;                        else if (new RectangleF(pointList[selected][5].X - 3, pointList[selected][5].Y - 3, 7, 7).Contains(downPoint))                            movePointIndex = 5;                        else if (new RectangleF(pointList[selected][6].X - 3, pointList[selected][6].Y - 3, 7, 7).Contains(downPoint))                            movePointIndex = 6;                        else                            movePointIndex = -1;                    }                    if (canMove)                        return;                    selected = -1;                }            }        }        /// <summary>        /// 鼠标移动        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void BoxMouseMoveHandler(object sender, MouseEventArgs e)        {            this.documentWorkspace.panel.Cursor = Cursors.Default;            PointF movePoint = this.documentWorkspace.GetScalePoint(e.Location);                            if (operationK == 0)            {                if(clickCount == 1)                {                    this.endPoint = movePoint;                    pointList[lineCount][1] = endPoint;                }                else if(clickCount == 2)                {                    pointList[lineCount][2] = movePoint;                }                else if(clickCount == 3)                {                    pointList[lineCount][3] = movePoint;                }                else if (clickCount == 4)                {                    pointList[lineCount][4] = movePoint;                }                else if (clickCount == 5)                {                    pointList[lineCount][5] = movePoint;                }                else if (clickCount == 6)                {                    float dx = movePoint.X - lastPoint.X;                    float dy = movePoint.Y - lastPoint.Y;                    float dxTemp = movePoint.X - tempPoint.X;                    float dyTemp = movePoint.Y - tempPoint.Y;                    lastPoint.X = movePoint.X;                    lastPoint.Y = movePoint.Y;                    //垂线的情况                    if (pointList[lineCount][5].X == pointList[lineCount][4].X)                        pointList[lineCount][6].Y += dy;                    //平行线的情况                    else if (pointList[lineCount][5].Y == pointList[lineCount][4].Y)                        pointList[lineCount][6].X += dx;                    //其他                    else                    {                        float k = (pointList[lineCount][5].Y - pointList[lineCount][4].Y) / (pointList[lineCount][5].X - pointList[lineCount][4].X);                        float b = pointList[lineCount][4].Y - k * pointList[lineCount][4].X;                        if (Math.Abs(dxTemp) >= Math.Abs(dyTemp))                        {                            pointList[lineCount][6].X += dx;                            pointList[lineCount][6].Y = k * pointList[lineCount][6].X + b;                        }                        else                        {                            pointList[lineCount][6].Y += dy;                            pointList[lineCount][6].X = (pointList[lineCount][6].Y - b) / k;                        }                    }                }            }            else if (operationK == 1 && e.Button == MouseButtons.Left && selected > -1 && canMove)            {                float dx = movePoint.X - lastPoint.X;                float dy = movePoint.Y - lastPoint.Y;                float dxTemp = movePoint.X - tempPoint.X;                float dyTemp = movePoint.Y - tempPoint.Y;                lastPoint.X = movePoint.X;                lastPoint.Y = movePoint.Y;                if(movePointIndex == -1)                {                    RectangleF rectangleF = new RectangleF();                    rectangleF = rectangleFList[selected];                    if (rectangleF.Contains(movePoint))                        this.documentWorkspace.panel.Cursor = Cursors.SizeAll;                    rectangleF.X += dx;                    rectangleF.Y += dy;                    rectangleFList[selected] = rectangleF;                    for (int i = 0; i < pointList[selected].Count(); i++)                    {                        if (pointList[selected][i] == PointF.Empty)                            continue;                        pointList[selected][i].X += dx;                        pointList[selected][i].Y += dy;                    }                }                else if (movePointIndex == 0)                {                    pointList[selected][0].X += dx;                    pointList[selected][0].Y += dy;                    rectangleFList[selected] = CalcOtherRectangle(pointList[selected]);                }                else if (movePointIndex == 1)                {                    pointList[selected][1].X += dx;                    pointList[selected][1].Y += dy;                    rectangleFList[selected] = CalcOtherRectangle(pointList[selected]);                }                else if (movePointIndex == 2)                {                    pointList[selected][2].X += dx;                    pointList[selected][2].Y += dy;                    rectangleFList[selected] = CalcOtherRectangle(pointList[selected]);                }                else if (movePointIndex == 3)                {                    pointList[selected][3].X += dx;                    pointList[selected][3].Y += dy;                    rectangleFList[selected] = CalcOtherRectangle(pointList[selected]);                }                else if (movePointIndex == 4)                {                    pointList[selected][4].X += dx;                    pointList[selected][4].Y += dy;                    float k1 = (pointList[selected][1].Y - pointList[selected][0].Y) / (pointList[selected][1].X - pointList[selected][0].X);                    float b1 = pointList[selected][6].Y - k1 * pointList[selected][6].X;                    float k2 = (pointList[selected][5].Y - pointList[selected][4].Y) / (pointList[selected][5].X - pointList[selected][4].X);                    float b2 = pointList[selected][4].Y - k2 * pointList[selected][4].X;                    float x = (b2 - b1) / (k1 - k2);                    float y = (k1 * (b2 - b1) / (k1 - k2)) + b1;                    if (!float.IsNaN(x) && !float.IsInfinity(x) && !float.IsNaN(y) && !float.IsInfinity(y))                    {                        pointList[selected][6] = new PointF(x, y);                    }                                                    rectangleFList[selected] = CalcOtherRectangle(pointList[selected]);                }                else if (movePointIndex == 5)                {                    pointList[selected][5].X += dx;                    pointList[selected][5].Y += dy;                    float k1 = (pointList[selected][1].Y - pointList[selected][0].Y) / (pointList[selected][1].X - pointList[selected][0].X);                    float b1 = pointList[selected][6].Y - k1 * pointList[selected][6].X;                    float k2 = (pointList[selected][5].Y - pointList[selected][4].Y) / (pointList[selected][5].X - pointList[selected][4].X);                    float b2 = pointList[selected][4].Y - k2 * pointList[selected][4].X;                    float x = (b2 - b1) / (k1 - k2);                    float y = (k1 * (b2 - b1) / (k1 - k2)) + b1;                    if (!float.IsNaN(x) && !float.IsInfinity(x) && !float.IsNaN(y) && !float.IsInfinity(y))                    {                        pointList[selected][6] = new PointF(x, y);                    }                    rectangleFList[selected] = CalcOtherRectangle(pointList[selected]);                }                else if(movePointIndex == 6)                {                    //垂线的情况                    if (pointList[selected][5].X == pointList[selected][4].X)                        pointList[selected][6].Y += dy;                    //平行线的情况                    else if (pointList[selected][5].Y == pointList[selected][4].Y)                        pointList[selected][6].X += dx;                    //其他                    else                    {                        float k = (pointList[selected][5].Y - pointList[selected][4].Y) / (pointList[selected][5].X - pointList[selected][4].X);                        float b = pointList[selected][4].Y - k * pointList[selected][4].X;                        if (Math.Abs(dxTemp) >= Math.Abs(dyTemp))                        {                            pointList[selected][6].X += dx;                            pointList[selected][6].Y = k * pointList[selected][6].X + b;                        }                        else                        {                            pointList[selected][6].Y += dy;                            pointList[selected][6].X = (pointList[selected][6].Y - b) / k;                        }                    }                }            }            this.documentWorkspace.Refresh();        }        /// <summary>        /// 鼠标抬起        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void BoxMouseUpHandler(object sender, MouseEventArgs e)        {            if(e.Button == MouseButtons.Left)            {                if (operationK == 1)                {                    canMove = false;                    movePointIndex = -1;                    RefreshDataGridView1();                }            }        }        /// <summary>        /// 绘制事件        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void BoxPaintHandler(object sender, PaintEventArgs e)        {            if (this.documentWorkspace.CompositionSurface != null)            {                Rectangle rc = this.documentWorkspace.panel.ClientRectangle;                int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio);                int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio);                int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2;                int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2;                e.Graphics.TranslateTransform(x, y);                e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio);                Draw(e.Graphics);                e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);                e.Graphics.TranslateTransform(-x, -y);            }        }        /// <summary>        /// 绘制        /// </summary>        private void Draw(Graphics graphics)        {            graphics.SmoothingMode = SmoothingMode.AntiAlias;            burr = 0;            thickness = 0;            threePointAngle = 0;            Pen linePen = new Pen(this.panel1.BackColor, this.trackBar2.Value);            Pen borderPen = new Pen(Color.Black);//填充点外圈            SolidBrush insideBrush = new SolidBrush(Color.White);//填充点内圈            Pen rectPen = new Pen(Color.Black);            rectPen.DashStyle = DashStyle.Custom;            float[] dashArray = { 2.0f, 3.0f };            rectPen.DashPattern = dashArray;            Font textfont = new Font(this.comboBox1.SelectedItem.ToString(), float.Parse(this.comboBox2.Value.ToString()));            Brush textbrush = new SolidBrush(this.panel2.BackColor);            float offsetValue = float.Parse(this.comboBox2.Value.ToString()) * 2 / 3;            Matrix mtxSave = graphics.Transform;            Matrix matrix = graphics.Transform;            if (pointList.Count > 0)            {                for (int i = 0; i < pointList.Count; i++)                {                    PointF[] pointFs = pointList[i];                    if (pointFs.Count() > 1 && pointFs[0] != pointFs[1])                    {                        double oldLength = BasicCalculationHelper.GetDistance(pointFs[0], pointFs[1], 2);                        double resizedLength = 20 / unitLengthUm + oldLength;                        PointF resizedPointF = GetRotationPoint(pointFs[0], pointFs[1], Convert.ToDecimal(resizedLength));                        graphics.DrawLine(linePen, pointFs[0], resizedPointF);                        if(pointFs[2] != PointF.Empty)                        {                            PointF dropFeet = BasicCalculationHelper.GetDropFeet(pointFs[0], pointFs[1], pointFs[2]);                            graphics.DrawLine(linePen, pointFs[2], dropFeet);                            PointF stepTwoPointF = new PointF(resizedPointF.X - (dropFeet.X - pointFs[2].X), resizedPointF.Y - (dropFeet.Y - pointFs[2].Y));                            graphics.DrawLine(linePen, pointFs[2], stepTwoPointF);                            burr = BasicCalculationHelper.GetDistance(dropFeet, pointFs[2], 10) * unitLengthUm;                            matrix = graphics.Transform;                            double burrAngle = BasicCalculationHelper.Angle(dropFeet, pointFs[2], new PointF(dropFeet.X, pointFs[2].Y));                            PointF rotationPoint = new PointF();                            if (burrAngle == 0)                            {                                if (pointFs[2].X > dropFeet.X)                                {                                    rotationPoint = dropFeet;                                }                                else                                {                                    rotationPoint = pointFs[2];                                }                            }                            else if (burrAngle < 90)                            {                                rotationPoint = dropFeet;                                matrix.RotateAt((float)burrAngle, dropFeet);                                graphics.Transform = matrix;                            }                            else                            {                                rotationPoint = pointFs[2];                                burrAngle = BasicCalculationHelper.Angle(pointFs[2], dropFeet, new PointF(pointFs[2].X, dropFeet.Y));                                matrix.RotateAt((float)burrAngle, pointFs[2]);                                graphics.Transform = matrix;                            }                            SizeF sizeF = graphics.MeasureString(burr + "μm", textfont);                            RectangleF fontRectF = new RectangleF();                            fontRectF.Location = new PointF(rotationPoint.X + offsetValue, rotationPoint.Y + offsetValue);                            fontRectF.Width = sizeF.Width;                            fontRectF.Height = sizeF.Height;                            graphics.DrawString(Math.Round(burr, Convert.ToInt32(this.numericUpDown1.Value)) + "μm", textfont, textbrush, fontRectF);                            graphics.Transform = mtxSave;                        }                        if (pointFs[3] != PointF.Empty)                        {                            PointF dropFeet2 = BasicCalculationHelper.GetDropFeet(pointFs[0], pointFs[1], pointFs[3]);                            graphics.DrawLine(linePen, pointFs[3], dropFeet2);                        }                        if(pointFs[4] != PointF.Empty)                        {                            PointF dropFeet3 = BasicCalculationHelper.GetDropFeet(pointFs[0], pointFs[1], pointFs[4]);                            graphics.DrawLine(linePen, pointFs[4], dropFeet3);                            PointF stepFourPointF = new PointF(pointFs[4].X - dropFeet3.X + resizedPointF.X, pointFs[4].Y - dropFeet3.Y + resizedPointF.Y);                            graphics.DrawLine(linePen, pointFs[4], stepFourPointF);                            PointF dropFeet4 = GetRotationPoint(dropFeet3, resizedPointF, Convert.ToDecimal(20 / unitLengthUm));                            PointF stepFourPointF2 = new PointF(pointFs[4].X - dropFeet3.X + dropFeet4.X, pointFs[4].Y - dropFeet3.Y + dropFeet4.Y);                            graphics.DrawLine(linePen, dropFeet4, stepFourPointF2);                            otherThickness = BasicCalculationHelper.GetDistance(dropFeet4, stepFourPointF2, 10) * unitLengthUm;                            matrix = graphics.Transform;                            double otherThicknessAngle = BasicCalculationHelper.Angle(dropFeet4, stepFourPointF2, new PointF(dropFeet4.X, stepFourPointF2.Y));                            PointF rotationPoint = new PointF();                            if (otherThicknessAngle == 0)                            {                                if (stepFourPointF2.X > dropFeet4.X)                                {                                    rotationPoint = dropFeet4;                                }                                else                                {                                    rotationPoint = stepFourPointF2;                                }                            }                            else if (otherThicknessAngle < 90)                            {                                rotationPoint = dropFeet4;                                matrix.RotateAt((float)otherThicknessAngle, dropFeet4);                                graphics.Transform = matrix;                            }                            else                            {                                rotationPoint = stepFourPointF2;                                otherThicknessAngle = BasicCalculationHelper.Angle(stepFourPointF2, dropFeet4, new PointF(stepFourPointF2.X, dropFeet4.Y));                                matrix.RotateAt((float)otherThicknessAngle, stepFourPointF2);                                graphics.Transform = matrix;                            }                            SizeF sizeF = graphics.MeasureString(otherThickness + "μm", textfont);                            RectangleF fontRectF = new RectangleF();                            fontRectF.Location = new PointF(rotationPoint.X + offsetValue, rotationPoint.Y + offsetValue);                            fontRectF.Width = sizeF.Width;                            fontRectF.Height = sizeF.Height;                            graphics.DrawString(Math.Round(otherThickness, Convert.ToInt32(this.numericUpDown1.Value)) + "μm", textfont, textbrush, fontRectF);                            graphics.Transform = mtxSave;                            if (pointFs[5] != PointF.Empty)                            {                                graphics.DrawLine(linePen, pointFs[5], pointFs[4]);                                PointF dropFeet5 = BasicCalculationHelper.GetDropFeet(pointFs[4], dropFeet3, pointFs[5]);                                graphics.DrawLine(linePen, pointFs[4], dropFeet5);                                if(pointFs[4] != pointFs[5])                                {                                    // 判断第一个点象限                                    float x1 = pointFs[5].X - pointFs[4].X;                                    if (x1 == 0)                                        x1 = 1;                                    float y1 = pointFs[5].Y - pointFs[4].Y;                                    if (y1 == 0)                                        y1 = 1;                                    int j1 = 0;                                    if (x1 > 0 && y1 > 0)             //第4象限                                    {                                        j1 = 4;                                    }                                    else if (x1 > 0 && y1 < 0)      //第1象限                                    {                                        j1 = 1;                                    }                                    else if (x1 < 0 && y1 < 0)       //第2象限                                    {                                        j1 = 2;                                    }                                    else if (x1 < 0 && y1 > 0)          //第3象限                                    {                                        j1 = 3;                                    }                                    // 判断第三个点象限                                    float x3 = dropFeet5.X - pointFs[4].X;                                    if (x3 == 0)                                        x3 = 1;                                    float y3 = dropFeet5.Y - pointFs[4].Y;                                    if (y3 == 0)                                        y3 = 1;                                    int j3 = 0;                                    if (x3 > 0 && y3 > 0)             //第4象限                                    {                                        j3 = 4;                                    }                                    else if (x3 > 0 && y3 < 0)      //第1象限                                    {                                        j3 = 1;                                    }                                    else if (x3 < 0 && y3 < 0)       //第2象限                                    {                                        j3 = 2;                                    }                                    else if (x3 < 0 && y3 > 0)          //第3象限                                    {                                        j3 = 3;                                    }                                    threePointAngle = BasicCalculationHelper.AngleText(pointFs[4], pointFs[5], dropFeet5);                                    double startAngle = BasicCalculationHelper.AngleText(pointFs[4], new PointF(pointFs[5].X, pointFs[4].Y), pointFs[5]);                                    double endAngle = BasicCalculationHelper.AngleText(pointFs[4], new PointF(dropFeet5.X, pointFs[4].Y), dropFeet5);                                    if (threePointAngle > 90)                                        threePointAngle = 180 - threePointAngle;                                    if (threePointAngle < 0.5)                                        threePointAngle = 0.5;                                    if(j1 == 1 && j3 == 1)                                    {                                        if (startAngle > endAngle)                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 360 - (float)startAngle, (float)(threePointAngle));                                        else                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 360 - (float)endAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 1 && j3 == 2)                                    {                                        graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 180 + (float)endAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 1 && j3 == 3)                                    {                                        if (startAngle > endAngle)                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 180 - (float)endAngle, (float)(threePointAngle));                                        else                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 360 - (float)endAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 1 && j3 == 4)                                    {                                        graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 360 - (float)startAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 2 && j3 == 1)                                    {                                        graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 180 + (float)startAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 2 && j3 == 2)                                    {                                        if (startAngle > endAngle)                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 180 + (float)endAngle, (float)(threePointAngle));                                        else                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 180 + (float)startAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 2 && j3 == 3)                                    {                                        graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 180 - (float)endAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 2 && j3 == 4)                                    {                                        if (startAngle > endAngle)                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 180 + (float)startAngle, (float)(threePointAngle));                                        else                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, (float)endAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 3 && j3 == 1)                                    {                                        if (startAngle > endAngle)                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 360 - (float)endAngle, (float)(threePointAngle));                                        else                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 180 - (float)startAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 3 && j3 == 2)                                    {                                        graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 180 - (float)startAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 3 && j3 == 3)                                    {                                        if (startAngle > endAngle)                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 180 - (float)startAngle, (float)(threePointAngle));                                        else                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 180 - (float)endAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 3 && j3 == 4)                                    {                                        graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, (float)endAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 4 && j3 == 1)                                    {                                        graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 360 - (float)endAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 4 && j3 == 2)                                    {                                        if (startAngle > endAngle)                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, (float)startAngle, (float)(threePointAngle));                                        else                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, 180 + (float)endAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 4 && j3 == 3)                                    {                                        graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, (float)startAngle, (float)(threePointAngle));                                    }                                    else if (j1 == 4 && j3 == 4)                                    {                                        if (startAngle > endAngle)                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, (float)endAngle, (float)(threePointAngle));                                        else                                            graphics.DrawArc(linePen, pointFs[4].X - 30, pointFs[4].Y - 30, 60, 60, (float)startAngle, (float)(threePointAngle));                                    }                                    matrix = graphics.Transform;                                    SizeF angleSize = graphics.MeasureString(threePointAngle + "°", textfont);                                    RectangleF angleRectF = new RectangleF();                                    angleRectF.Location = new PointF(pointFs[4].X + 45 + offsetValue, pointFs[4].Y - textfont.Size * 1.5f);                                    angleRectF.Width = angleSize.Width;                                    angleRectF.Height = angleSize.Height;                                    double threeAngle = BasicCalculationHelper.Angle(pointFs[4], pointFs[5], new PointF(pointFs[4].X, pointFs[5].Y));                                    matrix.RotateAt((float)threeAngle , pointFs[4]);                                    graphics.Transform = matrix;                                    graphics.DrawString(Math.Round(threePointAngle, Convert.ToInt32(this.numericUpDown1.Value)) + "°", textfont, textbrush, angleRectF);                                    //graphics.DrawString(threeAngle + "°", textfont, textbrush, angleRectF);                                    graphics.Transform = mtxSave;                                }                                if(pointFs[6] != PointF.Empty)                                {                                    double k = (pointFs[1].Y - pointFs[0].Y) / (pointFs[1].X - pointFs[0].X);                                    PointF dropFeet6 = BasicCalculationHelper.GetDropFeet(pointFs[6], k, pointFs[0]);                                    graphics.DrawLine(linePen, pointFs[6], dropFeet6);                                    PointF centerP = new PointF((pointFs[6].X + dropFeet6.X) / 2, (pointFs[6].Y + dropFeet6.Y) / 2);                                    PointF dropFeet7 = BasicCalculationHelper.GetDropFeet(pointFs[0], pointFs[1], centerP);                                    graphics.DrawLine(linePen, centerP, dropFeet7);                                    thickness = BasicCalculationHelper.GetDistance(centerP, dropFeet7, 10) * unitLengthUm;                                    matrix = graphics.Transform;                                    double thicknessAngle = BasicCalculationHelper.Angle(dropFeet7, centerP, new PointF(dropFeet7.X, centerP.Y));                                    PointF rotationPoint2 = new PointF();                                    if (thicknessAngle == 0)                                    {                                        if (centerP.X > dropFeet7.X)                                        {                                            rotationPoint2 = dropFeet7;                                        }                                        else                                        {                                            rotationPoint2 = centerP;                                        }                                    }                                    else if (thicknessAngle < 90)                                    {                                        rotationPoint2 = dropFeet7;                                        matrix.RotateAt((float)thicknessAngle, dropFeet7);                                        graphics.Transform = matrix;                                    }                                    else                                    {                                        rotationPoint2 = centerP;                                        thicknessAngle = BasicCalculationHelper.Angle(centerP, dropFeet7, new PointF(centerP.X, dropFeet7.Y));                                        matrix.RotateAt((float)thicknessAngle, centerP);                                        graphics.Transform = matrix;                                    }                                    SizeF sizeF2 = graphics.MeasureString(thickness + "μm", textfont);                                    RectangleF fontRectF2 = new RectangleF();                                    fontRectF2.Location = new PointF(rotationPoint2.X + offsetValue, rotationPoint2.Y + offsetValue);                                    fontRectF2.Width = sizeF2.Width;                                    fontRectF2.Height = sizeF2.Height;                                    graphics.DrawString(Math.Round(thickness, Convert.ToInt32(this.numericUpDown1.Value)) + "μm", textfont, textbrush, fontRectF2);                                    graphics.Transform = mtxSave;                                }                            }                        }                        //一直修改几个计算的值                        if (calcDic.Count == pointList.Count)                        {                            calcDic[i] = new Dictionary<string, double>();                            calcDic[i].Add("thickness", thickness);                            calcDic[i].Add("burr", burr);                            calcDic[i].Add("otherThickness", otherThickness / thickness * 100);                            calcDic[i].Add("threePointAngle", threePointAngle);                            calcDic[i].Add("temp", otherThickness);//暂时的值,为了导出项目用                        }                        else if (calcDic.Count < pointList.Count)                        {                            Dictionary<string, double> nowDic = new Dictionary<string, double>();                            nowDic.Add("thickness", thickness);                            nowDic.Add("burr", burr);                            nowDic.Add("otherThickness", otherThickness / thickness * 100);                            nowDic.Add("threePointAngle", threePointAngle);                            nowDic.Add("temp", otherThickness);//暂时的值,为了导出项目用                            calcDic.Add(nowDic);                        }                    }                }                if(selected > -1)                {                    foreach (PointF pf in pointList[selected])                    {                        if (pf != PointF.Empty)                        {                            graphics.DrawRectangle(borderPen, new Rectangle((int)(pf.X - 3), (int)(pf.Y - 3), 7, 7));                            graphics.FillRectangle(insideBrush, new RectangleF(pf.X - 3, pf.Y - 3, 7, 7));                        }                    }                    graphics.DrawRectangle(rectPen, rectangleFList[selected].X, rectangleFList[selected].Y, rectangleFList[selected].Width, rectangleFList[selected].Height);                }            }            linePen.Dispose();            borderPen.Dispose();            insideBrush.Dispose();            rectPen.Dispose();            mtxSave.Dispose();            matrix.Dispose();        }        /// <summary>        /// 向数据展示表插入数据        /// </summary>        private void AddContentToDataGridView()        {            Dictionary<string, double> nowDic = calcDic[lineCount - 1];            DataGridViewRow row = new DataGridViewRow();            row.Height = 37;            //编号            row.Cells.Add(CreateTextBoxCell("L" + (lineCount), ""));            //厚度            double col1 = 0;            nowDic.TryGetValue("thickness", out col1);            row.Cells.Add(CreateTextBoxCell(Math.Round(col1, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));            //BURR            double col2 = 0;            nowDic.TryGetValue("burr", out col2);            row.Cells.Add(CreateTextBoxCell(Math.Round(col2, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));            //I            double col3 = 0;            nowDic.TryGetValue("otherThickness", out col3);            row.Cells.Add(CreateTextBoxCell(Math.Round(col3, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));            //贝塔            double col4 = 0;            nowDic.TryGetValue("threePointAngle", out col4);            row.Cells.Add(CreateTextBoxCell(Math.Round(col4, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));            if (this.dataGridView1.Rows.Count == 0)            {                this.dataGridView1.Rows.Add(row);                //DataGridViewRow rowAvg = new DataGridViewRow();                //rowAvg.Height = 36;                //rowAvg.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.Image.Average.Text"), ""));                //rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(1), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                //rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(2), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                //rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(3), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                //rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(4), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                //this.dataGridView1.Rows.Add(rowAvg);            }            else            {                this.dataGridView1.Rows.Insert(lineCount - 1, row);                //this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[1].Value = Math.Round(CalculateAverage(1), Convert.ToInt32(this.numericUpDown1.Value));                //this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[2].Value = Math.Round(CalculateAverage(2), Convert.ToInt32(this.numericUpDown1.Value));                //this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[3].Value = Math.Round(CalculateAverage(3), Convert.ToInt32(this.numericUpDown1.Value));                //this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Cells[4].Value = Math.Round(CalculateAverage(4), Convert.ToInt32(this.numericUpDown1.Value));            }                        this.dataGridView1.ClearSelection();            this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;        }        /// <summary>        /// 计算指定索引列的平均值        /// </summary>        /// <param name="ColumnIndex"></param>        /// <returns></returns>        private double CalculateAverage(int ColumnIndex)        {            double sum = 0;            double avg = 0;            if (this.dataGridView1.Rows.Count > 0)            {                for (int i = 0; i < lineCount; i++)                {                    try                    {                        double cellValue = double.Parse(this.dataGridView1.Rows[i].Cells[ColumnIndex].Value.ToString());                        sum += cellValue;                    }                    catch (Exception e)                    {                        continue;                    }                }                avg = sum / lineCount;            }            return avg;        }        /// <summary>        /// 分析结果列表选择切换        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void listView2_SelectedIndexChanged(object sender, EventArgs e)        {            if (this.showAll)                return;            RefreshDataGridView2();        }        /// <summary>        /// 刷新数据展示表        /// </summary>        private void RefreshDataGridView1()        {            int selectedRowIndex = -1;            if (this.dataGridView1.Rows.Count > 0)                selectedRowIndex = this.dataGridView1.SelectedRows[0].Index;            this.dataGridView1.Rows.Clear();            if(calcDic != null && calcDic.Count > 0)            {                for(int i = 0; i < calcDic.Count; i++)                {                    DataGridViewRow row = new DataGridViewRow();                    row.Height = 37;                    //编号                    row.Cells.Add(CreateTextBoxCell("L" + (i + 1), ""));                    //厚度                    double col1 = 0;                    calcDic[i].TryGetValue("thickness", out col1);                    row.Cells.Add(CreateTextBoxCell(Math.Round(col1, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                    //burr                    double col2 = 0;                    calcDic[i].TryGetValue("burr", out col2);                    row.Cells.Add(CreateTextBoxCell(Math.Round(col2, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                    //I                    double col3 = 0;                    calcDic[i].TryGetValue("otherThickness", out col3);                    row.Cells.Add(CreateTextBoxCell(Math.Round(col3, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                    //贝塔                    double col4 = 0;                    calcDic[i].TryGetValue("threePointAngle", out col4);                    row.Cells.Add(CreateTextBoxCell(Math.Round(col4, Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));                    this.dataGridView1.Rows.Add(row);                }            }            //if (this.dataGridView1.Rows.Count > 0)            //{            //    DataGridViewRow rowAvg = new DataGridViewRow();            //    rowAvg.Height = 36;            //    rowAvg.Cells.Add(CreateTextBoxCell(PdnResources.GetString("Menu.Image.Average.Text"), ""));            //    rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(1), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));            //    rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(2), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));            //    rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(3), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));            //    rowAvg.Cells.Add(CreateTextBoxCell(Math.Round(CalculateAverage(4), Convert.ToInt32(this.numericUpDown1.Value)) + "", ""));            //    this.dataGridView1.Rows.Add(rowAvg);            //}            this.dataGridView1.ClearSelection();            if (selectedRowIndex > this.dataGridView1.Rows.Count - 1)                selectedRowIndex = this.dataGridView1.Rows.Count - 1;            if (selectedRowIndex < 0)                selectedRowIndex = 0;            if (this.dataGridView1.Rows.Count > 0)                this.dataGridView1.Rows[selectedRowIndex].Selected = true;        }        /// <summary>        /// 重新计算改变长度后的点        /// </summary>        /// <param name="cen"></param>        /// <param name="rotation"></param>        /// <param name="newLineLength"></param>        /// <returns></returns>        private PointF GetRotationPoint(PointF cen, PointF rotation, decimal newLength)        {            decimal maxValue = Convert.ToDecimal(Math.Sqrt(int.MaxValue));            decimal minValue = Convert.ToDecimal(Math.Sqrt(4.9E-324));            double lineLength = BasicCalculationHelper.GetDistance(cen, rotation, 10);            if (newLength >= maxValue)                return PointF.Empty;            if (newLength <= minValue)                return PointF.Empty;            PointF rotationPoint = new PointF(cen.X + (float)newLength, cen.Y);            double angle = BasicCalculationHelper.Angle(cen, new PointF(cen.X + (float)lineLength, cen.Y), rotation);            if (rotation.Y < cen.Y)            {                angle = 360 - angle;            }            Matrix matrix = new Matrix();            matrix.RotateAt((float)angle, cen);            PointF[] ff = new PointF[1];            ff[0] = rotationPoint;            matrix.TransformPoints(ff);            matrix.Dispose();            matrix = null;            return ff[0];        }        /// <summary>        /// 字体改变        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)        {            this.documentWorkspace.Refresh();        }        /// <summary>        /// 字号改变        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)        {            this.documentWorkspace.Refresh();        }        /// <summary>        /// 计算外接矩形        /// </summary>        private RectangleF CalcOtherRectangle(PointF[] pointfArr)        {            RectangleF rectangleF = new RectangleF();            float[] pointX = new float[] { pointfArr[0].X, pointfArr[1].X, pointfArr[2].X, pointfArr[3].X, pointfArr[4].X, pointfArr[5].X, pointfArr[6].X };            rectangleF.X = (int)pointX.Min();            float[] pointY = new float[] { pointfArr[0].Y, pointfArr[1].Y, pointfArr[2].Y, pointfArr[3].Y, pointfArr[4].Y, pointfArr[5].Y, pointfArr[6].Y };            rectangleF.Y = (int)pointY.Min();            rectangleF.Width = (int)Math.Abs(pointX.Max() - pointX.Min());            rectangleF.Height = (int)Math.Abs(pointY.Max() - pointY.Min());            return new RectangleF(rectangleF.X - 3, rectangleF.Y - 3, rectangleF.Width + 7, rectangleF.Height + 7);        }        /// <summary>        /// 字号改变        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void comboBox2_ValueChanged(object sender, EventArgs e)        {            this.documentWorkspace.Refresh();        }        /// <summary>        /// 导出项目按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button10_Click(object sender, EventArgs e)        {            try            {                if (dataGridView2.Rows.Count == 0)                {                    MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text")+"!");                    return;                }                if (this.analyzeSettingModel == null)                {                    MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");                    return;                }                //获取项目工程内的文件夹路径                ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.NonferrousMetal.QualityOfEdge.Text", this.analyzeSettingModel.savePath);                if(item != null)                {                    //向文件夹内保存图片和报告                    if (!string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))                    {                        //获取word书签与excel单元格的关系,以字典方式存储                        List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);                        Dictionary<string, string> tagInfos = new Dictionary<string, string>();                        if (mic_module_infos != null && mic_module_infos.Count > 0)                        {                            foreach (mic_module_infos info in mic_module_infos)                            {                                tagInfos.Add(info.tag_name, info.cell_position);                            }                        }                        //分析结果                        List<List<string>> analysisContent = new List<List<string>>();                        List<string> contentHead = new List<string>();                        contentHead.Add(PdnResources.GetString("Menu.picture.Text"));                        contentHead.Add(PdnResources.GetString("Menu.alloydesignation.text"));                        contentHead.Add(PdnResources.GetString("Menu.volumenumber.text"));                        contentHead.Add(PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.serialnumber.text"));                        contentHead.Add(PdnResources.GetString("Menu.thickness.text"));                        contentHead.Add("BURR(μm)");                        contentHead.Add("I(%)");                        contentHead.Add("β(°)");                        contentHead.Add(PdnResources.GetString("Menu.Remark.text"));                        analysisContent.Add(contentHead);                        foreach (DataGridViewRow rowItem in this.dataGridView2.Rows)                        {                            List<string> content = new List<string>();                            content.Add(rowItem.Cells[0].Value.ToString());                            content.Add(rowItem.Cells[1].Value.ToString());                            content.Add(rowItem.Cells[2].Value.ToString());                            content.Add(rowItem.Cells[3].Value.ToString());                            content.Add(rowItem.Cells[4].Value.ToString());                            content.Add(rowItem.Cells[5].Value.ToString());                            content.Add(rowItem.Cells[6].Value.ToString());                            content.Add(rowItem.Cells[7].Value.ToString());                            content.Add(rowItem.Cells[8].Value.ToString());                            analysisContent.Add(content);                        }                        //图片                        bitList = new List<Bitmap>();                        if (this.showAll)                        {                            foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitDic)                            {                                bitList.Add(kv.Value[0]);                                bitList.Add(kv.Value[1]);                            }                        }                        else                        {                            if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)                            {                                foreach (ListViewItem rowItem in this.listView2.SelectedItems)                                {                                    if (bitDic.ContainsKey(rowItem.Name))                                    {                                        bitList.Add(bitDic[rowItem.Name][0]);                                        bitList.Add(bitDic[rowItem.Name][1]);                                    }                                }                            }                        }                        //中间数据                        if (!this.showAll)                        {                            if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)                            {                                List<ExportProjectModel> exportModel = new List<ExportProjectModel>();                                foreach (ListViewItem rowItem in this.listView2.SelectedItems)                                {                                    foreach (ExportProjectModel model in this.tempDataModel)                                    {                                        if (model.tagName.Equals(rowItem.Name))                                        {                                            ExportProjectModel tempModel = new ExportProjectModel();                                            tempModel.tagName = model.tagName;                                            tempModel.picName = model.picName;                                            tempModel.dataList = model.dataList;                                            exportModel.Add(tempModel);                                            break;                                        }                                    }                                }                                this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);                            }                        }                        else                            this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, item.path, item.code);                    }                    else                    {                        MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");                        return;                    }                    //保存项目信息到数据库                    this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);                }            }            catch (Exception)            {            }        }        #region 参数保存及提取        /// <summary>        /// 保存参数的key,value和type        /// </summary>        /// <param name="param_key"></param>        /// <param name="param_value"></param>        /// <param name="param_type"></param>        private void saveParamValue(string param_key, string param_value, int param_type)        {            bool foundItem = false;            foreach (var item in this.analysisModel.ListParam)            {                if (item.param_key.Equals(param_key) && item.menuId == this.menuId)                {                    item.param_value = param_value;                    item.setValue();                    foundItem = true;                    break;                }            }            if (!foundItem)            {                GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel();                analysisItem.menuId = this.menuId;                analysisItem.param_key = param_key;                analysisItem.param_type = param_type;                analysisItem.param_value = param_value;                analysisItem.setValue();                this.analysisModel.ListParam.Add(analysisItem);            }        }        /// <summary>        /// 保存界面中的参数到model        /// </summary>        private void saveDialogParamValues()        {            saveParamValue(ParamKey_Report, checkBox1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//报告设置            saveParamValue(ParamKey_Brand, textBox1.Text, (int)Base.Dtryt.ItemString);//合金牌号            saveParamValue(ParamKey_ReelNumber, textBox3.Text, (int)Base.Dtryt.ItemString);//卷号            saveParamValue(ParamKey_Remarks, richTextBox1.Text, (int)Base.Dtryt.ItemString);//备注            saveParamValue(ParamKey_LineWidth, textBox2.Text, (int)Base.Dtryt.ItemString);//线宽            saveParamValue(ParamKey_LineColour, panel1.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//线颜色            saveParamValue(ParamKey_FontStyle, comboBox1.Text, (int)Base.Dtryt.ItemString);//字体            saveParamValue(ParamKey_FontSize, comboBox2 != null ? comboBox2.Value.ToString() : "", (int)Base.Dtryt.Decimal);//字号            saveParamValue(ParamKey_FontColour, panel2.BackColor.ToArgb().ToString(), (int)Base.Dtryt.Color);//字颜色            saveParamValue(ParamKey_DecimalPlace, numericUpDown1 != null ? numericUpDown1.Value.ToString() : "", (int)Base.Dtryt.Decimal);//保留小数位数        }        /// <summary>        /// 获取保存的参数        /// </summary>        private void GetListParamModel()        {            if (this.analysisModel != null)            {                for (int i = 0; i < this.analysisModel.ListParam.Count; i++)                {                    switch (this.analysisModel.ListParam[i].param_key)                    {                        case ParamKey_Report:                            checkBox1.Checked = (Boolean)this.analysisModel.ListParam[i].value;                            break;                        case ParamKey_Brand:                            textBox1.Text = (string)this.analysisModel.ListParam[i].value;                            break;                        case ParamKey_ReelNumber:                            textBox3.Text = (string)this.analysisModel.ListParam[i].value;                            break;                        case ParamKey_Remarks:                            richTextBox1.Text = (string)this.analysisModel.ListParam[i].value;                            break;                        case ParamKey_LineWidth:                            textBox2.Text = this.analysisModel.ListParam[i].value.ToString();                            trackBar2.Value = Convert.ToInt32(this.textBox2.Text);                            break;                        case ParamKey_LineColour:                            panel1.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);                            break;                        case ParamKey_FontStyle:                            comboBox1.Text = (string)this.analysisModel.ListParam[i].value;                            break;                        case ParamKey_FontSize:                            comboBox2.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);                            break;                        case ParamKey_FontColour:                            panel2.BackColor = Color.FromArgb((int)this.analysisModel.ListParam[i].value);                            break;                        case ParamKey_DecimalPlace:                            numericUpDown1.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value);                            break;                    }                }            }        }       /// <summary>       /// 关闭窗体时保存参数       /// </summary>       /// <param name="sender"></param>       /// <param name="e"></param>        private void QualityOfEdgeDialog_FormClosing(object sender, FormClosingEventArgs e)        {            #region [开启脚本录制]            if (appWorkspace.startScriptRecording)            {                getScriptRecording();            }            #endregion            this.saveDialogParamValues();            //xml保存路径            string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml";            GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer<GrainSizeAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open));            foreach (var analysisItem in this.analysisModel.ListParam)            {                bool foundItem = false;                foreach (var item in analysisModelXml.ListParam)                {                    if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId)                    {                        item.param_value = analysisItem.param_value;                        foundItem = true;                        break;                    }                }                if (!foundItem)                    analysisModelXml.ListParam.Add(analysisItem.cloneModel());            }            //按路径和名称保存xml文件            string userInfoXml = XmlSerializeHelper.XmlSerialize<GrainSizeAnalysisModel>(analysisModelXml);            //保存xml            FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create);        }        #endregion        #region [脚本相关]        private void getValue(string key, object value)        {            switch (key)            {                case "parameter1":                    trackBar2.Value = Convert.ToInt32(value);                    textBox2.Text = value.ToString();                    break;                case "parameter2":                    panel1.BackColor = Color.FromArgb((int)value);                    break;                case "parameter3":                    comboBox2.Value = Convert.ToInt32(value);                    break;                case "parameter4":                    panel2.BackColor = Color.FromArgb((int)value);                    break;                case "parameter6":                    this.comboBox1.SelectedIndex = (int)value;                    break;                case "OpenWhileExportReport":                    checkBox1.Checked = Convert.ToBoolean(value);                    break;                case "CalculatorDecimalDigits":                    numericUpDown1.Value = Convert.ToDecimal(value);                    break;            }        }        #endregion        #region [脚本录制]        private void getScriptRecording()        {            string className = InvariantData.path_Action + ".Action" + menuId;            ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className);            List<Args> args = param.Lists;            foreach (var item in args)            {                item.value = setScriptRecording(item.key);            }            appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);        }        private object setScriptRecording(string key)        {            object value = null;            switch (key)            {                case "parameter1":                    value = trackBar2.Value;                    break;                case "parameter2":                    value = panel1.BackColor.ToArgb();                    break;                case "parameter3":                    value = comboBox2.Value;                    break;                case "parameter4":                    value = panel2.BackColor.ToArgb();                    break;                case "parameter6":                    value = this.comboBox1.SelectedIndex;                    break;                case "OpenWhileExportReport":                    value = checkBox1.Checked;                    break;                case "CalculatorDecimalDigits":                    value = numericUpDown1.Value;                    break;            }            return value;        }        #endregion    }}
 |