| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445 | using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SQLite;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using PaintDotNet.Annotation.Enum;using PaintDotNet.Annotation.Measure;using PaintDotNet.Base.CommTool;using PaintDotNet.Base.SettingModel;using PaintDotNet.CustomControl;using PaintDotNet.GeneralAnalysis.Special;using PaintDotNet.DbOpreate.DbModel;using PaintDotNet.DbOpreate.DbBll;using System.IO;using PaintDotNet.Base.Functionodel;using PaintDotNet.Annotation;using PaintDotNet.Instrument;using Metis.ParameterSet;namespace PaintDotNet.GeneralAnalysis{    /// <summary>    /// 专项测量 - 长度    /// </summary>    internal class SpecialMeasureLengthDialog : PdnBaseForm    {        #region        /// <summary>        /// Required designer variable.        /// </summary>        private System.ComponentModel.IContainer components = null;        /// <summary>        /// Clean up any resources being used.        /// </summary>        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>        protected override void Dispose(bool disposing)        {            if (disposing && (components != null))            {                components.Dispose();            }            base.Dispose(disposing);        }        #region Windows Form Designer generated code        private void InitializeLanguageText()         {            this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");            this.btnSave.Text = PdnResources.GetString("Menu.Saveresult.text");            this.btnSetting.Text = PdnResources.GetString("Menu.Setting.Text");            this.chkOpenSetting.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text");            this.btnMeasure.Text = PdnResources.GetString("Menu.Startmeasuring.text");            this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");            this.groupBox3.Text = PdnResources.GetString("Menu.LabelAction.DrawLine.Text");            this.btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");            this.label3.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";            this.label2.Text = PdnResources.GetString("Menu.style.text") + ":";            this.label1.Text = PdnResources.GetString("Menu.color.text") + ":";            this.groupBox4.Text = PdnResources.GetString("Menu.Preview.text");            this.btnDelete.Text = PdnResources.GetString("Menu.Edit.Delete.Text");            this.groupBox5.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text");            this.btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");            this.label4.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";            this.label5.Text = PdnResources.GetString("Menu.style.text") + ":";            this.label6.Text = PdnResources.GetString("Menu.color.text") + ":";            this.groupBox6.Text = PdnResources.GetString("Menu.MeasureAction.MeasureParallelLine.Text");            this.btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");            this.label7.Text = PdnResources.GetString("Menu.Linewidth.text") + ":";            this.label8.Text = PdnResources.GetString("Menu.style.text") + ":";            this.label9.Text = PdnResources.GetString("Menu.color.text") + ":";            this.groupBox7.Text = PdnResources.GetString("Menu.Resultspreview.text");            this.label12.Text = PdnResources.GetString("Menu.Correspondinglevel.text") + ":";            this.label10.Text = PdnResources.GetString("Menu.averagevalue.text") + ":";            this.name.HeaderText = PdnResources.GetString("Menu.Levelname.text");            this.minValue.HeaderText = PdnResources.GetString("Menu.Begintovalue.Text");            this.maxValue.HeaderText = PdnResources.GetString("Menu.Theendvalu.Text");            this.groupBox8.Text = PdnResources.GetString("Menu.Analysisresult.text");            this.btnResultDel.Text = PdnResources.GetString("Menu.Edit.Delete.Text");            this.btnAllShow.Text = PdnResources.GetString("Menu.Showall.text");            this.picName.HeaderText = PdnResources.GetString("Menu.picture.Text");            this.level.HeaderText = PdnResources.GetString("Menu.Levelname.text");            this.avg.HeaderText = PdnResources.GetString("Menu.averagevalue.text");            this.label11.Text = PdnResources.GetString("Menu.Decimal.text");            this.btnExport.Text = PdnResources.GetString("Menu.Exportresults.text");            this.btnCreate.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");            this.btnExportProject.Text = PdnResources.GetString("Menu.Exportproject.text");            this.Text = PdnResources.GetString("Menu.Generalanalysis.Specialmeasurement.Specialmeth.text");        }        /// <summary>        /// Required method for Designer support - do not modify        /// the contents of this method with the code editor.        /// </summary>        private void InitializeComponent()        {            this.components = new System.ComponentModel.Container();            this.groupBox1 = new System.Windows.Forms.GroupBox();            this.btnSave = new System.Windows.Forms.Button();            this.btnSetting = new System.Windows.Forms.Button();            this.chkOpenSetting = new System.Windows.Forms.CheckBox();            this.btnMeasure = new System.Windows.Forms.Button();            this.cmbSpecial = new System.Windows.Forms.ComboBox();            this.groupBox2 = new System.Windows.Forms.GroupBox();            this.lstPic = new System.Windows.Forms.ListView();            this.imageList1 = new System.Windows.Forms.ImageList(this.components);            this.groupBox3 = new System.Windows.Forms.GroupBox();            this.btnStraightLineMeasure = new System.Windows.Forms.Button();            this.cmbStraightLine = new System.Windows.Forms.ComboBox();            this.pnlStraightLineColor = new System.Windows.Forms.Panel();            this.nudStraightLineWidth = new System.Windows.Forms.NumericUpDown();            this.label3 = new System.Windows.Forms.Label();            this.label2 = new System.Windows.Forms.Label();            this.label1 = new System.Windows.Forms.Label();            this.groupBox4 = new System.Windows.Forms.GroupBox();            this.pnlTools = new System.Windows.Forms.Panel();            this.btnDelete = new System.Windows.Forms.Button();            this.pnlShow = new System.Windows.Forms.Panel();            this.groupBox5 = new System.Windows.Forms.GroupBox();            this.btnLengthLineMeasure = new System.Windows.Forms.Button();            this.cmbLengthLine = new System.Windows.Forms.ComboBox();            this.pnlLengthLineColor = new System.Windows.Forms.Panel();            this.nudLengthLineWidth = new System.Windows.Forms.NumericUpDown();            this.label4 = new System.Windows.Forms.Label();            this.label5 = new System.Windows.Forms.Label();            this.label6 = new System.Windows.Forms.Label();            this.groupBox6 = new System.Windows.Forms.GroupBox();            this.btnParallelLineMeasure = new System.Windows.Forms.Button();            this.cmbParallelLine = new System.Windows.Forms.ComboBox();            this.pnlParallelLineColor = new System.Windows.Forms.Panel();            this.nudParallelLineWidth = new System.Windows.Forms.NumericUpDown();            this.label7 = new System.Windows.Forms.Label();            this.label8 = new System.Windows.Forms.Label();            this.label9 = new System.Windows.Forms.Label();            this.groupBox7 = new System.Windows.Forms.GroupBox();            this.lblLevel = new System.Windows.Forms.Label();            this.label12 = new System.Windows.Forms.Label();            this.lblAvg = new System.Windows.Forms.Label();            this.label10 = new System.Windows.Forms.Label();            this.dgvLevelList = new System.Windows.Forms.DataGridView();            this.name = new System.Windows.Forms.DataGridViewTextBoxColumn();            this.minValue = new System.Windows.Forms.DataGridViewTextBoxColumn();            this.maxValue = new System.Windows.Forms.DataGridViewTextBoxColumn();            this.groupBox8 = new System.Windows.Forms.GroupBox();            this.lstResult = new System.Windows.Forms.ListView();            this.btnResultDel = new System.Windows.Forms.Button();            this.btnAllShow = new System.Windows.Forms.Button();            this.groupBox9 = new System.Windows.Forms.GroupBox();            this.dgvResult = new System.Windows.Forms.DataGridView();            this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();            this.picName = new System.Windows.Forms.DataGridViewTextBoxColumn();            this.level = new System.Windows.Forms.DataGridViewTextBoxColumn();            this.avg = new System.Windows.Forms.DataGridViewTextBoxColumn();            this.groupBox10 = new System.Windows.Forms.GroupBox();            this.btnExportProject = new System.Windows.Forms.Button();            this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();            this.label11 = new System.Windows.Forms.Label();            this.btnExport = new System.Windows.Forms.Button();            this.btnCreate = new System.Windows.Forms.Button();            this.groupBox1.SuspendLayout();            this.groupBox2.SuspendLayout();            this.groupBox3.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.nudStraightLineWidth)).BeginInit();            this.groupBox4.SuspendLayout();            this.groupBox5.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.nudLengthLineWidth)).BeginInit();            this.groupBox6.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.nudParallelLineWidth)).BeginInit();            this.groupBox7.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.dgvLevelList)).BeginInit();            this.groupBox8.SuspendLayout();            this.groupBox9.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.dgvResult)).BeginInit();            this.groupBox10.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).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.btnSave);            this.groupBox1.Controls.Add(this.btnSetting);            this.groupBox1.Controls.Add(this.chkOpenSetting);            this.groupBox1.Controls.Add(this.btnMeasure);            this.groupBox1.Controls.Add(this.cmbSpecial);            this.groupBox1.Location = new System.Drawing.Point(12, 12);            this.groupBox1.Name = "groupBox1";            this.groupBox1.Size = new System.Drawing.Size(1210, 73);            this.groupBox1.TabIndex = 0;            this.groupBox1.TabStop = false;            this.groupBox1.Text = "操作";            //             // btnSave            //             this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));            this.btnSave.Location = new System.Drawing.Point(1091, 24);            this.btnSave.Name = "btnSave";            this.btnSave.Size = new System.Drawing.Size(101, 35);            this.btnSave.TabIndex = 4;            this.btnSave.Text = "保存结果";            this.btnSave.UseVisualStyleBackColor = true;            this.btnSave.Click += new System.EventHandler(this.btnSave_Click);            //             // btnSetting            //             this.btnSetting.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));            this.btnSetting.Location = new System.Drawing.Point(987, 24);            this.btnSetting.Name = "btnSetting";            this.btnSetting.Size = new System.Drawing.Size(85, 35);            this.btnSetting.TabIndex = 3;            this.btnSetting.Text = "设置";            this.btnSetting.UseVisualStyleBackColor = true;            this.btnSetting.Click += new System.EventHandler(this.btnSetting_Click);            //             // chkOpenSetting            //             this.chkOpenSetting.AutoSize = true;            this.chkOpenSetting.Checked = true;            this.chkOpenSetting.CheckState = System.Windows.Forms.CheckState.Checked;            this.chkOpenSetting.Location = new System.Drawing.Point(433, 31);            this.chkOpenSetting.Name = "chkOpenSetting";            this.chkOpenSetting.Size = new System.Drawing.Size(15, 14);            this.chkOpenSetting.TabIndex = 2;            this.chkOpenSetting.UseVisualStyleBackColor = true;            this.chkOpenSetting.CheckedChanged += new System.EventHandler(this.chkOpenSetting_CheckedChanged);            //             // btnMeasure            //             this.btnMeasure.Location = new System.Drawing.Point(268, 24);            this.btnMeasure.Name = "btnMeasure";            this.btnMeasure.Size = new System.Drawing.Size(137, 35);            this.btnMeasure.TabIndex = 1;            this.btnMeasure.UseVisualStyleBackColor = true;            this.btnMeasure.Click += new System.EventHandler(this.btnMeasure_Click);            //             // cmbSpecial            //             this.cmbSpecial.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;            this.cmbSpecial.FormattingEnabled = true;            this.cmbSpecial.Location = new System.Drawing.Point(17, 29);            this.cmbSpecial.Name = "cmbSpecial";            this.cmbSpecial.Size = new System.Drawing.Size(231, 20);            this.cmbSpecial.TabIndex = 0;            this.cmbSpecial.SelectedIndexChanged += new System.EventHandler(this.cmbSpecial_SelectedIndexChanged);            //             // 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.lstPic);            this.groupBox2.Location = new System.Drawing.Point(12, 88);            this.groupBox2.Name = "groupBox2";            this.groupBox2.Size = new System.Drawing.Size(200, 500);            this.groupBox2.TabIndex = 1;            this.groupBox2.TabStop = false;            this.groupBox2.Text = "图像索引";            //             // lstPic            //             this.lstPic.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)));            this.lstPic.HideSelection = false;            this.lstPic.LargeImageList = this.imageList1;            this.lstPic.Location = new System.Drawing.Point(17, 27);            this.lstPic.MultiSelect = false;            this.lstPic.Name = "lstPic";            this.lstPic.Size = new System.Drawing.Size(166, 460);            this.lstPic.TabIndex = 0;            this.lstPic.UseCompatibleStateImageBehavior = false;            this.lstPic.SelectedIndexChanged += new System.EventHandler(this.lstPic_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.Controls.Add(this.btnStraightLineMeasure);            this.groupBox3.Controls.Add(this.cmbStraightLine);            this.groupBox3.Controls.Add(this.pnlStraightLineColor);            this.groupBox3.Controls.Add(this.nudStraightLineWidth);            this.groupBox3.Controls.Add(this.label3);            this.groupBox3.Controls.Add(this.label2);            this.groupBox3.Controls.Add(this.label1);            this.groupBox3.Location = new System.Drawing.Point(218, 91);            this.groupBox3.Name = "groupBox3";            this.groupBox3.Size = new System.Drawing.Size(360, 100);            this.groupBox3.TabIndex = 2;            this.groupBox3.TabStop = false;            this.groupBox3.Text = "直线";            //             // btnStraightLineMeasure            //             this.btnStraightLineMeasure.Enabled = false;            this.btnStraightLineMeasure.Location = new System.Drawing.Point(263, 60);            this.btnStraightLineMeasure.Name = "btnStraightLineMeasure";            this.btnStraightLineMeasure.Size = new System.Drawing.Size(75, 25);            this.btnStraightLineMeasure.TabIndex = 6;            this.btnStraightLineMeasure.Text = "测量";            this.btnStraightLineMeasure.UseVisualStyleBackColor = true;            this.btnStraightLineMeasure.Click += new System.EventHandler(this.btnStraightLineMeasure_Click);            //             // cmbStraightLine            //             this.cmbStraightLine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;            this.cmbStraightLine.FormattingEnabled = true;            this.cmbStraightLine.Location = new System.Drawing.Point(62, 60);            this.cmbStraightLine.Name = "cmbStraightLine";            this.cmbStraightLine.Size = new System.Drawing.Size(190, 20);            this.cmbStraightLine.TabIndex = 5;            this.cmbStraightLine.SelectedIndexChanged += new System.EventHandler(this.cmbStraightLine_SelectedIndexChanged);            //             // pnlStraightLineColor            //             this.pnlStraightLineColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));            this.pnlStraightLineColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;            this.pnlStraightLineColor.Location = new System.Drawing.Point(62, 24);            this.pnlStraightLineColor.Name = "pnlStraightLineColor";            this.pnlStraightLineColor.Size = new System.Drawing.Size(91, 25);            this.pnlStraightLineColor.TabIndex = 4;            this.pnlStraightLineColor.BackColorChanged += new System.EventHandler(this.pnlStraightLineColor_BackColorChanged);            this.pnlStraightLineColor.Click += new System.EventHandler(this.pnlStraightLineColor_Click);            //             // nudStraightLineWidth            //             this.nudStraightLineWidth.Location = new System.Drawing.Point(263, 24);            this.nudStraightLineWidth.Maximum = new decimal(new int[] {            5,            0,            0,            0});            this.nudStraightLineWidth.Minimum = new decimal(new int[] {            1,            0,            0,            0});            this.nudStraightLineWidth.Name = "nudStraightLineWidth";            this.nudStraightLineWidth.Size = new System.Drawing.Size(78, 21);            this.nudStraightLineWidth.TabIndex = 3;            this.nudStraightLineWidth.Value = new decimal(new int[] {            1,            0,            0,            0});            this.nudStraightLineWidth.ValueChanged += new System.EventHandler(this.nudStraightLineWidth_ValueChanged);            this.nudStraightLineWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.nudStraightLineWidth_KeyUp);            //             // label3            //             this.label3.AutoSize = true;            this.label3.Location = new System.Drawing.Point(205, 30);            this.label3.Name = "label3";            this.label3.Size = new System.Drawing.Size(41, 12);            this.label3.TabIndex = 2;            this.label3.Text = "线宽:";            //             // label2            //             this.label2.AutoSize = true;            this.label2.Location = new System.Drawing.Point(16, 68);            this.label2.Name = "label2";            this.label2.Size = new System.Drawing.Size(41, 12);            this.label2.TabIndex = 1;            this.label2.Text = "样式:";            //             // label1            //             this.label1.AutoSize = true;            this.label1.Location = new System.Drawing.Point(16, 30);            this.label1.Name = "label1";            this.label1.Size = new System.Drawing.Size(41, 12);            this.label1.TabIndex = 0;            this.label1.Text = "颜色:";            //             // groupBox4            //             this.groupBox4.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.groupBox4.Controls.Add(this.pnlTools);            this.groupBox4.Controls.Add(this.btnDelete);            this.groupBox4.Controls.Add(this.pnlShow);            this.groupBox4.Location = new System.Drawing.Point(584, 91);            this.groupBox4.Name = "groupBox4";            this.groupBox4.Size = new System.Drawing.Size(638, 497);            this.groupBox4.TabIndex = 3;            this.groupBox4.TabStop = false;            this.groupBox4.Text = "预览";            //             // pnlTools            //             this.pnlTools.Location = new System.Drawing.Point(6, 22);            this.pnlTools.Name = "pnlTools";            this.pnlTools.Size = new System.Drawing.Size(305, 32);            this.pnlTools.TabIndex = 2;            //             // btnDelete            //             this.btnDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));            this.btnDelete.Location = new System.Drawing.Point(519, 22);            this.btnDelete.Name = "btnDelete";            this.btnDelete.Size = new System.Drawing.Size(101, 32);            this.btnDelete.TabIndex = 1;            this.btnDelete.Text = "删除";            this.btnDelete.UseVisualStyleBackColor = true;            this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);            //             // pnlShow            //             this.pnlShow.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.pnlShow.Location = new System.Drawing.Point(6, 60);            this.pnlShow.Name = "pnlShow";            this.pnlShow.Size = new System.Drawing.Size(626, 431);            this.pnlShow.TabIndex = 0;            //             // groupBox5            //             this.groupBox5.Controls.Add(this.btnLengthLineMeasure);            this.groupBox5.Controls.Add(this.cmbLengthLine);            this.groupBox5.Controls.Add(this.pnlLengthLineColor);            this.groupBox5.Controls.Add(this.nudLengthLineWidth);            this.groupBox5.Controls.Add(this.label4);            this.groupBox5.Controls.Add(this.label5);            this.groupBox5.Controls.Add(this.label6);            this.groupBox5.Location = new System.Drawing.Point(218, 197);            this.groupBox5.Name = "groupBox5";            this.groupBox5.Size = new System.Drawing.Size(360, 100);            this.groupBox5.TabIndex = 4;            this.groupBox5.TabStop = false;            this.groupBox5.Text = "长度";            //             // btnLengthLineMeasure            //             this.btnLengthLineMeasure.Enabled = false;            this.btnLengthLineMeasure.Location = new System.Drawing.Point(263, 60);            this.btnLengthLineMeasure.Name = "btnLengthLineMeasure";            this.btnLengthLineMeasure.Size = new System.Drawing.Size(75, 25);            this.btnLengthLineMeasure.TabIndex = 6;            this.btnLengthLineMeasure.Text = "测量";            this.btnLengthLineMeasure.UseVisualStyleBackColor = true;            this.btnLengthLineMeasure.Click += new System.EventHandler(this.btnLengthLineMeasure_Click);            //             // cmbLengthLine            //             this.cmbLengthLine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;            this.cmbLengthLine.FormattingEnabled = true;            this.cmbLengthLine.Location = new System.Drawing.Point(62, 60);            this.cmbLengthLine.Name = "cmbLengthLine";            this.cmbLengthLine.Size = new System.Drawing.Size(190, 20);            this.cmbLengthLine.TabIndex = 5;            this.cmbLengthLine.SelectedIndexChanged += new System.EventHandler(this.cmbLengthLine_SelectedIndexChanged);            //             // pnlLengthLineColor            //             this.pnlLengthLineColor.BackColor = System.Drawing.Color.Red;            this.pnlLengthLineColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;            this.pnlLengthLineColor.Location = new System.Drawing.Point(62, 24);            this.pnlLengthLineColor.Name = "pnlLengthLineColor";            this.pnlLengthLineColor.Size = new System.Drawing.Size(91, 25);            this.pnlLengthLineColor.TabIndex = 4;            this.pnlLengthLineColor.BackColorChanged += new System.EventHandler(this.pnlLengthLineColor_BackColorChanged);            this.pnlLengthLineColor.Click += new System.EventHandler(this.pnlLengthLineColor_Click);            //             // nudLengthLineWidth            //             this.nudLengthLineWidth.Location = new System.Drawing.Point(263, 28);            this.nudLengthLineWidth.Maximum = new decimal(new int[] {            5,            0,            0,            0});            this.nudLengthLineWidth.Minimum = new decimal(new int[] {            1,            0,            0,            0});            this.nudLengthLineWidth.Name = "nudLengthLineWidth";            this.nudLengthLineWidth.Size = new System.Drawing.Size(78, 21);            this.nudLengthLineWidth.TabIndex = 3;            this.nudLengthLineWidth.Value = new decimal(new int[] {            1,            0,            0,            0});            this.nudLengthLineWidth.ValueChanged += new System.EventHandler(this.nudLengthLineWidth_ValueChanged);            this.nudLengthLineWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.nudLengthLineWidth_KeyUp);            //             // label4            //             this.label4.AutoSize = true;            this.label4.Location = new System.Drawing.Point(205, 30);            this.label4.Name = "label4";            this.label4.Size = new System.Drawing.Size(41, 12);            this.label4.TabIndex = 2;            this.label4.Text = "线宽:";            //             // label5            //             this.label5.AutoSize = true;            this.label5.Location = new System.Drawing.Point(16, 68);            this.label5.Name = "label5";            this.label5.Size = new System.Drawing.Size(41, 12);            this.label5.TabIndex = 1;            this.label5.Text = "样式:";            //             // label6            //             this.label6.AutoSize = true;            this.label6.Location = new System.Drawing.Point(16, 30);            this.label6.Name = "label6";            this.label6.Size = new System.Drawing.Size(41, 12);            this.label6.TabIndex = 0;            this.label6.Text = "颜色:";            //             // groupBox6            //             this.groupBox6.Controls.Add(this.btnParallelLineMeasure);            this.groupBox6.Controls.Add(this.cmbParallelLine);            this.groupBox6.Controls.Add(this.pnlParallelLineColor);            this.groupBox6.Controls.Add(this.nudParallelLineWidth);            this.groupBox6.Controls.Add(this.label7);            this.groupBox6.Controls.Add(this.label8);            this.groupBox6.Controls.Add(this.label9);            this.groupBox6.Location = new System.Drawing.Point(218, 303);            this.groupBox6.Name = "groupBox6";            this.groupBox6.Size = new System.Drawing.Size(360, 100);            this.groupBox6.TabIndex = 5;            this.groupBox6.TabStop = false;            this.groupBox6.Text = "平行线";            //             // btnParallelLineMeasure            //             this.btnParallelLineMeasure.Enabled = false;            this.btnParallelLineMeasure.Location = new System.Drawing.Point(263, 60);            this.btnParallelLineMeasure.Name = "btnParallelLineMeasure";            this.btnParallelLineMeasure.Size = new System.Drawing.Size(75, 25);            this.btnParallelLineMeasure.TabIndex = 6;            this.btnParallelLineMeasure.Text = "测量";            this.btnParallelLineMeasure.UseVisualStyleBackColor = true;            this.btnParallelLineMeasure.Click += new System.EventHandler(this.btnParallelLineMeasure_Click);            //             // cmbParallelLine            //             this.cmbParallelLine.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;            this.cmbParallelLine.FormattingEnabled = true;            this.cmbParallelLine.Location = new System.Drawing.Point(62, 60);            this.cmbParallelLine.Name = "cmbParallelLine";            this.cmbParallelLine.Size = new System.Drawing.Size(190, 20);            this.cmbParallelLine.TabIndex = 5;            this.cmbParallelLine.SelectedIndexChanged += new System.EventHandler(this.cmbParallelLine_SelectedIndexChanged);            //             // pnlParallelLineColor            //             this.pnlParallelLineColor.BackColor = System.Drawing.Color.Green;            this.pnlParallelLineColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;            this.pnlParallelLineColor.Location = new System.Drawing.Point(62, 24);            this.pnlParallelLineColor.Name = "pnlParallelLineColor";            this.pnlParallelLineColor.Size = new System.Drawing.Size(91, 25);            this.pnlParallelLineColor.TabIndex = 4;            this.pnlParallelLineColor.BackColorChanged += new System.EventHandler(this.pnlParallelLineColor_BackColorChanged);            this.pnlParallelLineColor.Click += new System.EventHandler(this.pnlParallelLineColor_Click);            //             // nudParallelLineWidth            //             this.nudParallelLineWidth.Location = new System.Drawing.Point(263, 24);            this.nudParallelLineWidth.Maximum = new decimal(new int[] {            5,            0,            0,            0});            this.nudParallelLineWidth.Minimum = new decimal(new int[] {            1,            0,            0,            0});            this.nudParallelLineWidth.Name = "nudParallelLineWidth";            this.nudParallelLineWidth.Size = new System.Drawing.Size(78, 21);            this.nudParallelLineWidth.TabIndex = 3;            this.nudParallelLineWidth.Value = new decimal(new int[] {            1,            0,            0,            0});            this.nudParallelLineWidth.ValueChanged += new System.EventHandler(this.nudParallelLineWidth_ValueChanged);            this.nudParallelLineWidth.KeyUp += new System.Windows.Forms.KeyEventHandler(this.nudParallelLineWidth_KeyUp);            //             // label7            //             this.label7.AutoSize = true;            this.label7.Location = new System.Drawing.Point(205, 30);            this.label7.Name = "label7";            this.label7.Size = new System.Drawing.Size(41, 12);            this.label7.TabIndex = 2;            this.label7.Text = "线宽:";            //             // label8            //             this.label8.AutoSize = true;            this.label8.Location = new System.Drawing.Point(16, 68);            this.label8.Name = "label8";            this.label8.Size = new System.Drawing.Size(41, 12);            this.label8.TabIndex = 1;            this.label8.Text = "样式:";            //             // label9            //             this.label9.AutoSize = true;            this.label9.Location = new System.Drawing.Point(16, 30);            this.label9.Name = "label9";            this.label9.Size = new System.Drawing.Size(41, 12);            this.label9.TabIndex = 0;            this.label9.Text = "颜色:";            //             // groupBox7            //             this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)));            this.groupBox7.Controls.Add(this.lblLevel);            this.groupBox7.Controls.Add(this.label12);            this.groupBox7.Controls.Add(this.lblAvg);            this.groupBox7.Controls.Add(this.label10);            this.groupBox7.Controls.Add(this.dgvLevelList);            this.groupBox7.Location = new System.Drawing.Point(218, 406);            this.groupBox7.Name = "groupBox7";            this.groupBox7.Size = new System.Drawing.Size(360, 182);            this.groupBox7.TabIndex = 6;            this.groupBox7.TabStop = false;            this.groupBox7.Text = "结果预览";            //             // lblLevel            //             this.lblLevel.AutoSize = true;            this.lblLevel.Location = new System.Drawing.Point(255, 25);            this.lblLevel.Name = "lblLevel";            this.lblLevel.Size = new System.Drawing.Size(11, 12);            this.lblLevel.TabIndex = 4;            this.lblLevel.Text = "0";            //             // label12            //             this.label12.AutoSize = true;            this.label12.Location = new System.Drawing.Point(170, 25);            this.label12.Name = "label12";            this.label12.Size = new System.Drawing.Size(65, 12);            this.label12.TabIndex = 3;            this.label12.Text = "对应级别:";            //             // lblAvg            //             this.lblAvg.AutoSize = true;            this.lblAvg.Location = new System.Drawing.Point(75, 25);            this.lblAvg.Name = "lblAvg";            this.lblAvg.Size = new System.Drawing.Size(11, 12);            this.lblAvg.TabIndex = 2;            this.lblAvg.Text = "0";            //             // label10            //             this.label10.AutoSize = true;            this.label10.Location = new System.Drawing.Point(6, 25);            this.label10.Name = "label10";            this.label10.Size = new System.Drawing.Size(53, 12);            this.label10.TabIndex = 1;            this.label10.Text = "平均值:";            //             // dgvLevelList            //             this.dgvLevelList.AllowUserToAddRows = false;            this.dgvLevelList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)));            this.dgvLevelList.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;            this.dgvLevelList.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;            this.dgvLevelList.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {            this.name,            this.minValue,            this.maxValue});            this.dgvLevelList.Location = new System.Drawing.Point(6, 51);            this.dgvLevelList.Name = "dgvLevelList";            this.dgvLevelList.ReadOnly = true;            this.dgvLevelList.RowHeadersVisible = false;            this.dgvLevelList.RowHeadersWidth = 51;            this.dgvLevelList.RowTemplate.Height = 27;            this.dgvLevelList.Size = new System.Drawing.Size(348, 125);            this.dgvLevelList.TabIndex = 0;            //             // name            //             this.name.MinimumWidth = 6;            this.name.Name = "name";            this.name.ReadOnly = true;            //             // minValue            //             this.minValue.MinimumWidth = 6;            this.minValue.Name = "minValue";            this.minValue.ReadOnly = true;            //             // maxValue            //             this.maxValue.MinimumWidth = 6;            this.maxValue.Name = "maxValue";            this.maxValue.ReadOnly = true;            //             // groupBox8            //             this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));            this.groupBox8.Controls.Add(this.lstResult);            this.groupBox8.Controls.Add(this.btnResultDel);            this.groupBox8.Controls.Add(this.btnAllShow);            this.groupBox8.Location = new System.Drawing.Point(12, 594);            this.groupBox8.Name = "groupBox8";            this.groupBox8.Size = new System.Drawing.Size(200, 220);            this.groupBox8.TabIndex = 7;            this.groupBox8.TabStop = false;            this.groupBox8.Text = "分析结果";            //             // lstResult            //             this.lstResult.HideSelection = false;            this.lstResult.Location = new System.Drawing.Point(17, 55);            this.lstResult.Name = "lstResult";            this.lstResult.Size = new System.Drawing.Size(166, 145);            this.lstResult.TabIndex = 11;            this.lstResult.UseCompatibleStateImageBehavior = false;            this.lstResult.View = System.Windows.Forms.View.Tile;            this.lstResult.SelectedIndexChanged += new System.EventHandler(this.lstResult_SelectedIndexChanged);            //             // btnResultDel            //             this.btnResultDel.Location = new System.Drawing.Point(108, 26);            this.btnResultDel.Name = "btnResultDel";            this.btnResultDel.Size = new System.Drawing.Size(75, 23);            this.btnResultDel.TabIndex = 10;            this.btnResultDel.Text = "删除";            this.btnResultDel.UseVisualStyleBackColor = true;            this.btnResultDel.Click += new System.EventHandler(this.btnResultDel_Click);            //             // btnAllShow            //             this.btnAllShow.Location = new System.Drawing.Point(19, 26);            this.btnAllShow.Name = "btnAllShow";            this.btnAllShow.Size = new System.Drawing.Size(75, 23);            this.btnAllShow.TabIndex = 9;            this.btnAllShow.Text = "全部显示";            this.btnAllShow.UseVisualStyleBackColor = true;            this.btnAllShow.Click += new System.EventHandler(this.btnAllShow_Click);            //             // 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.dgvResult);            this.groupBox9.Location = new System.Drawing.Point(218, 594);            this.groupBox9.Name = "groupBox9";            this.groupBox9.Size = new System.Drawing.Size(816, 220);            this.groupBox9.TabIndex = 8;            this.groupBox9.TabStop = false;            //             // dgvResult            //             this.dgvResult.AllowUserToAddRows = false;            this.dgvResult.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)             | System.Windows.Forms.AnchorStyles.Right)));            this.dgvResult.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;            this.dgvResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;            this.dgvResult.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {            this.Column1,            this.picName,            this.level,            this.avg});            this.dgvResult.Location = new System.Drawing.Point(8, 16);            this.dgvResult.Name = "dgvResult";            this.dgvResult.ReadOnly = true;            this.dgvResult.RowHeadersVisible = false;            this.dgvResult.RowHeadersWidth = 51;            this.dgvResult.RowTemplate.Height = 27;            this.dgvResult.Size = new System.Drawing.Size(801, 197);            this.dgvResult.TabIndex = 0;            //             // Column1            //             this.Column1.HeaderText = "tag";            this.Column1.MinimumWidth = 6;            this.Column1.Name = "Column1";            this.Column1.ReadOnly = true;            this.Column1.Visible = false;            //             // picName            //             this.picName.MinimumWidth = 6;            this.picName.Name = "picName";            this.picName.ReadOnly = true;            //             // level            //             this.level.MinimumWidth = 6;            this.level.Name = "level";            this.level.ReadOnly = true;            //             // avg            //             this.avg.MinimumWidth = 6;            this.avg.Name = "avg";            this.avg.ReadOnly = true;            //             // groupBox10            //             this.groupBox10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));            this.groupBox10.Controls.Add(this.btnExportProject);            this.groupBox10.Controls.Add(this.numericUpDown1);            this.groupBox10.Controls.Add(this.label11);            this.groupBox10.Controls.Add(this.btnExport);            this.groupBox10.Controls.Add(this.btnCreate);            this.groupBox10.Location = new System.Drawing.Point(1040, 594);            this.groupBox10.Name = "groupBox10";            this.groupBox10.Size = new System.Drawing.Size(182, 220);            this.groupBox10.TabIndex = 9;            this.groupBox10.TabStop = false;            //             // btnExportProject            //             this.btnExportProject.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));            this.btnExportProject.Location = new System.Drawing.Point(28, 100);            this.btnExportProject.Name = "btnExportProject";            this.btnExportProject.Size = new System.Drawing.Size(136, 32);            this.btnExportProject.TabIndex = 10;            this.btnExportProject.Text = "导出项目";            this.btnExportProject.UseVisualStyleBackColor = true;            this.btnExportProject.Click += new System.EventHandler(this.btnExportProject_Click);            //             // 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(81, 161);            this.numericUpDown1.Maximum = new decimal(new int[] {            10,            0,            0,            0});            this.numericUpDown1.Name = "numericUpDown1";            this.numericUpDown1.Size = new System.Drawing.Size(62, 21);            this.numericUpDown1.TabIndex = 8;            this.numericUpDown1.Value = new decimal(new int[] {            2,            0,            0,            0});            this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);            //             // label11            //             this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));            this.label11.AutoSize = true;            this.label11.Location = new System.Drawing.Point(38, 166);            this.label11.Name = "label11";            this.label11.Size = new System.Drawing.Size(41, 12);            this.label11.TabIndex = 7;            this.label11.Text = "小数:";            //             // btnExport            //             this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));            this.btnExport.Location = new System.Drawing.Point(28, 62);            this.btnExport.Name = "btnExport";            this.btnExport.Size = new System.Drawing.Size(137, 32);            this.btnExport.TabIndex = 1;            this.btnExport.Text = "导出结果";            this.btnExport.UseVisualStyleBackColor = true;            this.btnExport.Click += new System.EventHandler(this.btnExport_Click);            //             // btnCreate            //             this.btnCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));            this.btnCreate.Location = new System.Drawing.Point(28, 24);            this.btnCreate.Name = "btnCreate";            this.btnCreate.Size = new System.Drawing.Size(137, 32);            this.btnCreate.TabIndex = 0;            this.btnCreate.Text = "生成报告";            this.btnCreate.UseVisualStyleBackColor = true;            this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click);            //             // SpecialMeasureLengthDialog            //             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;            this.ClientSize = new System.Drawing.Size(1234, 823);            this.Controls.Add(this.groupBox10);            this.Controls.Add(this.groupBox9);            this.Controls.Add(this.groupBox8);            this.Controls.Add(this.groupBox7);            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.Name = "SpecialMeasureLengthDialog";            this.Text = "专项测量 - 长度";            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.SpecialMeasureLengthDialog_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.groupBox7, 0);            this.Controls.SetChildIndex(this.groupBox8, 0);            this.Controls.SetChildIndex(this.groupBox9, 0);            this.Controls.SetChildIndex(this.groupBox10, 0);            this.groupBox1.ResumeLayout(false);            this.groupBox1.PerformLayout();            this.groupBox2.ResumeLayout(false);            this.groupBox3.ResumeLayout(false);            this.groupBox3.PerformLayout();            ((System.ComponentModel.ISupportInitialize)(this.nudStraightLineWidth)).EndInit();            this.groupBox4.ResumeLayout(false);            this.groupBox5.ResumeLayout(false);            this.groupBox5.PerformLayout();            ((System.ComponentModel.ISupportInitialize)(this.nudLengthLineWidth)).EndInit();            this.groupBox6.ResumeLayout(false);            this.groupBox6.PerformLayout();            ((System.ComponentModel.ISupportInitialize)(this.nudParallelLineWidth)).EndInit();            this.groupBox7.ResumeLayout(false);            this.groupBox7.PerformLayout();            ((System.ComponentModel.ISupportInitialize)(this.dgvLevelList)).EndInit();            this.groupBox8.ResumeLayout(false);            this.groupBox9.ResumeLayout(false);            ((System.ComponentModel.ISupportInitialize)(this.dgvResult)).EndInit();            this.groupBox10.ResumeLayout(false);            this.groupBox10.PerformLayout();            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();            this.ResumeLayout(false);        }        #endregion        private System.Windows.Forms.GroupBox groupBox1;        private System.Windows.Forms.CheckBox chkOpenSetting;        private System.Windows.Forms.Button btnMeasure;        private System.Windows.Forms.ComboBox cmbSpecial;        private System.Windows.Forms.Button btnSave;        private System.Windows.Forms.Button btnSetting;        private System.Windows.Forms.GroupBox groupBox2;        private System.Windows.Forms.GroupBox groupBox3;        private System.Windows.Forms.GroupBox groupBox4;        private System.Windows.Forms.Button btnStraightLineMeasure;        private System.Windows.Forms.ComboBox cmbStraightLine;        private System.Windows.Forms.Panel pnlStraightLineColor;        private System.Windows.Forms.NumericUpDown nudStraightLineWidth;        private System.Windows.Forms.Label label3;        private System.Windows.Forms.Label label2;        private System.Windows.Forms.Label label1;        private System.Windows.Forms.GroupBox groupBox5;        private System.Windows.Forms.Button btnLengthLineMeasure;        private System.Windows.Forms.ComboBox cmbLengthLine;        private System.Windows.Forms.Panel pnlLengthLineColor;        private System.Windows.Forms.NumericUpDown nudLengthLineWidth;        private System.Windows.Forms.Label label4;        private System.Windows.Forms.Label label5;        private System.Windows.Forms.Label label6;        private System.Windows.Forms.GroupBox groupBox6;        private System.Windows.Forms.Button btnParallelLineMeasure;        private System.Windows.Forms.ComboBox cmbParallelLine;        private System.Windows.Forms.Panel pnlParallelLineColor;        private System.Windows.Forms.NumericUpDown nudParallelLineWidth;        private System.Windows.Forms.Label label7;        private System.Windows.Forms.Label label8;        private System.Windows.Forms.Label label9;        private System.Windows.Forms.GroupBox groupBox7;        private System.Windows.Forms.DataGridView dgvLevelList;        private System.Windows.Forms.DataGridViewTextBoxColumn name;        private System.Windows.Forms.DataGridViewTextBoxColumn minValue;        private System.Windows.Forms.DataGridViewTextBoxColumn maxValue;        private System.Windows.Forms.Label lblAvg;        private System.Windows.Forms.Label label10;        private System.Windows.Forms.Label lblLevel;        private System.Windows.Forms.Label label12;        private System.Windows.Forms.GroupBox groupBox8;        private System.Windows.Forms.GroupBox groupBox9;        private System.Windows.Forms.DataGridView dgvResult;        private System.Windows.Forms.GroupBox groupBox10;        private System.Windows.Forms.Button btnExport;        private System.Windows.Forms.Button btnCreate;        private System.Windows.Forms.Panel pnlShow;        private System.Windows.Forms.Button btnDelete;        private System.Windows.Forms.Panel pnlTools;        private System.Windows.Forms.ListView lstPic;        private System.Windows.Forms.ImageList imageList1;        private System.Windows.Forms.NumericUpDown numericUpDown1;        private System.Windows.Forms.Label label11;        private System.Windows.Forms.Button btnResultDel;        private System.Windows.Forms.Button btnAllShow;        private System.Windows.Forms.DataGridViewTextBoxColumn Column1;        private System.Windows.Forms.DataGridViewTextBoxColumn picName;        private System.Windows.Forms.DataGridViewTextBoxColumn level;        private System.Windows.Forms.DataGridViewTextBoxColumn avg;        private System.Windows.Forms.ListView lstResult;        private System.Windows.Forms.Button btnExportProject;        #endregion        /// <summary>        /// 网格调色板        /// </summary>        private ColorsForm colorsFormGrid;        private AppWorkspace appWorkspace;        private DocumentWorkspaceWindow m_documentWorkspace;        private SQLiteHelper m_sqlHelper;        private DataTable m_specialList;        private DataTable m_levelList;        private SpecialItem m_specialItem = SpecialItem.LENGTH;        private int m_specialSelectedIndex = 0;        private string m_specialId;        /// <summary>        /// 原图        /// </summary>        private OpenCvSharp.Mat imageMat;         /// <summary>        /// 原图带原相测量等        /// </summary>        private Bitmap m_originalBit;        private ArtworkControlButtons m_controlButtons;        private object m_currentColorPanel;        private bool m_isMeasure;        private bool m_isOpenSetting;        private bool m_isMeasureByStraightLine;        private bool m_isMeasureByLengthLine;        private bool m_isMeasureByParallelLine;        private MeasureStyleModel m_measureStyleModel;        private List<MeasureLengthResult> m_measureResults = new List<MeasureLengthResult>();        private MeasureLengthResult m_measureCurrent;        /// <summary>        /// 图片名称        /// </summary>        private string m_graphName;        private List<DrawObject> m_oldDrawList = new List<DrawObject>();        private bool m_showAll;        /// <summary>        /// 中间数据        /// </summary>        private List<ExportProjectModel> tempDataModel = new List<ExportProjectModel>();        // 小数位        private int decnum = 2;        /// <summary>        /// 保存用于生成报告的图片        /// </summary>        private List<Bitmap> bitList = new List<Bitmap>();        /// <summary>        /// 储存点击保存结果后的所有原图与分析图        /// </summary>        private Dictionary<string, List<Bitmap>> bitDic = new Dictionary<string, List<Bitmap>>();        // 统一全局设置的线颜色、线宽、样式        private int m_straightLineColor;        private int m_straightLineWidth;        private int m_straightLineStyle;        private int m_lengthLineColor;        private int m_lengthLineWidth;        private int m_lengthLineStyle;        private int m_parallelLineColor;        private int m_parallelLineWidth;        private int m_parallelLineStyle;        private int defaultIndex = -1;        private GeneralAnalysisModel generalAnalysisModel = new GeneralAnalysisModel();        public SpecialMeasureLengthDialog(AppWorkspace workspace)        {            appWorkspace = workspace;            m_measureStyleModel = appWorkspace.GetMeasureStyleModel();            m_sqlHelper = new SQLiteHelper();     //连接数据库                                            m_sqlHelper.Connect();            this.colorsFormGrid = new ColorsForm();            this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;            InitializeComponent();            InitializeLanguageText();            InitPicList();            InitSpecialCmb();            InitDocumentView();            InitDocumentViewTools();            InitLineStyles();            InitCurrentMeasure();            GetAttributeFromConfigurationFile();            SetAnalyzeModelFromXml("Template.Manager.item2.SpecialLength");        }        private void ShowImgEvent(object sender, EventArgs e)        {            lstPic.Focus();            if (this.defaultIndex != -1)            {                this.lstPic.Items[defaultIndex].Focused = true;                this.lstPic.Items[defaultIndex].Selected = true;                getLastData();            }        }        /// <summary>        /// 初始化专项数据        /// </summary>        public void InitSpecialCmb()        {            cmbSpecial.Items.Clear();            string select_sql = "select * from mic_special_definition where delete_flag = 0 and special_type = ? ";      //查询的SQL语句            SQLiteParameter[] para = new SQLiteParameter[1];            para[0] = new SQLiteParameter("special_type", m_specialItem);            m_specialList = m_sqlHelper.ExecuteDataTable(select_sql, para);   //执行查询操作,结果存放在dt中            this.cmbSpecial.Items.Clear();            if (m_specialList.Rows.Count > 0)            {                for (int i = 0; i < m_specialList.Rows.Count; ++i)                {                    this.cmbSpecial.Items.Add(m_specialList.Rows[i]["special_name"].ToString());                }                this.cmbSpecial.SelectedIndex = m_specialSelectedIndex;                m_specialId = m_specialList.Rows[m_specialSelectedIndex]["id"].ToString();            }        }        /// <summary>        /// 初始化当前测量数据        /// </summary>        public void InitCurrentMeasure()        {            m_measureCurrent = new MeasureLengthResult();            m_measureCurrent.GraphName = m_graphName;            m_measureCurrent.LevelName = "";            m_measureCurrent.MeasureAvg = 0;            lblLevel.Text = "";            lblAvg.Text = "0";        }        /// <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.lstPic.Items.Add("", i);                this.lstPic.Items[i].ImageIndex = i;                this.lstPic.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();                this.lstPic.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();                if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace))                {                    defaultIndex = i;                }            }            this.Shown += ShowImgEvent;        }        /// <summary>        /// 初始化DocumentView        /// </summary>        public void InitDocumentView()        {            this.pnlShow.Controls.Clear();            this.m_documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);            this.m_documentWorkspace.AppWorkspaceTop = appWorkspace;            this.m_documentWorkspace.Visible = true;            this.m_documentWorkspace.Dock = DockStyle.Fill;            this.m_documentWorkspace.Units = MeasurementUnit.Micron;            if (this.lstPic.FocusedItem != null)            {                this.m_documentWorkspace.xmlSaveModel = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].xmlSaveModel;                this.m_documentWorkspace.rules = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].rules;            }            this.pnlShow.Controls.Add(this.m_documentWorkspace);            this.m_documentWorkspace.ContinuousDrawingMeasure = true;        }        private void GraphicsList_SelectChanged(object sender, EventArgs e)        {            this.GetDataAndAvg();        }        #region 初始化DocumentView工具        public void InitDocumentViewTools()        {            this.m_controlButtons = new ArtworkControlButtons();            this.m_controlButtons.Dock = DockStyle.Top;            this.m_controlButtons.Height = 30;            this.m_controlButtons.HideZoomToWindowAndActualSize();            this.m_controlButtons.HideMovingDirection();            this.pnlTools.Controls.Add(m_controlButtons);            this.m_controlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);            this.m_controlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);            this.m_controlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);            this.m_controlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);        }        private void mobileModeButton_Click(object sender, EventArgs e)        {            this.m_documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;        }        private void pointerButton_Click(object sender, EventArgs e)        {            this.m_documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;        }        private void zoomOutButton_Click(object sender, EventArgs e)        {            if (this.m_documentWorkspace.CompositionSurface != null)                this.m_documentWorkspace.ZoomOut();        }        private void zoomInButton_Click(object sender, EventArgs e)        {            if (this.m_documentWorkspace.CompositionSurface != null)                this.m_documentWorkspace.ZoomIn();        }        #endregion        /// <summary>        /// 初始化线样式        /// </summary>        public void InitLineStyles()        {            m_straightLineColor = m_measureStyleModel.measureLine.lineColor;            m_straightLineWidth = m_measureStyleModel.measureLine.lineWidth;            m_straightLineStyle = m_measureStyleModel.measureLine.lineStyle;            m_lengthLineColor = m_measureStyleModel.measureLength.lineColor;            m_lengthLineWidth = m_measureStyleModel.measureLength.lineWidth;            m_lengthLineStyle = m_measureStyleModel.measureLength.lineStyle;            m_parallelLineColor = m_measureStyleModel.measureParallelLine.lineColor;            m_parallelLineWidth = m_measureStyleModel.measureParallelLine.lineWidth;            m_parallelLineStyle = m_measureStyleModel.measureParallelLine.lineStyle;            //绑定线样式数据            this.cmbStraightLine.Items.AddRange(InvariantData.dashStyles);            this.cmbStraightLine.SelectedIndex = 0;            this.cmbLengthLine.Items.AddRange(InvariantData.dashStyles);            this.cmbLengthLine.SelectedIndex = 0;            this.cmbParallelLine.Items.AddRange(InvariantData.dashStyles);            this.cmbParallelLine.SelectedIndex = 0;        }                private void btnSetting_Click(object sender, EventArgs e)        {            OpenSettingDialog();        }        private void OpenSettingDialog()        {            AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item2.SpecialLength");            if (recombinationRateSetDialog.hasModule)            {                recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;                recombinationRateSetDialog.ShowDialog();            }            else            {                recombinationRateSetDialog = null;            }        }        private void cmbSpecial_SelectedIndexChanged(object sender, EventArgs e)        {            //m_specialSelectedIndex = this.cmbSpecial.SelectedIndex;            this.InitSpecialLevelList();        }        /// <summary>        /// 初始化专项级别列表        /// </summary>        public void InitSpecialLevelList()        {            m_specialId = m_specialList.Rows[this.cmbSpecial.SelectedIndex]["id"].ToString();            dgvLevelList.AutoGenerateColumns = false;            dgvLevelList.AllowUserToAddRows = false;            dgvLevelList.ReadOnly = true;            this.dgvLevelList.Rows.Clear();            string select_sql = "select * from mic_special_definition_info where special_id = '" + m_specialId + "'";          //查询的SQL语句            m_levelList = m_sqlHelper.ExecuteDataTable(select_sql, null);   //执行查询操作,结果存放在dt中            if (m_levelList.Rows.Count > 0)            {                dgvLevelList.Rows.Add(m_levelList.Rows.Count);                for (int i = 0; i < m_levelList.Rows.Count; ++i)                {                    dgvLevelList.Rows[i].Cells["name"].Value = m_levelList.Rows[i]["name"].ToString();                    dgvLevelList.Rows[i].Cells["minValue"].Value = m_levelList.Rows[i]["minValue"];                    dgvLevelList.Rows[i].Cells["maxValue"].Value = m_levelList.Rows[i]["maxValue"];                }            }        }        /// <summary>        /// 图像索引切换        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void lstPic_SelectedIndexChanged(object sender, EventArgs e)        {            this.NewGraphicsListClear();            if (this.lstPic.FocusedItem != null && this.lstPic.FocusedItem.Selected)            {                                InitDocumentView();                m_graphName = this.lstPic.FocusedItem.Text;                InitCurrentMeasure();                this.imageMat = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();                Document document = Document.FromImageMat(imageMat.Clone()/* //待测试.Clone()*/);                this.m_documentWorkspace.Document = document;                this.m_documentWorkspace.Units = MeasurementUnit.Micron;                this.m_documentWorkspace.GraphicsList = new GraphicsList(this.m_documentWorkspace);                //this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GraphicsList.GetDrawClassList(DrawClass.Measure).ForEach(i => m_oldDrawList.Add(i));                //this.m_documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GraphicsList;                this.m_documentWorkspace.phaseModels = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].phaseModels;                this.m_documentWorkspace.GraphicsList.SelectChanged += GraphicsList_SelectChanged;                // 选择了图片                Bitmap m_bitmap = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();                m_originalBit = m_bitmap.Clone(new Rectangle(0, 0, m_bitmap.Width, m_bitmap.Height), m_bitmap.PixelFormat);                Graphics graphics = Graphics.FromImage(m_originalBit);                Draw(graphics);                ExistenceMeasure();                //this.selectPicture = true;            }        }        #region 线颜色选择        private void ShowColorsForm(object sender)        {            Panel panel = (Panel)sender;            this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(panel.BackColor);            this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));            this.colorsFormGrid.ShowDialog();        }        /// <summary>        /// 网格Panel的调色板颜色改变        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void gridColorChanged(object sender, EventArgs e)        {            Panel panel = (Panel)m_currentColorPanel;            Color color = this.colorsFormGrid.UserPrimaryColor.ToColor();            panel.BackColor = color;            this.colorsFormGrid.Close();        }        private void pnlStraightLineColor_Click(object sender, EventArgs e)        {            m_currentColorPanel = sender;            ShowColorsForm(sender);        }        private void pnlLengthLineColor_Click(object sender, EventArgs e)        {            m_currentColorPanel = sender;            ShowColorsForm(sender);        }        private void pnlParallelLineColor_Click(object sender, EventArgs e)        {            m_currentColorPanel = sender;            ShowColorsForm(sender);        }        #endregion        private void nudStraightLineWidth_KeyUp(object sender, KeyEventArgs e)        {            try            {                nudStraightLineWidth.Value = Convert.ToInt32(this.nudStraightLineWidth.Text);            }            catch (Exception)            { }        }        private void nudLengthLineWidth_KeyUp(object sender, KeyEventArgs e)        {            try            {                nudLengthLineWidth.Value = Convert.ToInt32(this.nudLengthLineWidth.Text);            }            catch (Exception)            { }        }        private void nudParallelLineWidth_KeyUp(object sender, KeyEventArgs e)        {            try            {                nudParallelLineWidth.Value = Convert.ToInt32(this.nudParallelLineWidth.Text);            }            catch (Exception)            { }        }        /// <summary>        /// 开启/结束测量        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void btnMeasure_Click(object sender, EventArgs e)        {            if (cmbSpecial.SelectedItem == null || m_levelList == null || m_levelList.Rows.Count <= 0)            {                MessageBox.Show(PdnResources.GetString("Menu.Pleasefirstsetthespecialdefinitionlength.Text"));                return;            }            m_isMeasure = !m_isMeasure;            UpdateMeasureUIAndState();        }        private void UpdateMeasureUIAndState()        {            if (m_isMeasure)            {                this.NewGraphicsListClear();                this.InitCurrentMeasure();                if (m_measureResults.Count > 0)                {                    if (m_specialSelectedIndex != this.cmbSpecial.SelectedIndex)                    {                        DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.learthelastmeasuremen.Text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);                        if (dr == DialogResult.OK)                        {                            this.lstResult.Items.Clear();                            this.m_measureResults.Clear();                            this.bitDic.Clear();                            this.dgvResult.Rows.Clear();                        }                        else                        {                            m_isMeasure = false;                            return;                        }                    }                }                btnMeasure.Text = PdnResources.GetString("Menu.Stopmeasure.text");                btnStraightLineMeasure.Enabled = true;                btnLengthLineMeasure.Enabled = true;                btnParallelLineMeasure.Enabled = true;                cmbSpecial.Enabled = false;            }            else            {                btnMeasure.Text = PdnResources.GetString("Menu.Pleasestartmeasuring.text");                cmbSpecial.Enabled = true;                btnStraightLineMeasure.Enabled = false;                btnLengthLineMeasure.Enabled = false;                btnParallelLineMeasure.Enabled = false;                if (m_isMeasureByStraightLine)                {                    btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");                    m_isMeasureByStraightLine = false;                }                if (m_isMeasureByLengthLine)                {                    btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");                    m_isMeasureByLengthLine = false;                }                if (m_isMeasureByParallelLine)                {                    btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");                    m_isMeasureByParallelLine = false;                }                this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;            }        }        private void chkOpenSetting_CheckedChanged(object sender, EventArgs e)        {            m_isOpenSetting = chkOpenSetting.Checked;        }        private void btnStraightLineMeasure_Click(object sender, EventArgs e)        {            if (imageMat == null)            {                MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagefirst.Text"));                return;            }            m_isMeasureByStraightLine = !m_isMeasureByStraightLine;            if (m_isMeasureByStraightLine)            {                btnStraightLineMeasure.Text = PdnResources.GetString("Menu.stop.text");                m_isMeasureByLengthLine = false;                btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");                m_isMeasureByParallelLine = false;                btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");                m_measureStyleModel.measureLine.lineColor = pnlStraightLineColor.BackColor.ToArgb();                m_measureStyleModel.measureLine.lineWidth = (int)nudStraightLineWidth.Value;                m_measureStyleModel.measureLine.lineStyle = cmbStraightLine.SelectedIndex;                this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLine;            }            else            {                btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");                this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;                this.GetDataAndAvg();            }            UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);        }        /// <summary>        /// 是否存在测量,有则选择工具        /// </summary>        /// <returns></returns>        public void ExistenceMeasure()        {            if (PdnResources.GetString("Menu.stop.text").Equals(btnStraightLineMeasure.Text))                this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLine;            if (PdnResources.GetString("Menu.stop.text").Equals(btnLengthLineMeasure.Text))                this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLength;            if (PdnResources.GetString("Menu.stop.text").Equals(btnParallelLineMeasure.Text))                this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureParallelLine;        }        private void btnLengthLineMeasure_Click(object sender, EventArgs e)        {            if (imageMat == null)            {                MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagefirst.Text"));                return;            }            m_isMeasureByLengthLine = !m_isMeasureByLengthLine;            if (m_isMeasureByLengthLine)            {                btnLengthLineMeasure.Text = PdnResources.GetString("Menu.stop.text");                m_isMeasureByStraightLine = false;                btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");                m_isMeasureByParallelLine = false;                btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");                m_measureStyleModel.measureLength.lineColor = pnlLengthLineColor.BackColor.ToArgb();                m_measureStyleModel.measureLength.lineWidth = (int)nudLengthLineWidth.Value;                m_measureStyleModel.measureLength.lineStyle = cmbLengthLine.SelectedIndex;                this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureLength;            }            else            {                btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");                this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;                this.GetDataAndAvg();            }            UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);        }        private void btnParallelLineMeasure_Click(object sender, EventArgs e)        {            if (imageMat == null)            {                MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheimagefirst.Text"));                return;            }            m_isMeasureByParallelLine = !m_isMeasureByParallelLine;            if (m_isMeasureByParallelLine)            {                btnParallelLineMeasure.Text = PdnResources.GetString("Menu.stop.text");                m_isMeasureByStraightLine = false;                btnStraightLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");                m_isMeasureByLengthLine = false;                btnLengthLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");                m_measureStyleModel.measureParallelLine.lineColor = pnlParallelLineColor.BackColor.ToArgb();                m_measureStyleModel.measureParallelLine.lineWidth = (int)nudParallelLineWidth.Value;                m_measureStyleModel.measureParallelLine.lineStyle = cmbParallelLine.SelectedIndex;                this.m_documentWorkspace.ActiveTool = DrawToolType.MeasureParallelLine;                            }            else            {                btnParallelLineMeasure.Text = PdnResources.GetString("Menu.measuring.text");                this.m_documentWorkspace.ActiveTool = DrawToolType.Pointer;                this.GetDataAndAvg();            }            UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);        }        private TreeView drawTreeView;        /// <summary>        /// 从配置文件中读取设置信息        /// </summary>        private void GetAttributeFromConfigurationFile()        {            MeasureListSetModel measureListSetModel = XmlSerializeHelper.DESerializer<MeasureListSetModel>(FileOperationHelper.ReadStringFromFile(System.Windows.Forms.Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MeasureListSetModel.xml", FileMode.Open));            drawTreeView = new TreeView();            if (measureListSetModel != null && measureListSetModel.AttributeMapDrawNodes != null)            {                for (int i = 0; i < measureListSetModel.AttributeMapDrawNodes.Count; i++)                {                    TreeNode firstNode = new TreeNode();                    firstNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Name;                    for (int j = 0; j < measureListSetModel.AttributeMapDrawNodes[i].Attribute.Count; j++)                    {                        TreeNode scondNode = new TreeNode();                        scondNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Text;                        scondNode.Name = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Name;                        for (int k = 0; k < measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute.Count; k++)                        {                            if (measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute.Count > 0)                            {                                TreeNode thirdNode = new TreeNode();                                thirdNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute[k].Text;                                thirdNode.Name = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute[k].Name;                                scondNode.Nodes.Add(thirdNode);                            }                        }                        firstNode.Nodes.Add(scondNode);                    }                    drawTreeView.Nodes.Add(firstNode);                }            }        }        /// <summary>        /// 获取计算测量结果        /// </summary>        private void GetDataAndAvg()        {                        string level = "";            double avg = 0;            double sum = 0;            int count = this.m_documentWorkspace.GraphicsList.Count;            int no = 0;            for (int i = 0; i < count; i++)            {                if (this.m_documentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)                {                    no++;                    Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.m_documentWorkspace.GraphicsList[i]).GetData();                    foreach (var keys in data)                    {                        /// <summary>                        /// 像素长度                        /// </summary>                        //PixelLength                        /// <summary>                        /// 物理长度                        /// </summary>                        //PhysicalLength                        object v;                        InvariantData.measureAttributes.TryGetValue((MeasureAttributes)keys.Key, out v);                        if (((MeasureAttributes)keys.Key).ToString() == "PhysicalLength")                        {                            double length = double.Parse(keys.Value.ToString());                            if (length > 0)                            {                                sum += length;                                this.ShowMeasureInfo(i);                                                           }                            else                            {                                no--;                            }                            break;                        }                    }                }            }            if(no > 0)            {                avg = sum / no;            }            if (m_levelList != null && m_levelList.Rows.Count > 0)            {                for (int i = 0; i < m_levelList.Rows.Count; ++i)                {                    double minValue = double.Parse(m_levelList.Rows[i]["minValue"].ToString());                    double maxValue = double.Parse(m_levelList.Rows[i]["maxValue"].ToString());                    if (avg >= minValue && avg < maxValue)                    {                        level = m_levelList.Rows[i]["name"].ToString();                        break;                    }                }            }            lblLevel.Text = level;            lblAvg.Text = AnalysisTools.GetDecNum(avg, decnum); ;            m_measureCurrent.LevelName = level;            m_measureCurrent.MeasureAvg = avg;        }        private void ShowMeasureInfo(int index)        {            int i = index;            int count1 = drawTreeView.Nodes.Count;            ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).drawingProperties.Clear();            ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Clear();            for (int k = 0; k < count1; k++)            {                int count2 = drawTreeView.Nodes[k].Nodes.Count;                for (int j = 0; j < count2; j++)                {                    if (this.m_documentWorkspace.GraphicsList[i].drawToolType == (DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name))                    {                        bool drawb = false;                        if (drawTreeView.Nodes[k].Nodes[j].Nodes.Count == 0)                        {                            ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).drawingProperties.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), new string[] { "nothing" });                            if (this.m_documentWorkspace.oldDrawTreeView != null)                            {                                if (this.m_documentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes.Count != 0)                                    ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);                            }                            else                            {                                ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);                            }                        }                        else                        {                            int a = 0;                            string[] arr = new string[drawTreeView.Nodes[k].Nodes[j].Nodes.Count];                            foreach (TreeNode node2 in drawTreeView.Nodes[k].Nodes[j].Nodes)                            {                                arr[a] = node2.Name;                                a++;                            }                            ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).drawingProperties.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), arr);                            if (this.m_documentWorkspace.oldDrawTreeView != null)                            {                                if (drawTreeView.Nodes[k].Nodes[j].Nodes.Count != this.m_documentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes.Count)                                {                                    ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);                                }                                else                                {                                    foreach (TreeNode oldNode in this.m_documentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes)                                    {                                        if (!arr.Contains(oldNode.Name))                                        {                                            drawb = true;                                        }                                    }                                    if (drawb)                                        ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), drawb);                                }                            }                            else                            {                                ((MeasureDrawObject)(this.m_documentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);                            }                        }                        this.Refresh();                    }                }            }        }        /// <summary>        /// 删除测量        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void btnDelete_Click(object sender, EventArgs e)        {            NewGraphicsListClear();            this.GetDataAndAvg();        }        private void SpecialMeasureLengthDialog_FormClosing(object sender, FormClosingEventArgs e)        {            m_measureStyleModel.measureLine.lineColor = m_straightLineColor;            m_measureStyleModel.measureLine.lineWidth = m_straightLineWidth;            m_measureStyleModel.measureLine.lineStyle = m_straightLineStyle;            m_measureStyleModel.measureLength.lineColor = m_lengthLineColor;            m_measureStyleModel.measureLength.lineWidth = m_lengthLineWidth;            m_measureStyleModel.measureLength.lineStyle = m_lengthLineStyle;            m_measureStyleModel.measureParallelLine.lineColor = m_parallelLineColor;            m_measureStyleModel.measureParallelLine.lineWidth = m_parallelLineWidth;            m_measureStyleModel.measureParallelLine.lineStyle = m_parallelLineStyle;            Startup.instance.measureStyleModel = m_measureStyleModel;            saveLastData();            m_sqlHelper.DisConnect();        }        private void numericUpDown1_ValueChanged(object sender, EventArgs e)        {            this.decnum = (int)numericUpDown1.Value;            this.UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);            this.RefreshDgvResult();            this.GetDataAndAvg();        }        /// <summary>        /// 更新小数位数        /// </summary>        /// <param name="decimalPlaces"></param>        public void UpdateMeasureDecimalPlaces(int praDecimalPlaces)        {            MeasureDrawObject.decimalPlaces = praDecimalPlaces;            this.m_documentWorkspace.Refresh();        }        /// <summary>        /// 全部显示        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void btnAllShow_Click(object sender, EventArgs e)        {            m_showAll = true;            this.RefreshDgvResult();        }        /// <summary>        /// 删除测量结果        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void btnResultDel_Click(object sender, EventArgs e)        {            if (this.lstResult.SelectedItems != null && this.lstResult.SelectedItems.Count > 0)            {                DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Determineallmeasurementsimage.Text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);                if (dr == DialogResult.OK)                {                    foreach (ListViewItem item in this.lstResult.Items)                    {                        if (item.Selected)                        {                            this.lstResult.Items.Remove(item);                            this.m_measureResults.RemoveAll(u => u.Tag == item.Name.ToString());                            if (bitDic.ContainsKey(item.Name.ToString()))                            {                                bitDic[item.Name.ToString()].Clear();                            }                        }                    }                    RefreshDgvResult();                }            }        }        private void RefreshDgvResult()        {            dgvResult.Rows.Clear();            if (m_showAll)            {                for (int i = 0; i < m_measureResults.Count; i++)                {                    MeasureLengthResult aResult = m_measureResults[i];                    dgvResult.Rows.Add(aResult.Tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));                }            }            else            {                if (this.lstResult.SelectedItems != null && this.lstResult.SelectedItems.Count > 0)                {                    for (int i = 0; i < this.lstResult.SelectedItems.Count; i++)                    {                        string tag = this.lstResult.SelectedItems[i].Name.ToString();                        List<MeasureLengthResult> findResults = m_measureResults.FindAll(item => item.Tag.Equals(tag));                        for (int j = 0; j < findResults.Count; j++)                        {                            MeasureLengthResult aResult = findResults[j];                            dgvResult.Rows.Add(aResult.Tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));                        }                    }                }            }        }        /// <summary>        /// 保存测量结果        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void btnSave_Click(object sender, EventArgs e)        {            if (!m_isMeasure)            {                MessageBox.Show(PdnResources.GetString("Menu.tyetmeasured.Text"));                return;            }            if (lstPic.SelectedItems.Count == 0)            {                MessageBox.Show(PdnResources.GetString("Menu.selectthepictureyoanttomeasure.Text"));                return;            }            // 重新计算一下            this.GetDataAndAvg();            if (lstPic.FocusedItem != null && this.lstPic.SelectedItems.Count > 0)            {                string imgName = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GetFriendlyName();                string tag = this.imageList1.Images.Keys[this.lstPic.SelectedItems[0].Index];                if (m_measureResults.FindAll(item => item.Tag.Equals(tag)).Count == 0)                {                    ListViewItem listViewItem = new ListViewItem();                    listViewItem.Name = tag;                    listViewItem.SubItems[0].Text = imgName;                    this.lstResult.Items.Add(listViewItem);                    this.lstResult.SelectedItems.Clear();                    this.lstResult.Items[this.lstResult.Items.Count - 1].Selected = true;                    MeasureLengthResult aResult = m_measureCurrent;                    aResult.Tag = tag;                    dgvResult.Rows.Add(tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));                    m_measureResults.Add(aResult);                }                else                {                    DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text") + "?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);                    if (dr == DialogResult.Cancel)                    {                        return;                    }                    m_measureCurrent.Tag = tag;                    m_measureResults.RemoveAll(u => u.Tag == tag);                    m_measureResults.Add(m_measureCurrent);                    dgvResult.Rows.Clear();                    for (int i = 0; i < m_measureResults.Count; i++)                    {                        MeasureLengthResult aResult = m_measureResults[i];                        dgvResult.Rows.Add(aResult.Tag, aResult.GraphName, aResult.LevelName, AnalysisTools.GetDecNum(aResult.MeasureAvg, decnum));                    }                }                //保存处理后的图片                double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数                List<Bitmap> tempBit = new List<Bitmap>();                //Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.lstPic.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();                m_originalBit.Tag = pantographRatio;                tempBit.Add(m_originalBit);                Bitmap newBit = m_originalBit.Clone(new Rectangle(0, 0, m_originalBit.Width, m_originalBit.Height), m_originalBit.PixelFormat);                Graphics graphics = Graphics.FromImage(newBit);                Draw(graphics);                newBit.Tag = pantographRatio;                tempBit.Add(newBit);                if (bitDic.ContainsKey(tag))                {                    bitDic[tag].Clear();                    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.Imagement.Measurementlist.ordernumber.text"));                columnName.Add(PdnResources.GetString("Menu.hectuallength.Text"));                dataList.Add(columnName);                int count = this.m_documentWorkspace.GraphicsList.Count;                int no = 0;                for (int i = 0; i < count; i++)                {                    if (this.m_documentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)                    {                        Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.m_documentWorkspace.GraphicsList[i]).GetData();                        foreach (var keys in data)                        {                            object v;                            InvariantData.measureAttributes.TryGetValue((MeasureAttributes)keys.Key, out v);                            if (((MeasureAttributes)keys.Key).ToString() == "PhysicalLength")                            {                                double length = double.Parse(keys.Value.ToString());                                if (length > 0)                                {                                    no++;                                    List<string> strList = new List<string>();                                    strList.Add(no.ToString());                                    strList.Add(length.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);                }                //if (m_measureCurrent.LevelName.Equals(""))                //{                //    MessageBox.Show(PdnResources.GetString("Menu.tnocorrespondinglevel.Text"));                //}                //else                //{                //    MessageBox.Show(PdnResources.GetString("Menu.Successfullysaved.text"));                //}            }        }        private void Draw(Graphics graphics)        {            if (this.m_documentWorkspace.GraphicsList.Count > 0)            {                this.m_documentWorkspace.GraphicsList.Draw(graphics);            }            if (this.m_documentWorkspace.phaseModels.Count > 0)            {                foreach (PhaseModel model in this.m_documentWorkspace.phaseModels)                {                    if (model.choise && model.mat != null)                    {                        Bitmap map = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(model.mat);                        graphics.DrawImage(map, 0, 0, map.Width, map.Height);                    }                }            }        }        private void NewGraphicsListClear()        {            if (this.m_documentWorkspace != null && this.m_documentWorkspace.GraphicsList.Count > 0)            {                this.m_documentWorkspace.GraphicsList.Clear();                this.m_documentWorkspace.Refresh();                //List<DrawObject> drawList = this.m_documentWorkspace.GraphicsList.GetDrawClassList(DrawClass.Measure);                //List<DrawObject> lstInfo = drawList.FindAll(delegate (DrawObject lst) { return !m_oldDrawList.Contains(lst); });                //lstInfo.ForEach(i => this.m_documentWorkspace.GraphicsList.RemoveObj(i));            }        }        private void lstResult_SelectedIndexChanged(object sender, EventArgs e)        {            this.m_showAll = false;            this.RefreshDgvResult();        }        /// <summary>        /// 生成报告        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void btnCreate_Click(object sender, EventArgs e)        {            if(this.dgvResult.Rows.Count <= 0)            {                MessageBox.Show(PdnResources.GetString("Menu.nodata.text"));                return;            }            if (chkOpenSetting.Checked)            {                OpenSettingDialog();            }            bitList.Clear();            if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify))            {                //获取word书签与excel单元格的关系,以字典方式存储                List<mic_module_infos> mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify);                Dictionary<string, string> tagInfos = new Dictionary<string, string>();                if (mic_module_infos != null && mic_module_infos.Count > 0)                {                    foreach (mic_module_infos info in mic_module_infos)                    {                        tagInfos.Add(info.tag_name, info.cell_position);                    }                }                List<List<string>> analysisContent = new List<List<string>>();                for (int i = 0; i < this.dgvResult.Rows.Count; i++)                {                    List<string> content1 = new List<string>();                    if (i == 0)                    {                        content1.Add(this.dgvResult.Columns[1].HeaderText);                        content1.Add(this.dgvResult.Columns[2].HeaderText);                        content1.Add(this.dgvResult.Columns[3].HeaderText);                        analysisContent.Add(content1);                    }                    content1 = new List<string>();                    content1.Add(this.dgvResult.Rows[i].Cells[1].Value.ToString());                    content1.Add(this.dgvResult.Rows[i].Cells[2].Value.ToString());                    content1.Add(this.dgvResult.Rows[i].Cells[3].Value.ToString());                    analysisContent.Add(content1);                    //图片                    string tag = this.dgvResult.Rows[i].Cells[0].Value.ToString();                    if (bitDic.ContainsKey(tag))                    {                        bitList.Add(bitDic[tag][0]);                        bitList.Add(bitDic[tag][1]);                    }                }                appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);            }            else            {                MessageBox.Show(PdnResources.GetString("Menu.Pleasesetiirst.Text")+"!");            }                        }        /// <summary>        /// 导出结果        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void btnExport_Click(object sender, EventArgs e)        {            if (this.dgvResult.Rows.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.Speciasurveyresultsoflengthsurvey.Text") + DateTime.Now.ToString("yyyyMMddhhmmss");                DialogResult dr = exe.ShowDialog();                if (dr == DialogResult.OK)                {                    DataTable dtb = new DataTable();                    for(int i = 1; i< this.dgvResult.Columns.Count; i++)                    {                        dtb.Columns.Add(this.dgvResult.Columns[i].HeaderText);                    }                    for (int r = 0; r < this.dgvResult.Rows.Count; r++)                    {                        DataRow dataRow = dtb.NewRow();                        for (int c = 1; c < this.dgvResult.Rows[r].Cells.Count; c++)                        {                            dataRow[this.dgvResult.Columns[c].HeaderText] = this.dgvResult.Rows[r].Cells[c].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.Noanalysisresults.text")+"!");            }        }        private void nudStraightLineWidth_ValueChanged(object sender, EventArgs e)        {            m_measureStyleModel.measureLine.lineWidth = (int)nudStraightLineWidth.Value;            m_documentWorkspace.Refresh();        }        private void cmbStraightLine_SelectedIndexChanged(object sender, EventArgs e)        {            m_measureStyleModel.measureLine.lineStyle = cmbStraightLine.SelectedIndex;            m_documentWorkspace.Refresh();        }        private void pnlStraightLineColor_BackColorChanged(object sender, EventArgs e)        {            m_measureStyleModel.measureLine.lineColor = pnlStraightLineColor.BackColor.ToArgb();            m_documentWorkspace.Refresh();        }        private void nudLengthLineWidth_ValueChanged(object sender, EventArgs e)        {            m_measureStyleModel.measureLength.lineWidth = (int)nudLengthLineWidth.Value;            m_documentWorkspace.Refresh();        }        private void cmbLengthLine_SelectedIndexChanged(object sender, EventArgs e)        {            m_measureStyleModel.measureLength.lineStyle = cmbLengthLine.SelectedIndex;            m_documentWorkspace.Refresh();        }        private void pnlLengthLineColor_BackColorChanged(object sender, EventArgs e)        {            m_measureStyleModel.measureLength.lineColor = pnlLengthLineColor.BackColor.ToArgb();            m_documentWorkspace.Refresh();        }        private void nudParallelLineWidth_ValueChanged(object sender, EventArgs e)        {            m_measureStyleModel.measureParallelLine.lineWidth = (int)nudParallelLineWidth.Value;            m_documentWorkspace.Refresh();        }        private void pnlParallelLineColor_BackColorChanged(object sender, EventArgs e)        {            m_measureStyleModel.measureParallelLine.lineColor = pnlParallelLineColor.BackColor.ToArgb();            m_documentWorkspace.Refresh();        }        private void cmbParallelLine_SelectedIndexChanged(object sender, EventArgs e)        {            m_measureStyleModel.measureParallelLine.lineStyle = cmbParallelLine.SelectedIndex;            m_documentWorkspace.Refresh();        }        /// <summary>        /// 导出项目        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void btnExportProject_Click(object sender, EventArgs e)        {            try            {                if (this.analyzeSettingModel == null)                {                    MessageBox.Show(PdnResources.GetString("Menu.Settheexporteitemfirst.Text"));                    return;                }                //获取项目工程内的文件夹路径                ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.GeneralAnalysis.SpecialMeasure.Text", this.analyzeSettingModel.savePath);                bitList.Clear();                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<ExportProjectModel> dataModel = new List<ExportProjectModel>();                        List<List<string>> analysisContent = new List<List<string>>();                        for (int i = 0; i < this.dgvResult.Rows.Count; i++)                        {                            List<string> content1 = new List<string>();                            if (i == 0)                            {                                content1.Add(this.dgvResult.Columns[1].HeaderText);                                content1.Add(this.dgvResult.Columns[2].HeaderText);                                content1.Add(this.dgvResult.Columns[3].HeaderText);                                analysisContent.Add(content1);                            }                            content1 = new List<string>();                            content1.Add(this.dgvResult.Rows[i].Cells[1].Value.ToString());                            content1.Add(this.dgvResult.Rows[i].Cells[2].Value.ToString());                            content1.Add(this.dgvResult.Rows[i].Cells[3].Value.ToString());                            analysisContent.Add(content1);                            //图片                            string tag = this.dgvResult.Rows[i].Cells[0].Value.ToString();                            if (bitDic.ContainsKey(tag))                            {                                bitList.Add(bitDic[tag][0]);                                bitList.Add(bitDic[tag][1]);                            }                            // 中间数据                            foreach(ExportProjectModel data in tempDataModel)                            {                                if (data.tagName.Equals(tag))                                {                                    dataModel.Add(data);                                }                            }                        }                        this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, dataModel, bitList, tagInfos, item.path, item.code);                    }                    else                    {                        MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");                        return;                    }                    //保存项目信息到数据库                    this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);                }            }            catch (Exception)            {            }        }        /// <summary>        /// 获取上次操作参数        /// </summary>        private void getLastData()        {            string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";            if (!System.IO.File.Exists(filePath))            {                generalAnalysisModel = new GeneralAnalysisModel();                generalAnalysisModel.PolyphaseMutiAreaContentModels = new GeneralAnalysisModel.PolyphaseMutiAreaContentModel();                generalAnalysisModel.PolyphaseCounterAnalysisModels = new GeneralAnalysisModel.PolyphaseCounterAnalysisModel();                generalAnalysisModel.TwoPhaseScaleModels = new GeneralAnalysisModel.TwoPhaseScaleModel();                generalAnalysisModel.PolyphaseContentModels = new GeneralAnalysisModel.PolyphaseContentModel();                generalAnalysisModel.PolyphaseDistanceModels = new GeneralAnalysisModel.PolyphaseDistanceModel();                generalAnalysisModel.DebrisSelectionModels = new GeneralAnalysisModel.DebrisSelectionModel();                generalAnalysisModel.CountNumberAnalysisModels = new GeneralAnalysisModel.CountNumberAnalysisModel();                generalAnalysisModel.PolyphaseMutiAreaContentModels.hasUsed = false;                generalAnalysisModel.PolyphaseCounterAnalysisModels.hasUsed = false;                generalAnalysisModel.TwoPhaseScaleModels.hasUsed = false;                generalAnalysisModel.PolyphaseContentModels.hasUsed = false;                generalAnalysisModel.PolyphaseDistanceModels.hasUsed = false;                generalAnalysisModel.DebrisSelectionModels.hasUsed = false;                generalAnalysisModel.CountNumberAnalysisModels.hasUsed = false;                string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);                Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");                FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);            }            else            {                generalAnalysisModel = XmlSerializeHelper.DESerializer<GeneralAnalysisModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));                if (generalAnalysisModel.SpecialMeasureLengthModels == null)                {                    generalAnalysisModel.SpecialMeasureLengthModels = new GeneralAnalysisModel.SpecialMeasureLengthModel();                }                if (generalAnalysisModel.SpecialMeasureLengthModels.hasUsed)                {                    if (cmbSpecial.Items.Count >= (generalAnalysisModel.SpecialMeasureLengthModels.parameter1 - 1))                    {                        cmbSpecial.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter1;                    }                    else                     {                         cmbSpecial.SelectedIndex = 0;                    }                    pnlStraightLineColor.BackColor = Color.FromArgb(generalAnalysisModel.SpecialMeasureLengthModels.parameter2);                    nudStraightLineWidth.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter3;                    cmbStraightLine.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter4;                    pnlLengthLineColor.BackColor = Color.FromArgb(generalAnalysisModel.SpecialMeasureLengthModels.parameter5);                    nudLengthLineWidth.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter6;                    cmbLengthLine.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter7;                    pnlParallelLineColor.BackColor = Color.FromArgb(generalAnalysisModel.SpecialMeasureLengthModels.parameter8);                    nudParallelLineWidth.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter9;                    cmbParallelLine.SelectedIndex = generalAnalysisModel.SpecialMeasureLengthModels.parameter10;                    chkOpenSetting.Checked = generalAnalysisModel.SpecialMeasureLengthModels.parameter11;                    numericUpDown1.Value = generalAnalysisModel.SpecialMeasureLengthModels.parameter12;                }            }        }        /// <summary>        /// 保存上次操作参数        /// </summary>        private void saveLastData()        {            if (generalAnalysisModel.SpecialMeasureLengthModels == null)            {                generalAnalysisModel.SpecialMeasureLengthModels = new GeneralAnalysisModel.SpecialMeasureLengthModel();            }            generalAnalysisModel.SpecialMeasureLengthModels.hasUsed = true;            generalAnalysisModel.SpecialMeasureLengthModels.parameter1 = cmbSpecial.SelectedIndex;            generalAnalysisModel.SpecialMeasureLengthModels.parameter2 = pnlStraightLineColor.BackColor.ToArgb();            generalAnalysisModel.SpecialMeasureLengthModels.parameter3 = (int)nudStraightLineWidth.Value;            generalAnalysisModel.SpecialMeasureLengthModels.parameter4 = cmbStraightLine.SelectedIndex;            generalAnalysisModel.SpecialMeasureLengthModels.parameter5 = pnlLengthLineColor.BackColor.ToArgb();            generalAnalysisModel.SpecialMeasureLengthModels.parameter6 = (int)nudLengthLineWidth.Value;            generalAnalysisModel.SpecialMeasureLengthModels.parameter7 = cmbLengthLine.SelectedIndex;            generalAnalysisModel.SpecialMeasureLengthModels.parameter8 = pnlParallelLineColor.BackColor.ToArgb();            generalAnalysisModel.SpecialMeasureLengthModels.parameter9 = (int)nudParallelLineWidth.Value;            generalAnalysisModel.SpecialMeasureLengthModels.parameter10 = cmbParallelLine.SelectedIndex;            generalAnalysisModel.SpecialMeasureLengthModels.parameter11 = chkOpenSetting.Checked;            generalAnalysisModel.SpecialMeasureLengthModels.parameter12 = (int)numericUpDown1.Value;            string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";            string porosityInfoXml = XmlSerializeHelper.XmlSerialize<GeneralAnalysisModel>(generalAnalysisModel);            FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create);        }    }}
 |