| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251 | using PaintDotNet.Base.Functionodel;using PaintDotNet.Base.CommTool;using PaintDotNet.CustomControl;using PaintDotNet.DbOpreate.DbBll;using PaintDotNet.DbOpreate.DbModel;using PaintDotNet.Base.SettingModel;using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.IO;using System.Linq;using System.Text;using System.Threading;using System.Threading.Tasks;using System.Windows.Forms;using static PaintDotNet.Base.Functionodel.AnalyzeSettingModel;using APIDialogs = Microsoft.WindowsAPICodePack.Dialogs;using System.Drawing.Imaging;using System.Runtime.Serialization.Formatters.Binary;using OpenCvSharp.Extensions;namespace PaintDotNet{    /// <summary>    /// 通用分析模板设置页    /// </summary>    internal class MeasureListSettingDialog : PdnBaseForm    {        #region 控件        private GroupBox groupBox1;        private Button button2;        private Button button1;        private GroupBox groupBox2;        private ComboBox comboBox1;        private Label label3;        private Label label2;        private Label label1;        private GroupBox groupBox3;        private GroupBox groupBox4;        private GroupBox groupBox5;        private Button button3;        private TextBox textBox1;        private Label label6;        private Label label5;        private Label label4;        private TextBox textBox2;        private Label label8;        private Label label7;        private Label label12;        private TextBox textBox6;        private Label label11;        private TextBox textBox5;        private Label label10;        private TextBox textBox4;        private Label label9;        private DataGridView dataGridView1;        private TextBox textBox9;        private Label label14;        private TextBox textBox8;        private Label label13;        private Button button4;        private DateTimePicker dateTimePicker1;        private DateTimePicker dateTimePicker2;        private GroupBox groupBox6;        private Button button5;        #endregion        /// <summary>        /// 数据库对应字段        /// </summary>        private string languageName;        /// <summary>        /// 数据库对应list        /// </summary>        private List<mic_template_infos> infosList;        /// <summary>        /// 功能路径名称,因需递归作为全局对象        /// </summary>        private string functionPathMsg;        /// <summary>        /// 分类名称,主要供书签使用        /// </summary>        private string analyzeClassify;        /// <summary>        /// 调用当前窗口的对象        /// </summary>        private PdnBaseForm pdnBaseForm;        /// <summary>        /// 在打开窗体时辅助判断是否存在报告模板文件        /// </summary>        public bool hasModule = false;        /// <summary>        /// xml对应文件路径        /// </summary>        private string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\" + "AnalyzeSavedModel.xml";        /// <summary>        /// xml对象        /// </summary>        private AnalyzeSavedModel analyzeSavedModel;        /// <summary>        /// 当前分析分类的数据        /// </summary>        private AnalyzeSavedModel.ModelItem analyzeModel;        /// <summary>        /// 主控件        /// </summary>        private AppWorkspace appWorkspace;        /// <summary>        /// 导出数据        /// </summary>        private DataTable dataTable;        public MeasureListSettingDialog(PdnBaseForm form, string languageName, AppWorkspace appWorkspace, DataTable dataTable)        {            this.languageName = languageName;            this.pdnBaseForm = form;            this.appWorkspace = appWorkspace;            this.dataTable = dataTable;            infosList = mic_template_infos_BLL.FindAll();//查询出所有模板分类对象            InitializeComponent();            InitializeLanguageText();            InitGridHeader();            InitOtherInfo();            InitLastTimeInfo();            if (this.languageName.Equals("Template.Manager.item1.MeasureListAll"))            {                this.groupBox4.Visible = false;                this.groupBox5.Visible = false;                this.groupBox6.Visible = false;                this.button5.Visible = false;                this.Height = 279;            }            else            {                this.groupBox4.Visible = true;                this.groupBox5.Visible = true;                this.groupBox6.Visible = true;                this.button5.Visible = true;                this.Height = 670;            }            if (this.languageName == "Template.Manager.item2.AtlasComparison")                this.button5.Enabled = false;        }        #region 初始化        private void InitializeLanguageText()        {            this.button5.Text = PdnResources.GetString("Menu.Configurehebookmark.Text");            this.label3.Text = PdnResources.GetString("Menu.Pleaseselectthetemplateyoucanuse.Text") + ":";            this.label2.Text = PdnResources.GetString("Menu.nothing.Text");            this.label1.Text = PdnResources.GetString("Menu.Thefunctionpath.Text") + ":";            this.groupBox3.Text = PdnResources.GetString("Menu.Itemstoragepathselection.Text");            this.label6.Text = PdnResources.GetString("Menu.nothing.Text");            this.label5.Text = PdnResources.GetString("Menu.Thespecificpath.Text") + ":";            this.label4.Text = PdnResources.GetString("Menu.Storagepath.Text") + ":";            this.groupBox4.Text = PdnResources.GetString("Menu.thebasicinformationofproject.text");            this.label8.Text = PdnResources.GetString("Menu.projectnumber.text") + ":";            this.label7.Text = PdnResources.GetString("Menu.Ratingdate.text") + ":";            this.groupBox5.Text = PdnResources.GetString("Menu.Ratingdate.text");            this.label12.Text = PdnResources.GetString("Menu.Inspectiondate.text") + ":";            this.label11.Text = PdnResources.GetString("Menu.Contactperson.text") + ":";            this.label10.Text = PdnResources.GetString("Menu.inspectiondepartment.text") + ":";            this.label9.Text = PdnResources.GetString("Menu.Sender.text") + ":";            this.groupBox6.Text = PdnResources.GetString("Menu.other.text");            this.label14.Text = PdnResources.GetString("Menu.name.text") + ":";            this.label13.Text = PdnResources.GetString("Menu.content.text") + ":";            this.button4.Text = PdnResources.GetString("Menu.Addto.text");            this.Text = PdnResources.GetString("Menu.Analysisofsetting.Text");            this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");            if (this.languageName.Equals("Template.Manager.item1.MeasureListAll"))                this.button2.Text = PdnResources.GetString("Menu.Exportresults.text");            else                this.button2.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");            this.button1.Text = PdnResources.GetString("Menu.File.Close.Text");            this.groupBox2.Text = PdnResources.GetString("Menu.Reporttemplateselection.Text");        }        private void InitializeComponent()        {            this.groupBox1 = new System.Windows.Forms.GroupBox();            this.button2 = new System.Windows.Forms.Button();            this.button1 = new System.Windows.Forms.Button();            this.groupBox2 = new System.Windows.Forms.GroupBox();            this.button5 = new System.Windows.Forms.Button();            this.comboBox1 = new System.Windows.Forms.ComboBox();            this.label3 = new System.Windows.Forms.Label();            this.label2 = new System.Windows.Forms.Label();            this.label1 = new System.Windows.Forms.Label();            this.groupBox3 = new System.Windows.Forms.GroupBox();            this.button3 = new System.Windows.Forms.Button();            this.textBox1 = new System.Windows.Forms.TextBox();            this.label6 = new System.Windows.Forms.Label();            this.label5 = new System.Windows.Forms.Label();            this.label4 = new System.Windows.Forms.Label();            this.groupBox4 = new System.Windows.Forms.GroupBox();            this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();            this.textBox2 = new System.Windows.Forms.TextBox();            this.label8 = new System.Windows.Forms.Label();            this.label7 = new System.Windows.Forms.Label();            this.groupBox5 = new System.Windows.Forms.GroupBox();            this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker();            this.label12 = new System.Windows.Forms.Label();            this.textBox6 = new System.Windows.Forms.TextBox();            this.label11 = new System.Windows.Forms.Label();            this.textBox5 = new System.Windows.Forms.TextBox();            this.label10 = new System.Windows.Forms.Label();            this.textBox4 = new System.Windows.Forms.TextBox();            this.label9 = new System.Windows.Forms.Label();            this.groupBox6 = new System.Windows.Forms.GroupBox();            this.dataGridView1 = new System.Windows.Forms.DataGridView();            this.textBox9 = new System.Windows.Forms.TextBox();            this.label14 = new System.Windows.Forms.Label();            this.textBox8 = new System.Windows.Forms.TextBox();            this.label13 = new System.Windows.Forms.Label();            this.button4 = new System.Windows.Forms.Button();            this.groupBox1.SuspendLayout();            this.groupBox2.SuspendLayout();            this.groupBox3.SuspendLayout();            this.groupBox4.SuspendLayout();            this.groupBox5.SuspendLayout();            this.groupBox6.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();            this.SuspendLayout();            //             // groupBox1            //             this.groupBox1.Controls.Add(this.button2);            this.groupBox1.Controls.Add(this.button1);            this.groupBox1.Location = new System.Drawing.Point(12, 4);            this.groupBox1.Name = "groupBox1";            this.groupBox1.Size = new System.Drawing.Size(542, 49);            this.groupBox1.TabIndex = 0;            this.groupBox1.TabStop = false;            this.groupBox1.Text = "操作";            //             // button2            //             this.button2.BackColor = System.Drawing.SystemColors.Control;            this.button2.Location = new System.Drawing.Point(416, 12);            this.button2.Name = "button2";            this.button2.Size = new System.Drawing.Size(111, 30);            this.button2.TabIndex = 1;            this.button2.Text = "生成报告";            this.button2.UseVisualStyleBackColor = false;            this.button2.Click += new System.EventHandler(this.button2_Click);            //             // button1            //             this.button1.BackColor = System.Drawing.SystemColors.Control;            this.button1.Location = new System.Drawing.Point(334, 12);            this.button1.Name = "button1";            this.button1.Size = new System.Drawing.Size(76, 30);            this.button1.TabIndex = 0;            this.button1.Text = "关闭";            this.button1.UseVisualStyleBackColor = false;            this.button1.Click += new System.EventHandler(this.button1_Click);            //             // groupBox2            //             this.groupBox2.Controls.Add(this.button5);            this.groupBox2.Controls.Add(this.comboBox1);            this.groupBox2.Controls.Add(this.label3);            this.groupBox2.Controls.Add(this.label2);            this.groupBox2.Controls.Add(this.label1);            this.groupBox2.Location = new System.Drawing.Point(12, 56);            this.groupBox2.Name = "groupBox2";            this.groupBox2.Size = new System.Drawing.Size(542, 90);            this.groupBox2.TabIndex = 1;            this.groupBox2.TabStop = false;            this.groupBox2.Text = "报告模板选择";            //             // button5            //             this.button5.Location = new System.Drawing.Point(467, 57);            this.button5.Name = "button5";            this.button5.Size = new System.Drawing.Size(65, 20);            this.button5.TabIndex = 4;            this.button5.Text = "配置书签";            this.button5.UseVisualStyleBackColor = true;            this.button5.Click += new System.EventHandler(this.button5_Click);            //             // comboBox1            //             this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;            this.comboBox1.FormattingEnabled = true;            this.comboBox1.Location = new System.Drawing.Point(163, 56);            this.comboBox1.Name = "comboBox1";            this.comboBox1.Size = new System.Drawing.Size(298, 20);            this.comboBox1.TabIndex = 3;            //             // label3            //             this.label3.AutoSize = true;            this.label3.ForeColor = System.Drawing.SystemColors.ControlText;            this.label3.Location = new System.Drawing.Point(17, 61);            this.label3.Name = "label3";            this.label3.Size = new System.Drawing.Size(125, 12);            this.label3.TabIndex = 2;            this.label3.Text = "请选择可使用的模板:";            //             // label2            //             this.label2.AutoSize = true;            this.label2.ForeColor = System.Drawing.SystemColors.ControlText;            this.label2.Location = new System.Drawing.Point(163, 26);            this.label2.Name = "label2";            this.label2.Size = new System.Drawing.Size(107, 12);            this.label2.TabIndex = 1;            this.label2.Text = "通用分析-多相含量";            //             // label1            //             this.label1.AutoSize = true;            this.label1.ForeColor = System.Drawing.SystemColors.ControlText;            this.label1.Location = new System.Drawing.Point(17, 26);            this.label1.Name = "label1";            this.label1.Size = new System.Drawing.Size(65, 12);            this.label1.TabIndex = 0;            this.label1.Text = "功能路径:";            //             // groupBox3            //             this.groupBox3.Controls.Add(this.button3);            this.groupBox3.Controls.Add(this.textBox1);            this.groupBox3.Controls.Add(this.label6);            this.groupBox3.Controls.Add(this.label5);            this.groupBox3.Controls.Add(this.label4);            this.groupBox3.Location = new System.Drawing.Point(12, 162);            this.groupBox3.Name = "groupBox3";            this.groupBox3.Size = new System.Drawing.Size(542, 77);            this.groupBox3.TabIndex = 1;            this.groupBox3.TabStop = false;            this.groupBox3.Text = "项目储存路径选择";            //             // button3            //             this.button3.BackColor = System.Drawing.SystemColors.Window;            this.button3.Font = new System.Drawing.Font("宋体", 6F);            this.button3.Location = new System.Drawing.Point(498, 45);            this.button3.Name = "button3";            this.button3.Size = new System.Drawing.Size(29, 21);            this.button3.TabIndex = 5;            this.button3.Text = "...";            this.button3.UseVisualStyleBackColor = false;            this.button3.Click += new System.EventHandler(this.button3_Click);            //             // textBox1            //             this.textBox1.Location = new System.Drawing.Point(103, 45);            this.textBox1.Name = "textBox1";            this.textBox1.ReadOnly = true;            this.textBox1.Size = new System.Drawing.Size(400, 21);            this.textBox1.TabIndex = 4;            //             // label6            //             this.label6.AutoSize = true;            this.label6.ForeColor = System.Drawing.SystemColors.ControlText;            this.label6.Location = new System.Drawing.Point(101, 25);            this.label6.Name = "label6";            this.label6.Size = new System.Drawing.Size(0, 12);            this.label6.TabIndex = 3;            //             // label5            //             this.label5.AutoSize = true;            this.label5.ForeColor = System.Drawing.SystemColors.ControlText;            this.label5.Location = new System.Drawing.Point(18, 51);            this.label5.Name = "label5";            this.label5.Size = new System.Drawing.Size(65, 12);            this.label5.TabIndex = 2;            this.label5.Text = "具体路径:";            //             // label4            //             this.label4.AutoSize = true;            this.label4.ForeColor = System.Drawing.SystemColors.ControlText;            this.label4.Location = new System.Drawing.Point(18, 25);            this.label4.Name = "label4";            this.label4.Size = new System.Drawing.Size(65, 12);            this.label4.TabIndex = 1;            this.label4.Text = "储存路径:";            //             // groupBox4            //             this.groupBox4.Controls.Add(this.dateTimePicker1);            this.groupBox4.Controls.Add(this.textBox2);            this.groupBox4.Controls.Add(this.label8);            this.groupBox4.Controls.Add(this.label7);            this.groupBox4.Location = new System.Drawing.Point(12, 240);            this.groupBox4.Name = "groupBox4";            this.groupBox4.Size = new System.Drawing.Size(542, 60);            this.groupBox4.TabIndex = 1;            this.groupBox4.TabStop = false;            this.groupBox4.Text = "项目基本信息";            //             // dateTimePicker1            //             this.dateTimePicker1.Location = new System.Drawing.Point(346, 24);            this.dateTimePicker1.Name = "dateTimePicker1";            this.dateTimePicker1.Size = new System.Drawing.Size(165, 21);            this.dateTimePicker1.TabIndex = 6;            //             // textBox2            //             this.textBox2.Location = new System.Drawing.Point(92, 24);            this.textBox2.Name = "textBox2";            this.textBox2.Size = new System.Drawing.Size(165, 21);            this.textBox2.TabIndex = 5;            //             // label8            //             this.label8.AutoSize = true;            this.label8.ForeColor = System.Drawing.SystemColors.ControlText;            this.label8.Location = new System.Drawing.Point(18, 28);            this.label8.Name = "label8";            this.label8.Size = new System.Drawing.Size(65, 12);            this.label8.TabIndex = 4;            this.label8.Text = "项目编号:";            //             // label7            //             this.label7.AutoSize = true;            this.label7.ForeColor = System.Drawing.SystemColors.ControlText;            this.label7.Location = new System.Drawing.Point(283, 28);            this.label7.Name = "label7";            this.label7.Size = new System.Drawing.Size(65, 12);            this.label7.TabIndex = 3;            this.label7.Text = "评级日期:";            //             // groupBox5            //             this.groupBox5.Controls.Add(this.dateTimePicker2);            this.groupBox5.Controls.Add(this.label12);            this.groupBox5.Controls.Add(this.textBox6);            this.groupBox5.Controls.Add(this.label11);            this.groupBox5.Controls.Add(this.textBox5);            this.groupBox5.Controls.Add(this.label10);            this.groupBox5.Controls.Add(this.textBox4);            this.groupBox5.Controls.Add(this.label9);            this.groupBox5.Location = new System.Drawing.Point(12, 301);            this.groupBox5.Name = "groupBox5";            this.groupBox5.Size = new System.Drawing.Size(542, 90);            this.groupBox5.TabIndex = 1;            this.groupBox5.TabStop = false;            this.groupBox5.Text = "评级日期";            //             // dateTimePicker2            //             this.dateTimePicker2.Location = new System.Drawing.Point(346, 58);            this.dateTimePicker2.Name = "dateTimePicker2";            this.dateTimePicker2.Size = new System.Drawing.Size(165, 21);            this.dateTimePicker2.TabIndex = 14;            //             // label12            //             this.label12.AutoSize = true;            this.label12.ForeColor = System.Drawing.SystemColors.ControlText;            this.label12.Location = new System.Drawing.Point(283, 62);            this.label12.Name = "label12";            this.label12.Size = new System.Drawing.Size(53, 12);            this.label12.TabIndex = 13;            this.label12.Text = "送检日期";            //             // textBox6            //             this.textBox6.Location = new System.Drawing.Point(346, 23);            this.textBox6.Name = "textBox6";            this.textBox6.Size = new System.Drawing.Size(165, 21);            this.textBox6.TabIndex = 12;            //             // label11            //             this.label11.AutoSize = true;            this.label11.ForeColor = System.Drawing.SystemColors.ControlText;            this.label11.Location = new System.Drawing.Point(283, 28);            this.label11.Name = "label11";            this.label11.Size = new System.Drawing.Size(53, 12);            this.label11.TabIndex = 11;            this.label11.Text = "联系人:";            //             // textBox5            //             this.textBox5.Location = new System.Drawing.Point(92, 58);            this.textBox5.Name = "textBox5";            this.textBox5.Size = new System.Drawing.Size(165, 21);            this.textBox5.TabIndex = 10;            //             // label10            //             this.label10.AutoSize = true;            this.label10.ForeColor = System.Drawing.SystemColors.ControlText;            this.label10.Location = new System.Drawing.Point(18, 62);            this.label10.Name = "label10";            this.label10.Size = new System.Drawing.Size(65, 12);            this.label10.TabIndex = 9;            this.label10.Text = "送检单位:";            //             // textBox4            //             this.textBox4.Location = new System.Drawing.Point(92, 23);            this.textBox4.Name = "textBox4";            this.textBox4.Size = new System.Drawing.Size(165, 21);            this.textBox4.TabIndex = 8;            //             // label9            //             this.label9.AutoSize = true;            this.label9.ForeColor = System.Drawing.SystemColors.ControlText;            this.label9.Location = new System.Drawing.Point(18, 28);            this.label9.Name = "label9";            this.label9.Size = new System.Drawing.Size(53, 12);            this.label9.TabIndex = 7;            this.label9.Text = "送检人:";            //             // groupBox6            //             this.groupBox6.Controls.Add(this.dataGridView1);            this.groupBox6.Controls.Add(this.textBox9);            this.groupBox6.Controls.Add(this.label14);            this.groupBox6.Controls.Add(this.textBox8);            this.groupBox6.Controls.Add(this.label13);            this.groupBox6.Controls.Add(this.button4);            this.groupBox6.Location = new System.Drawing.Point(12, 393);            this.groupBox6.Name = "groupBox6";            this.groupBox6.Size = new System.Drawing.Size(542, 226);            this.groupBox6.TabIndex = 1;            this.groupBox6.TabStop = false;            this.groupBox6.Text = "其他";            //             // dataGridView1            //             this.dataGridView1.AllowUserToAddRows = false;            this.dataGridView1.AllowUserToDeleteRows = false;            this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)             | System.Windows.Forms.AnchorStyles.Right)));            this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;            this.dataGridView1.BackgroundColor = System.Drawing.Color.White;            this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None;            this.dataGridView1.Location = new System.Drawing.Point(16, 68);            this.dataGridView1.MultiSelect = false;            this.dataGridView1.Name = "dataGridView1";            this.dataGridView1.RowHeadersVisible = false;            this.dataGridView1.RowTemplate.Height = 23;            this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;            this.dataGridView1.Size = new System.Drawing.Size(511, 148);            this.dataGridView1.TabIndex = 19;            this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);            //             // textBox9            //             this.textBox9.Location = new System.Drawing.Point(55, 30);            this.textBox9.Name = "textBox9";            this.textBox9.Size = new System.Drawing.Size(165, 21);            this.textBox9.TabIndex = 18;            //             // label14            //             this.label14.AutoSize = true;            this.label14.ForeColor = System.Drawing.SystemColors.ControlText;            this.label14.Location = new System.Drawing.Point(14, 34);            this.label14.Name = "label14";            this.label14.Size = new System.Drawing.Size(41, 12);            this.label14.TabIndex = 17;            this.label14.Text = "名称:";            //             // textBox8            //             this.textBox8.Location = new System.Drawing.Point(268, 30);            this.textBox8.Name = "textBox8";            this.textBox8.Size = new System.Drawing.Size(165, 21);            this.textBox8.TabIndex = 16;            //             // label13            //             this.label13.AutoSize = true;            this.label13.ForeColor = System.Drawing.SystemColors.ControlText;            this.label13.Location = new System.Drawing.Point(228, 34);            this.label13.Name = "label13";            this.label13.Size = new System.Drawing.Size(41, 12);            this.label13.TabIndex = 15;            this.label13.Text = "内容:";            //             // button4            //             this.button4.BackColor = System.Drawing.SystemColors.Control;            this.button4.Location = new System.Drawing.Point(451, 25);            this.button4.Name = "button4";            this.button4.Size = new System.Drawing.Size(76, 30);            this.button4.TabIndex = 2;            this.button4.Text = "添加";            this.button4.UseVisualStyleBackColor = false;            this.button4.Click += new System.EventHandler(this.button4_Click);            //             // MeasureListSettingDialog            //             this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);            this.BackColor = System.Drawing.SystemColors.Control;            this.ClientSize = new System.Drawing.Size(566, 631);            this.Controls.Add(this.groupBox6);            this.Controls.Add(this.groupBox5);            this.Controls.Add(this.groupBox4);            this.Controls.Add(this.groupBox3);            this.Controls.Add(this.groupBox2);            this.Controls.Add(this.groupBox1);            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;            this.MaximizeBox = false;            this.MinimizeBox = false;            this.Name = "MeasureListSettingDialog";            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.groupBox1.ResumeLayout(false);            this.groupBox2.ResumeLayout(false);            this.groupBox2.PerformLayout();            this.groupBox3.ResumeLayout(false);            this.groupBox3.PerformLayout();            this.groupBox4.ResumeLayout(false);            this.groupBox4.PerformLayout();            this.groupBox5.ResumeLayout(false);            this.groupBox5.PerformLayout();            this.groupBox6.ResumeLayout(false);            this.groupBox6.PerformLayout();            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();            this.ResumeLayout(false);        }        /// <summary>        /// 初始化表头        /// </summary>        private void InitGridHeader()        {            this.dataGridView1.ColumnHeadersHeight = 25;            DataGridViewTextBoxColumn h1 = new DataGridViewTextBoxColumn();            h1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h1.Width = 200;            DataGridViewTextBoxColumn h2 = new DataGridViewTextBoxColumn();            h2.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h2.Width = 200;            DataGridViewButtonColumn h3 = new DataGridViewButtonColumn();            h3.Width = 90;            this.dataGridView1.Columns.Add(h1);            this.dataGridView1.Columns.Add(h2);            this.dataGridView1.Columns.Add(h3);            DataGridViewHelper helper = new DataGridViewHelper(this.dataGridView1);            helper.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.name.text")));            helper.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.content.text")));            helper.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, PdnResources.GetString("Menu.operation.text")));            this.dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView1.Columns[0].ReadOnly = true;            this.dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView1.Columns[1].ReadOnly = true;            this.dataGridView1.AllowUserToResizeRows = false;            this.dataGridView1.AllowUserToResizeColumns = false;        }        /// <summary>        /// 初始化其他信息        /// </summary>        private void InitOtherInfo()        {            //设置功能路径名称            if (this.languageName.Contains("Template.Manager"))                functionPathMsg = PdnResources.GetString(this.languageName);            else                functionPathMsg = this.languageName;            this.analyzeClassify = functionPathMsg;            this.Text = this.analyzeClassify + PdnResources.GetString("Menu.Thereportisset.Text");            getFullLanguagePath(this.languageName);            this.label2.Text = functionPathMsg;            //设置模板下拉菜单            mic_template_infos infoModel = infosList.Find(a => a.language_name == this.languageName);            string filePath = Application.StartupPath + "\\ModuleManage" + infoModel.template_path.Replace('/', '\\');//获取文档路径            if (Directory.Exists(filePath))            {                string[] fileNames = Directory.GetFiles(filePath);                Dictionary<string, string> moduleInfo = new Dictionary<string, string>();                for (int i = 0; i < fileNames.Count(); i++)                {                    //编辑时产生的临时文件,不统计                    if (Path.GetFileName(fileNames[i]).Contains("~$"))                        continue;                    if (this.languageName.Equals("Template.Manager.item1.MeasureListAll"))                    {                        //判断是excel文件                        if (FileOperationHelper.IsFileWordOrExcel(fileNames[i]) == 2)                            moduleInfo.Add(Path.GetFileNameWithoutExtension(fileNames[i]), fileNames[i]);                    }                    else                    {                        //判断是word文件                        if (FileOperationHelper.IsFileWordOrExcel(fileNames[i]) == 1)                            moduleInfo.Add(Path.GetFileNameWithoutExtension(fileNames[i]), fileNames[i]);                    }                }                //绑定下拉菜单                if (moduleInfo.Count > 0)                {                    BindingSource bs = new BindingSource();                    bs.DataSource = moduleInfo;                    this.comboBox1.DataSource = bs;                    this.comboBox1.ValueMember = "Value";                    this.comboBox1.DisplayMember = "Key";                    hasModule = true;                }                else                    MessageBox.Show(PdnResources.GetString("Menu.Therearenoatefirst.text"));            }            else                MessageBox.Show(PdnResources.GetString("Menu.Therearenoatefirst.text"));            //设置存储路径            string[] savePathArr = infoModel.template_path.Split('/');//拆分以获取路径根目录的名称            ConfigModel configModel = Startup.instance.configModel;            if (savePathArr[1].Equals("Conventional"))                this.label6.Text = configModel.NormalOperation;            else if (savePathArr[1].Equals("Universal"))                this.label6.Text = configModel.GeneralAnalysis;            else if (savePathArr[1].Equals("Dedicated"))                this.label6.Text = configModel.DedicatedAnalysis;            else                this.label6.Text = PdnResources.GetString("Menu.Pathacquisitionerror.Text");            if (string.IsNullOrEmpty(this.label6.Text))                this.label6.Text = PdnResources.GetString("Menu.Thestoragepathisnotset.Text");        }        /// <summary>        /// 加载之前保存的信息        /// </summary>        private void InitLastTimeInfo()        {            if (this.hasModule && System.IO.File.Exists(filePath))            {                analyzeSavedModel = XmlSerializeHelper.DESerializer<AnalyzeSavedModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));                if (analyzeSavedModel.modelItems != null && analyzeSavedModel.modelItems.Count > 0)                {                    analyzeModel = analyzeSavedModel.modelItems.Find(a => a.languageName == this.languageName);                    if (analyzeModel != null && analyzeModel.analyzeSettingModel != null)                    {                        if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.modulePath))                            this.comboBox1.SelectedValue = analyzeModel.analyzeSettingModel.modulePath;                        if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.savePath))                            this.textBox1.Text = analyzeModel.analyzeSettingModel.savePath;                        if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.itemNumber))                            this.textBox2.Text = analyzeModel.analyzeSettingModel.itemNumber;                        if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.inspectionPerson))                            this.textBox4.Text = analyzeModel.analyzeSettingModel.inspectionPerson;                        if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.contact))                            this.textBox6.Text = analyzeModel.analyzeSettingModel.contact;                        if (!string.IsNullOrEmpty(analyzeModel.analyzeSettingModel.inspectionDepartment))                            this.textBox5.Text = analyzeModel.analyzeSettingModel.inspectionDepartment;                        if (analyzeModel.analyzeSettingModel.inspectionDate != DateTime.MinValue)                            this.dateTimePicker2.Value = analyzeModel.analyzeSettingModel.inspectionDate;                        if (analyzeModel.analyzeSettingModel.otherList != null && analyzeModel.analyzeSettingModel.otherList.Count > 0)                        {                            foreach (OthersInfo info in analyzeModel.analyzeSettingModel.otherList)                            {                                DataGridViewRow row = new DataGridViewRow();                                row.Cells.Add(CreateTextBoxCell(info.name, "name"));                                row.Cells.Add(CreateTextBoxCell(info.content, "content"));                                row.Cells.Add(CreateButtonCell(PdnResources.GetString("Menu.Edit.Delete.Text"), "delete"));                                this.dataGridView1.Rows.Add(row);                            }                            this.dataGridView1.ClearSelection();                        }                    }                }            }        }        #endregion        /// <summary>        /// 递归拼接功能路径的全称        /// </summary>        /// <param name="name"></param>        private void getFullLanguagePath(string name)        {//Template.Manager.item3.GrainSizeCutOff6394Method            mic_template_infos infoModel = infosList.Find(a => a.language_name == name);            //如果有上级,查询出上级的name对应的实际名称,拼接到前面,然后继续递归            if (infoModel.parent_id != 0)            {                string parentLanguageName = infosList.Find(a => a.id == infoModel.parent_id).language_name;                if (parentLanguageName.Contains("Template.Manager"))                    functionPathMsg = PdnResources.GetString(parentLanguageName) + "-" + functionPathMsg;                else                    functionPathMsg = parentLanguageName + "-" + functionPathMsg;                getFullLanguagePath(parentLanguageName);            }        }        /// <summary>        /// 路径选择        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button3_Click(object sender, EventArgs e)        {            FolderBrowserDialog dialog = new FolderBrowserDialog();            //if (!this.label6.Text.Equals("路径获取错误") && !this.label6.Text.Equals("存储路径未设置") && !this.label6.Text.Equals("无"))            //{            //    dialog.SelectedPath = this.label6.Text + "\\" + this.analyzeClassify + "\\";            //}            //else            //{            //                //}            dialog.SelectedPath = this.label6.Text;            if (dialog.ShowDialog() == DialogResult.OK)            {                this.textBox1.Text = dialog.SelectedPath;            }            /*APIDialogs.CommonOpenFileDialog dialog = new APIDialogs.CommonOpenFileDialog();            dialog.IsFolderPicker = true;            dialog.EnsurePathExists = true;            if(this.label6.Text.Equals("路径获取错误") || this.label6.Text.Equals("存储路径未设置") || this.label6.Text.Equals("无"))                dialog.InitialDirectory = "C:\\";            else                dialog.InitialDirectory = this.label6.Text;            if (dialog.ShowDialog() == APIDialogs.CommonFileDialogResult.Ok)            {                this.textBox1.Text = dialog.FileName;            }*/        }        /// <summary>        /// 关闭按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button1_Click(object sender, EventArgs e)        {            this.Close();        }        /// <summary>        /// 保存按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button2_Click(object sender, EventArgs e)        {            if (string.IsNullOrEmpty(this.textBox1.Text))            {                MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectaspecificstoragepath.text"));                return;            }            if (this.comboBox1.SelectedValue == null)            {                MessageBox.Show(PdnResources.GetString("Menu.Therearenorecannotbesaved.text") + "!");                return;            }            AnalyzeSettingModel model = new AnalyzeSettingModel();            model.modulePath = this.comboBox1.SelectedValue.ToString();            model.savePath = this.textBox1.Text;            model.itemNumber = this.textBox2.Text;            model.ratingDate = this.dateTimePicker1.Value;            model.inspectionPerson = this.textBox4.Text;            model.contact = this.textBox6.Text;            model.inspectionDepartment = this.textBox5.Text;            model.inspectionDate = this.dateTimePicker2.Value;            model.analyzeClassify = this.analyzeClassify;            if (this.dataGridView1.Rows.Count > 0)            {                model.otherList = new List<AnalyzeSettingModel.OthersInfo>();                foreach (DataGridViewRow rowData in this.dataGridView1.Rows)                {                    OthersInfo othersInfo = new OthersInfo();                    othersInfo.name = rowData.Cells[0].Value.ToString();                    othersInfo.content = rowData.Cells[1].Value.ToString();                    model.otherList.Add(othersInfo);                }            }            if (analyzeSavedModel != null)            {                if (analyzeModel != null)                    analyzeModel.analyzeSettingModel = model;                else                {                    analyzeModel = new AnalyzeSavedModel.ModelItem();                    analyzeModel.languageName = this.languageName;                    analyzeModel.analyzeSettingModel = model;                    analyzeSavedModel.modelItems.Add(analyzeModel);                }            }            else            {                analyzeSavedModel = new AnalyzeSavedModel();                analyzeSavedModel.modelItems = new List<AnalyzeSavedModel.ModelItem>();                analyzeModel = new AnalyzeSavedModel.ModelItem();                analyzeModel.languageName = this.languageName;                analyzeModel.analyzeSettingModel = model;                analyzeSavedModel.modelItems.Add(analyzeModel);            }            //保存xml文件            string savedModelInfo = XmlSerializeHelper.XmlSerialize<AnalyzeSavedModel>(analyzeSavedModel);            if (FileOperationHelper.WriteStringToFile(savedModelInfo, filePath, FileMode.Create))            {                //将对象传递回调用页面                this.pdnBaseForm.AnalyzeSettingModel = model;                this.analyzeSettingModel = model;                GeneratingReports();                this.Close();            }            else            {                MessageBox.Show(PdnResources.GetString("Menu.Savefailed.text"));            }        }        Dictionary<string, string> pNames = new Dictionary<string, string>();        /// <summary>        /// 保存图片到本地        /// </summary>        /// <param name="bitList"></param>        private  void SaveAllImage(List<Bitmap> bitList, string newPath, int originNum , int codeNum, string pName)        {            if (bitList != null && bitList.Count > 0)            {                for (int i = 0; i < bitList.Count; i++)                {                    string bitPath = "";                    //分别为原图和处理后的图命名                    if (i % 2 == 0)                    {                        bitPath = newPath + "/" + "origin" + originNum + ".jpg";                        pNames.Add("origin" + originNum, pName);                    }                    else                    {                        bitPath = newPath + "/" + codeNum + ".jpg";                        pNames.Add(codeNum.ToString(), pName);                    }                    bitList[i].Save(bitPath);                }            }        }        /// <summary>        /// 生成报告        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void GeneratingReports()        {            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.dataTable.Rows.Count; i++)                {                    List<string> content1 = new List<string>();                    for (int c = 0; c < this.dataTable.Columns.Count; c++)                    {                        content1.Add(this.dataTable.Rows[i][c].ToString());                    }                    analysisContent.Add(content1);                }                if (this.languageName.Equals("Template.Manager.item1.MeasureListAll"))                {                    int drawCount = 0;                    for (int i = this.appWorkspace.DocumentWorkspaces.Length - 1; i >= 0; i--)                    {                        drawCount += this.appWorkspace.DocumentWorkspaces[i].GraphicsList.Count;                    }                    if (drawCount == 0)                    {                        MessageBox.Show("没有测量信息!");                        return;                    }                    ProgressThreadProcClass procClass = new ProgressThreadProcClass();                    System.Threading.ThreadStart copyThreadProc =           delegate ()           {               string saveAsPath = "";               if (System.IO.File.Exists(analyzeSettingModel.modulePath))               {                   saveAsPath = analyzeSettingModel.savePath + "\\" + analyzeSettingModel.analyzeClassify //+ "分析"                       + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx";//另存的excel文件名                                                                           //如果savePath是盘符不是文件夹,会多出一个斜杠,office的saveas无法识别,固需处理一下                   if (saveAsPath.IndexOf("\\\\") != -1)                       saveAsPath = saveAsPath.Replace("\\\\", "\\");                   if (analysisContent != null)                   {                       try                       {                           string dictPath = Application.StartupPath + "\\temp";                           if(!System.IO.Directory.Exists(dictPath))                           {                               System.IO.Directory.CreateDirectory(dictPath);                           }                           DeleteFolder(dictPath);                           pNames = new Dictionary<string, string>();                           int insertIn = 0;                           //保存处理后的图片                           for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)                           {                               if (this.appWorkspace.DocumentWorkspaces[i].GraphicsList.Count == 0)                                   continue;                               List<Bitmap> tempBit = new List<Bitmap>();                               Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.CreateAliasedBitmap();                               Bitmap processedBit1;                               Bitmap newBit1 = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);                               if (this.appWorkspace.DocumentWorkspaces[i].PhaseModels.Count > 0)                               {                                   foreach (var item in this.appWorkspace.DocumentWorkspaces[i].PhaseModels)                                   {                                       processedBit1 = BitmapConverter.ToBitmap(item.mat);                                       Graphics graphics = Graphics.FromImage(newBit1);                                       graphics.DrawImage(processedBit1, new PointF(0, 0));                                   }                               }                               tempBit.Add(newBit1);                               Bitmap processedBit;                               Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);                               if(this.appWorkspace.DocumentWorkspaces[i].PhaseModels.Count > 0)                               {                                   foreach (var item in this.appWorkspace.DocumentWorkspaces[i].PhaseModels)                                   {                                       processedBit = BitmapConverter.ToBitmap(item.mat);                                                                            Graphics graphics = Graphics.FromImage(newBit);                                       graphics.DrawImage(processedBit, new PointF(0, 0));                                       this.appWorkspace.DocumentWorkspaces[i].GraphicsList.Draw(graphics);                                   }                               }                               else                               {                                   processedBit = this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.CreateAliasedBitmap();                                   Graphics graphics = Graphics.FromImage(newBit);                                   graphics.DrawImage(processedBit, new PointF(0, 0));                                   this.appWorkspace.DocumentWorkspaces[i].GraphicsList.Draw(graphics);                               }                               tempBit.Add(newBit);                               string imgName = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName();                               this.SaveAllImage(tempBit, dictPath, insertIn + 1, insertIn + 1, imgName);                               insertIn++;                           }                          bool su = OfficeFileHandleHelper.SaveAsExcelWithModule(analyzeSettingModel.modulePath, saveAsPath, analysisContent, dictPath, pNames);                           procClass.DismissProgressAction(this);                           if (su)                               MessageBox.Show(PdnResources.GetString("Menu.MeasureDatafoldertoview.text"));                       }                       catch (Exception)                       {                           MessageBox.Show(PdnResources.GetString("Menu.newdefit.Text"));                       }                       finally                       {                           procClass.DismissProgressAction(this);                       }                   }               }           };                    procClass.StartProgressAutoAction(this, new System.Threading.ThreadStart(copyThreadProc), PdnResources.GetString("Menu.Tools.CreateReport.Text"));                }                else                {                    List<Bitmap> bitList = new List<Bitmap>();                    //保存图片,保存原路径、原文件名、原保存格式、不压缩、保存后不关闭图像                    Bitmap bitmap = this.appWorkspace.ActiveDocumentWorkspace.CompositionSurface.CreateAliasedBitmap();                    Bitmap newBitmap;                    if (this.appWorkspace.ActiveDocumentWorkspace.phaseModels != null                        && this.appWorkspace.ActiveDocumentWorkspace.phaseModels.Count > 0                        && this.appWorkspace.ActiveDocumentWorkspace.phaseModels[0].mat != null)                    {                        newBitmap = DeepClone(BitmapConverter.ToBitmap(this.appWorkspace.ActiveDocumentWorkspace.phaseModels[0].mat));                    }                    else                    {                        newBitmap = DeepClone(bitmap);                    }                    Graphics graphics = Graphics.FromImage(newBitmap);                    //标注及测量信息嵌入图像                    if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList != null && this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count > 0)                    {                        this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Draw(graphics);                    }                    bitList.Add(newBitmap);                    this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);                }            }            else                MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");        }        public  void DeleteFolder(string path)        {            foreach (string d in Directory.GetFileSystemEntries(path))            {                if (System.IO.File.Exists(d))                {                    FileInfo fi = new FileInfo(d);                    if (fi.Attributes.ToString().IndexOf("ReadOnly") != -1)                        fi.Attributes = FileAttributes.Normal;                    System.IO.File.Delete(d);//直接删除其中的文件                   }                else                {                    DirectoryInfo d1 = new DirectoryInfo(d);                    if (d1.GetFiles().Length != 0)                    {                        DeleteFolder(d1.FullName);                     }                    Directory.Delete(d);                }            }        }        public Bitmap DeepClone(Bitmap bitmap)        {            Bitmap dstBitmap = null;            using (MemoryStream mStream = new MemoryStream())            {                BinaryFormatter bf = new BinaryFormatter();                bf.Serialize(mStream, bitmap);                mStream.Seek(0, SeekOrigin.Begin);//指定当前流的位置为流的开头。                dstBitmap = (Bitmap)bf.Deserialize(mStream);                mStream.Close();            }            return dstBitmap;        }        /// <summary>        /// 添加按钮-其他        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button4_Click(object sender, EventArgs e)        {            if (string.IsNullOrEmpty(this.textBox9.Text))            {                MessageBox.Show(PdnResources.GetString("Menu.Pleaseenteranameofthephase.text"));                return;            }            if (string.IsNullOrEmpty(this.textBox8.Text))            {                MessageBox.Show(PdnResources.GetString("Menu.Pleaseentercontent.text"));                return;            }            DataGridViewRow row = new DataGridViewRow();            row.Cells.Add(CreateTextBoxCell(this.textBox9.Text, "name"));            row.Cells.Add(CreateTextBoxCell(this.textBox8.Text, "content"));            row.Cells.Add(CreateButtonCell(PdnResources.GetString("Menu.Edit.Delete.Text"), "delete"));            this.dataGridView1.Rows.Add(row);            //选中最新添加的那一条            this.dataGridView1.ClearSelection();            this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;            //清空输入框            this.textBox9.Text = "";            this.textBox8.Text = "";        }        /// <summary>        /// 添加内容单元格        /// </summary>        /// <param name="text"></param>        /// <param name="tag"></param>        /// <returns></returns>        private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag)        {            DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();            textboxcell.Value = text;            textboxcell.Tag = tag;            return textboxcell;        }        /// <summary>        /// 添加按钮单元格        /// </summary>        /// <param name="text"></param>        /// <param name="tag"></param>        /// <returns></returns>        public DataGridViewButtonCell CreateButtonCell(string text, object tag)        {            DataGridViewButtonCell buttonCell = new DataGridViewButtonCell();            buttonCell.Value = text;            buttonCell.Tag = tag;            return buttonCell;        }        /// <summary>        /// 点击datagridview的删除按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)        {            var senderGrid = (DataGridView)sender;            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&                e.RowIndex >= 0)                this.dataGridView1.Rows.Remove(this.dataGridView1.Rows[e.RowIndex]);        }        /// <summary>        /// 配置书签按钮        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button5_Click(object sender, EventArgs e)        {            BookmarkConfigDialog bookmarkConfigDialog = new BookmarkConfigDialog(this.analyzeClassify,this.languageName);            bookmarkConfigDialog.StartPosition = FormStartPosition.CenterParent;            bookmarkConfigDialog.ShowDialog();        }    }}
 |