1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087 |
- using OpenCvSharp;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Windows.Forms;
- namespace PaintDotNet.DedicatedAnalysis.GrainSizeStandard.GBT32461
- {
- internal class MethodCutOffDialog : GrainSizeStandardDialog
- {
- /// <summary>
- /// 测定结果暂存
- /// </summary>
- private List<DataTable> dataTable1s = new List<DataTable>();
- /// <summary>
- /// 储存点击保存结果后的所有原图与分析图
- /// </summary>
- private Dictionary<string, List<Bitmap>> bitCeDingDic = new Dictionary<string, List<Bitmap>>();
- #region 组件
- private RadioButton radioButton_DarkGray;
- private GroupBox groupBox10;
- private Button button10;
- private Button button7_0;
- private GroupBox groupBox11;
- private CheckBox checkBox5_0;
- private CheckBox checkBox4;
- private CheckBox checkBox3_0;
- private DataGridViewTextBoxColumn ColumnTotal1;
- private DataGridViewTextBoxColumn ColumnTotal2;
- private DataGridViewTextBoxColumn ColumnTotal3;
- private Button button1;
- private Button button4;
- private DataGridView dataGridView1;
- private GroupBox groupBox5;
- private DataGridViewTextBoxColumn Column11;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
- private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
- private Button button8;
- private Button button6_0;
- #endregion 组件
- /// <summary>
- /// 声明构造函数
- /// </summary>
- /// <param name="appWorkspace"></param>
- /// <param name="dialogText"></param>
- public MethodCutOffDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem) : base(appWorkspace, menuItem, null, 0)
- {
- }
- #region 初始化组件
- private void InitializeLanguageText()
- {
- this.radioButton_DarkGray.Text = PdnResources.GetString("Menu.Darkgray.text");
- this.groupBox10.Text = PdnResources.GetString("Menu.sectionoperation.text");
- this.button8.Text = PdnResources.GetString("Menu.1.5/2section.text");
- this.button6_0.Text = PdnResources.GetString("Menu.0.5section.text");
- this.button10.Text = PdnResources.GetString("Menu.Setting.Text");
- this.button7_0.Text = PdnResources.GetString("Menu.1section.text");
- this.groupBox11.Text = PdnResources.GetString("Menu.Displayparamssettings.text");
- this.checkBox5_0.Text = PdnResources.GetString("Menu.displaysections.text");
- this.checkBox4.Text = PdnResources.GetString("Menu.displaygrid.text");
- this.checkBox3_0.Text = PdnResources.GetString("Menu.displaygrainboundaries.text");
- this.button1.Text = PdnResources.GetString("Menu.Savemeasurementresults.text");
- this.button4.Text = PdnResources.GetString("Menu.Deletemeasurementresult.text");
- this.Column11.HeaderText = PdnResources.GetString("Menu.Tools.GridLine.Text");
- this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Lengthofdetectionline.text");
- this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Nnlines.text");
- this.dataGridViewTextBoxColumn4.HeaderText = PdnResources.GetString("Menu.Thenumberofsections.text");
- this.groupBox5.Text = PdnResources.GetString("Menu.measurementresults.text");
- this.Text = "GBT32461(" + PdnResources.GetString("Menu.Interceptmethod.text") + ")";
- this.ColumnTotal1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.ColumnTotal2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.ColumnTotal3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridView_Total.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.ColumnTotal1,
- this.ColumnTotal2,
- this.ColumnTotal3});
- //
- // ColumnTotal1
- //
- this.ColumnTotal1.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Gridsize.text") + "(μm)";
- this.ColumnTotal1.Name = "ColumnTotal1";
- this.ColumnTotal1.ReadOnly = true;
- //
- // ColumnTotal2
- //
- this.ColumnTotal2.HeaderText = PdnResources.GetString("Menu.Numberofgrains.text");
- this.ColumnTotal2.Name = "ColumnTotal2";
- this.ColumnTotal2.ReadOnly = true;
- //
- // ColumnTotal3
- //
- this.ColumnTotal3.HeaderText = PdnResources.GetString("Menu.Averagegrainsizegrade.text");
- this.ColumnTotal3.Name = "ColumnTotal3";
- this.ColumnTotal3.ReadOnly = true;
- }
- private void InitializeComponent()
- {
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
- this.radioButton_DarkGray = new System.Windows.Forms.RadioButton();
- this.groupBox10 = new System.Windows.Forms.GroupBox();
- this.button8 = new System.Windows.Forms.Button();
- this.button6_0 = new System.Windows.Forms.Button();
- this.button10 = new System.Windows.Forms.Button();
- this.button7_0 = new System.Windows.Forms.Button();
- this.groupBox11 = new System.Windows.Forms.GroupBox();
- this.checkBox5_0 = new System.Windows.Forms.CheckBox();
- this.checkBox4 = new System.Windows.Forms.CheckBox();
- this.checkBox3_0 = new System.Windows.Forms.CheckBox();
- this.button1 = new System.Windows.Forms.Button();
- this.button4 = new System.Windows.Forms.Button();
- this.dataGridView1 = new System.Windows.Forms.DataGridView();
- this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.groupBox5 = new System.Windows.Forms.GroupBox();
- this.groupBox_analysisResult1.SuspendLayout();
- this.groupBox10.SuspendLayout();
- this.groupBox11.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
- this.groupBox5.SuspendLayout();
- this.SuspendLayout();
- //
- // groupBox_img
- //
- this.groupBox_img.Size = new System.Drawing.Size(158, 428);
- //
- // groupBox_review
- //
- this.groupBox_review.Size = new System.Drawing.Size(575, 428);
- //
- // groupBox_report
- //
- this.groupBox_report.Location = new System.Drawing.Point(974, 506);
- //
- // groupBox6groupBox_analysisResult2
- //
- this.groupBox6groupBox_analysisResult2.Location = new System.Drawing.Point(242, 506);
- //
- // groupBox_analysisResult1
- //
- this.groupBox_analysisResult1.Location = new System.Drawing.Point(12, 506);
- //
- // radioButton_DarkGray
- //
- this.radioButton_DarkGray.AutoSize = true;
- this.radioButton_DarkGray.Location = new System.Drawing.Point(178, 20);
- this.radioButton_DarkGray.Name = "radioButton_DarkGray";
- this.radioButton_DarkGray.Size = new System.Drawing.Size(59, 16);
- this.radioButton_DarkGray.TabIndex = 38;
- this.radioButton_DarkGray.TabStop = true;
- this.radioButton_DarkGray.UseVisualStyleBackColor = true;
- //
- // groupBox10
- //
- this.groupBox10.Controls.Add(this.button8);
- this.groupBox10.Controls.Add(this.button6_0);
- this.groupBox10.Controls.Add(this.button10);
- this.groupBox10.Controls.Add(this.button7_0);
- this.groupBox10.Location = new System.Drawing.Point(179, 375);
- this.groupBox10.Name = "groupBox10";
- this.groupBox10.Size = new System.Drawing.Size(208, 89);
- this.groupBox10.TabIndex = 38;
- this.groupBox10.TabStop = false;
- //
- // button8
- //
- this.button8.BackColor = System.Drawing.SystemColors.Control;
- this.button8.Location = new System.Drawing.Point(107, 50);
- this.button8.Name = "button8";
- this.button8.Size = new System.Drawing.Size(95, 26);
- this.button8.TabIndex = 13;
- this.button8.UseVisualStyleBackColor = false;
- this.button8.Click += new System.EventHandler(this.button8_Click);
- //
- // button6_0
- //
- this.button6_0.BackColor = System.Drawing.SystemColors.Control;
- this.button6_0.Location = new System.Drawing.Point(6, 51);
- this.button6_0.Name = "button6_0";
- this.button6_0.Size = new System.Drawing.Size(95, 26);
- this.button6_0.TabIndex = 12;
- this.button6_0.UseVisualStyleBackColor = false;
- this.button6_0.Click += new System.EventHandler(this.button6_0_Click);
- //
- // button10
- //
- this.button10.BackColor = System.Drawing.SystemColors.Control;
- this.button10.Location = new System.Drawing.Point(107, 20);
- this.button10.Name = "button10";
- this.button10.Size = new System.Drawing.Size(95, 26);
- this.button10.TabIndex = 11;
- this.button10.UseVisualStyleBackColor = false;
- this.button10.Click += new System.EventHandler(this.button10_Click);
- //
- // button7_0
- //
- this.button7_0.BackColor = System.Drawing.SystemColors.Control;
- this.button7_0.Location = new System.Drawing.Point(6, 20);
- this.button7_0.Name = "button7_0";
- this.button7_0.Size = new System.Drawing.Size(95, 26);
- this.button7_0.TabIndex = 8;
- this.button7_0.UseVisualStyleBackColor = false;
- this.button7_0.Click += new System.EventHandler(this.button7_0_Click);
- //
- // groupBox11
- //
- this.groupBox11.Controls.Add(this.checkBox5_0);
- this.groupBox11.Controls.Add(this.checkBox4);
- this.groupBox11.Controls.Add(this.checkBox3_0);
- this.groupBox11.Location = new System.Drawing.Point(393, 375);
- this.groupBox11.Name = "groupBox11";
- this.groupBox11.Size = new System.Drawing.Size(142, 89);
- this.groupBox11.TabIndex = 39;
- this.groupBox11.TabStop = false;
- //
- // checkBox5_0
- //
- this.checkBox5_0.AutoSize = true;
- this.checkBox5_0.Checked = true;
- this.checkBox5_0.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox5_0.Location = new System.Drawing.Point(15, 59);
- this.checkBox5_0.Name = "checkBox5_0";
- this.checkBox5_0.Size = new System.Drawing.Size(15, 14);
- this.checkBox5_0.TabIndex = 2;
- this.checkBox5_0.UseVisualStyleBackColor = true;
- this.checkBox5_0.CheckedChanged += new System.EventHandler(this.checkBox5_0_CheckedChanged);
- //
- // checkBox4
- //
- this.checkBox4.AutoSize = true;
- this.checkBox4.Checked = true;
- this.checkBox4.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox4.Location = new System.Drawing.Point(15, 37);
- this.checkBox4.Name = "checkBox4";
- this.checkBox4.Size = new System.Drawing.Size(15, 14);
- this.checkBox4.TabIndex = 1;
- this.checkBox4.UseVisualStyleBackColor = true;
- this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
- //
- // checkBox3_0
- //
- this.checkBox3_0.AutoSize = true;
- this.checkBox3_0.Checked = true;
- this.checkBox3_0.CheckState = System.Windows.Forms.CheckState.Checked;
- this.checkBox3_0.Location = new System.Drawing.Point(15, 15);
- this.checkBox3_0.Name = "checkBox3_0";
- this.checkBox3_0.Size = new System.Drawing.Size(15, 14);
- this.checkBox3_0.TabIndex = 0;
- this.checkBox3_0.UseVisualStyleBackColor = true;
- this.checkBox3_0.CheckedChanged += new System.EventHandler(this.checkBox3_0_CheckedChanged);
- //
- // button1
- //
- this.button1.BackColor = System.Drawing.SystemColors.Control;
- this.button1.Location = new System.Drawing.Point(139, 11);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(101, 23);
- this.button1.TabIndex = 5;
- this.button1.UseVisualStyleBackColor = false;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // button4
- //
- this.button4.BackColor = System.Drawing.SystemColors.Control;
- this.button4.Location = new System.Drawing.Point(246, 11);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(101, 23);
- this.button4.TabIndex = 4;
- this.button4.UseVisualStyleBackColor = false;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // dataGridView1
- //
- this.dataGridView1.AllowUserToAddRows = false;
- this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
- dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
- dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
- dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
- dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
- dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
- dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
- dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
- this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
- this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column11,
- this.dataGridViewTextBoxColumn1,
- this.dataGridViewTextBoxColumn2,
- this.dataGridViewTextBoxColumn4});
- this.dataGridView1.Location = new System.Drawing.Point(6, 36);
- this.dataGridView1.MultiSelect = false;
- this.dataGridView1.Name = "dataGridView1";
- this.dataGridView1.ReadOnly = true;
- this.dataGridView1.RowHeadersVisible = false;
- this.dataGridView1.RowTemplate.Height = 23;
- this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.dataGridView1.Size = new System.Drawing.Size(341, 103);
- this.dataGridView1.TabIndex = 29;
- //
- // Column11
- //
- dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.Column11.DefaultCellStyle = dataGridViewCellStyle2;
- this.Column11.Name = "Column11";
- this.Column11.ReadOnly = true;
- this.Column11.Width = 66;
- //
- // dataGridViewTextBoxColumn1
- //
- dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle3;
- this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
- this.dataGridViewTextBoxColumn1.ReadOnly = true;
- //
- // dataGridViewTextBoxColumn2
- //
- dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle4;
- this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
- this.dataGridViewTextBoxColumn2.ReadOnly = true;
- //
- // dataGridViewTextBoxColumn4
- //
- dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
- this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle5;
- this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
- this.dataGridViewTextBoxColumn4.ReadOnly = true;
- this.dataGridViewTextBoxColumn4.Width = 72;
- //
- // groupBox5
- //
- this.groupBox5.Controls.Add(this.dataGridView1);
- this.groupBox5.Controls.Add(this.button4);
- this.groupBox5.Controls.Add(this.button1);
- this.groupBox5.Location = new System.Drawing.Point(179, 472);
- this.groupBox5.Name = "groupBox5";
- this.groupBox5.Size = new System.Drawing.Size(355, 145);
- this.groupBox5.TabIndex = 40;
- this.groupBox5.TabStop = false;
- //
- // MethodCutOffDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.ClientSize = new System.Drawing.Size(1127, 980);
- this.Controls.Add(this.groupBox5);
- this.Controls.Add(this.groupBox10);
- this.Controls.Add(this.groupBox11);
- this.Name = "MethodCutOffDialog";
- this.Load += new System.EventHandler(this.MethodCutOffDialog_Load);
- this.Controls.SetChildIndex(this.groupBox11, 0);
- this.Controls.SetChildIndex(this.groupBox10, 0);
- this.Controls.SetChildIndex(this.groupBox5, 0);
- this.Controls.SetChildIndex(this.groupBox6groupBox_analysisResult2, 0);
- this.Controls.SetChildIndex(this.groupBox_img, 0);
- this.Controls.SetChildIndex(this.groupBox_review, 0);
- this.Controls.SetChildIndex(this.groupBox_analysisResult1, 0);
- this.Controls.SetChildIndex(this.groupBox_report, 0);
- this.groupBox_analysisResult1.ResumeLayout(false);
- this.groupBox10.ResumeLayout(false);
- this.groupBox11.ResumeLayout(false);
- this.groupBox11.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
- this.groupBox5.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- #endregion 初始化组件
- #region 需继承方法
- protected override void refreshWhileImgChanged()
- {
- object ShowGrainBoundry;
- if (GetParamValue1(ParamKey_displaygrainboundaries, out ShowGrainBoundry))//显示晶界
- this.checkBox3_0.Checked = (bool)ShowGrainBoundry;
- if (GetParamValue1(ParamKey_displaygrid, out ShowGrainBoundry))//显示网格
- this.checkBox4.Checked = (bool)ShowGrainBoundry;
- if (GetParamValue1(ParamKey_displaysections, out ShowGrainBoundry))//显示截点
- this.checkBox5_0.Checked = (bool)ShowGrainBoundry;
- if (this.dataGridView1.Rows.Count > 0)
- {
- foreach (DataGridViewRow gridViewRow in this.dataGridView1.Rows)
- {
- foreach (var dataTable in this.dataTable1s)
- {
- if (dataTable.TableName.Equals(gridViewRow.Tag))
- {
- this.dataTable1s.Remove(dataTable);
- break;
- }
- }
- if (bitCeDingDic.ContainsKey((string)gridViewRow.Tag))
- bitCeDingDic.Remove((string)gridViewRow.Tag);
- }
- this.dataGridView1.Rows.Clear();
- }
- }
- /// <summary>
- /// 保存结果
- /// </summary>
- protected override void buildListBox_analysisResult(string imagesKey, int analysisPicture, bool saveAll = false)
- {
- if (this.matOrg == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- return;
- }
- if (this.dataGridView1.Rows.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Nomeasurementresult.text"));
- return;
- }
- //if (this.comboBox1.SelectedItem == null || PdnResources.GetString("Menu.Pleaseselecttheauxiliarylineused.text").Equals(this.comboBox1.SelectedItem))
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectauxiliaryline.text") + "!");
- // return;
- //}
- double value4Total = 0;
- foreach (DataGridViewRow Row in this.dataGridView1.Rows)
- {
- value4Total += double.Parse(Row.Cells[3].Value.ToString());//交点个数
- }
- if (value4Total == 0)//###20791
- {
- MessageBox.Show("请添加截点后保存结果"/*PdnResources.GetString("Menu.Nomeasurementresult.text")*/);
- return;
- }
- string imgName = getCurrentWorkspace().GetFriendlyName();
- string tag = getCurrentWorkTag();
- DataTable dataTable = new DataTable();
- bool replace = false;
- int add = 0;
- foreach (ListViewItem item in this.listView2.Items)
- {
- if (item.Tag.Equals(tag))
- {
- add++;
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Theresuethertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- replace = true;
- }
- break;
- }
- }
- if (replace || this.listView2.Items.Count == 0 || add == 0)
- {
- if (!replace)
- {
- ListViewItem listViewItem = new ListViewItem();
- listViewItem.SubItems[0].Text = imgName;
- listViewItem.Tag = "" + tag;
- if (this.listView2.Items.Count == 0)
- this.listView2.Items.Add(listViewItem);
- else
- this.listView2.Items.Insert(0, listViewItem);
- }
- this.dataGridView2.Rows.Clear();
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.Tag = tag;
- foreach (DataGridViewColumn c in this.dataGridView2.Columns)
- {
- dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
- }
- dgvr.Cells[0].Value = imgName;
- DataGridViewRow firRow = this.dataGridView1.Rows[0];
- object value1 = firRow.Cells[0].Value;//网格
- object value2 = firRow.Cells[1].Value;//网格长度
- object value3 = firRow.Cells[2].Value;//网格条数
- double value2Total = 0;
- foreach (DataGridViewRow Row in this.dataGridView1.Rows)
- {
- value2Total += (double.Parse(Row.Cells[1].Value.ToString()) * double.Parse(Row.Cells[2].Value.ToString()));//网格总长度
- }
- //double value4Total = 0;
- //foreach (DataGridViewRow Row in this.dataGridView1.Rows)
- //{
- // value4Total += double.Parse(Row.Cells[3].Value.ToString());//交点个数
- //}
- //if (value4Total == 0)//###20791
- //{
- // MessageBox.Show(PdnResources.GetString("Menu.Nomeasurementresult.text"));
- // return;
- //}
- ////double value4Per = value4Total / this.dataGridView1.Rows.Count;
- dgvr.Cells[1].Value = value1;
- dgvr.Cells[2].Value = value2Total;
- dgvr.Cells[3].Value = value4Total;
- //dgvr.Cells[4].Value = value4Per;//级别
- decimal M = 1;// this.getGainMultiple();
- double small_l = value2Total / (value4Total * (double)M);
- //毫米转微米
- decimal A = Convert.ToDecimal(small_l * 1);
- //dgvr.Cells[4].Value = small_l;// Math.Round(A, Convert.ToInt32(this.numericUpDown1_0.Value));
- double[] lengths = {453, 320 , 269, 226, 190, 177, 160, 135, 113, 106,
- 95.0, 89.0, 80.0, 67.3, 62.0, 56.6, 53.2, 47.6, 44.3, 40.0, 35.4, 33.6, 31.0,
- 28.3, 26.6 , 23.8, 22.2, 20.0, 17.7, 16.8, 14.1, 13.3, 11.9,
- 10.0, 8.86, 8.41, 7.98, 7.07, 6.20, 5.95, 5.32, 5.00, 4.43, 4.20, 3.54, 2.97
- , 2.66, 2.50, 2.22};
- // 差值
- decimal differenceNew;
- decimal differenceOld = Math.Abs(Convert.ToDecimal(Math.Max((double)A - 1.22, (double)A - 454)));
- int first = 0;
- if ((double)A < lengths[lengths.Length - 1])
- first = lengths.Length - 1;
- else
- for (int firstI = 0; firstI < lengths.Length; firstI++)
- {
- double item = lengths[firstI];
- differenceNew = Math.Abs(A - Convert.ToDecimal(item));
- if (differenceNew < differenceOld)
- {
- differenceOld = Math.Abs(A - Convert.ToDecimal(item));
- first = firstI;
- }
- }
- string[] valueG = {"00A", "0" , "0.5", "1.0", "1.5", "1.5"/**/, "2.0", "2.5", "3.0", "3.0",
- "3.5", "3.5", "4.0", "4.5", "4.5", "5.0", "5.0", "5.5", "5.5", "6.0", "6.0", "6.5", "6.5",
- "7.0", "7.0" , "7.5", "7.5", "8.0", "8.0", "8.5", "9.0", "9.0", "9.5",
- "10.0", "10.0", "10.5", "10.5", "11.0", "11.0", "11.5", "11.5", "12.0", "12.0", "12.5", "13.0", "13.5"
- , "13.5", "14.0", "14.0"};
- dgvr.Cells[4].Value = valueG[first];
- this.dataGridView2.Rows.Add(dgvr);
- dataTable.TableName = tag;
- foreach (System.Data.DataTable dataTable1 in dataTables)
- {
- if (dataTable1.TableName.Equals(dataTable.TableName))
- {
- dataTables.Remove(dataTable1);
- break;
- }
- }
- for (int i = 0; i < this.dataGridView2.Columns.Count; i++)
- {
- dataTable.Columns.Add("" + i);
- }
- DataRow dataRow = dataTable.NewRow();
- dataRow["0"] = imgName;
- dataRow["1"] = dgvr.Cells[1].Value;// "网格1";
- dataRow["2"] = dgvr.Cells[2].Value;
- dataRow["3"] = dgvr.Cells[3].Value;
- dataRow["4"] = dgvr.Cells[4].Value;
- //dataRow["5"] = dgvr.Cells[5].Value;
- //dataRow["6"] = dgvr.Cells[6].Value;
- dataTable.Rows.Add(dataRow);
- this.dataTables.Add(dataTable);
- if (this.allShow)
- AllShow();
- this.RefreshDataGridView4();
- //保存处理后的图片
- double pantographRatio = this.appWorkspace.DocumentWorkspaces[this.selectPicture].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数
- List<Bitmap> tempBit = new List<Bitmap>();
- //Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- //tempBit.Add(originalBit);
- //Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
- //Graphics graphics = Graphics.FromImage(newBit);
- //Draw(graphics);
- //tempBit.Add(newBit);
- foreach (KeyValuePair<string, List<Bitmap>> kv in this.bitCeDingDic)
- {
- kv.Value[0].Tag = pantographRatio;
- kv.Value[1].Tag = pantographRatio;
- tempBit.Add(kv.Value[0]);
- tempBit.Add(kv.Value[1]);
- }
- if (bitDic.ContainsKey(tag))
- bitDic[tag] = tempBit;
- else
- bitDic.Add(tag, tempBit);
- //中间数据-拼接中间数据
- List<List<string>> dataList = new List<List<string>>();
- List<string> columnName = new List<string>();
- columnName.Add(PdnResources.GetString("Menu.Tools.GridLine.Text"));
- columnName.Add(PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Lengthofdetectionline.text"));
- columnName.Add(PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Nnlines.text"));
- columnName.Add(PdnResources.GetString("Menu.Thenumberofsections.text"));
- dataList.Add(columnName);
- foreach (DataGridViewRow Row in this.dataGridView1.Rows)
- {
- List<string> strList = new List<string>();
- strList.Add(Row.Cells[0].Value.ToString());
- strList.Add(Row.Cells[1].Value.ToString());
- strList.Add(Row.Cells[2].Value.ToString());
- strList.Add(Row.Cells[3].Value.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
- {
- Base.Functionodel.ExportProjectModel newModel = new Base.Functionodel.ExportProjectModel();
- newModel.tagName = tag;
- newModel.picName = imgName;
- newModel.dataList = dataList;
- tempDataModel.Add(newModel);
- }
- }
- }
- /// <summary>
- /// 是否显示晶界
- /// </summary>
- /// <returns></returns>
- protected override Boolean ShowGrainBoundryChecked()
- {
- return checkBox3_0.Checked;
- }
- //是否绘制辅助线
- protected override bool showGridChecked()
- {
- return checkBox4.Checked;
- }
- //是否绘制截点
- protected override bool drawGuidePoints()
- {
- return (matOrg != null && this.checkBox5_0.Checked);
- }
- //是否显示截点
- protected override Boolean drawDisplaySections()//##1
- {
- return this.checkBox5_0.Checked;
- }
- //辅助线类型
- protected override string[] getTypeNames()
- {
- return new string[] {
- PdnResources.GetString("Menu.Verticalauxiliaryline.text"),
- PdnResources.GetString("Menu.Horizontalauxiliaryline.text")};
- }
- protected override string getModelName()
- {
- return "GrainGBT32461CutOffMethodModel.xml";
- }
- protected override string getTemplateName()
- {
- return "Template.Manager.item3.GrainSizeCutOff_GBT32461";
- }
- protected override string getProjectEngineeringName()
- {
- return "Menu.DedicatedAnalysis.NonferrousMetal.AluminiumAlloy.Text";
- }
- protected override void SubclassInitialize()
- {
- InitializeComponent();
- InitializeLanguageText();
- }
- #endregion
- private DataGridViewTextBoxColumn Column1;
- private DataGridViewTextBoxColumn Column2;
- private DataGridViewTextBoxColumn Column3;
- private DataGridViewTextBoxColumn Column4;
- private DataGridViewTextBoxColumn Column5;
- private void MethodCutOffDialog_Load(object sender, EventArgs e)
- {
- this.button_ApplyToAll.Visible = false;
- this.button_SaveAll.Visible = false;
- this.btn_Grainboundarytoreproduce.Location = new System.Drawing.Point(912, 20);
- this.btn_saveresult.Location = new System.Drawing.Point(993, 20);
- object ShowGrainBoundry;
- if (GetParamValue1(ParamKey_displaygrainboundaries, out ShowGrainBoundry))//显示晶界
- this.checkBox3_0.Checked = (bool)ShowGrainBoundry;
- if (GetParamValue1(ParamKey_displaygrid, out ShowGrainBoundry))//显示网格
- this.checkBox4.Checked = (bool)ShowGrainBoundry;
- if (GetParamValue1(ParamKey_displaysections, out ShowGrainBoundry))//显示截点
- this.checkBox5_0.Checked = (bool)ShowGrainBoundry;
- this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column1.Name = "Column1";
- this.Column1.ReadOnly = true;
- //
- // Column2
- //
- this.Column2.Name = "Column2";
- this.Column2.ReadOnly = true;
- //
- // Column3
- //
- this.Column3.Name = "Column3";
- this.Column3.ReadOnly = true;
- //
- // Column4
- //
- this.Column4.Name = "Column4";
- this.Column4.ReadOnly = true;
- //
- // Column5
- //
- this.Column5.Name = "Column5";
- this.Column5.ReadOnly = true;
- this.Column5.HeaderText = PdnResources.GetString("Menu.Averagegrainsizegrade.text");
- this.Column4.HeaderText = PdnResources.GetString("Menu.Numberofgrains.text");
- this.Column3.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Gridsize.text") + "(μm)";
- this.Column2.HeaderText = PdnResources.GetString("Menu.Tools.GridLine.Text");
- this.Column1.HeaderText = PdnResources.GetString("Menu.picture.Text");
- this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column1,
- this.Column2,
- this.Column3,
- this.Column4,
- this.Column5});
- this.groupBox_img.Size = new System.Drawing.Size(158, 672);
- this.groupBox_review.Size = new System.Drawing.Size(575, 672);
- this.groupBox_analysisResult1.Location = new System.Drawing.Point(12, 750);
- this.groupBox6groupBox_analysisResult2.Location = new System.Drawing.Point(242, 750);
- this.groupBox_report.Location = new System.Drawing.Point(974, 750);
- DetailListStringIndex.Add(0);
- DetailListStringIndex.Add(1);
- DetailListStringIndex.Add(3);
- //DetailListStringIndex.Add(4);
- DetailListNotDoubleIndex.Add(0);
- DetailListNotDoubleIndex.Add(1);
- DetailListNotDoubleIndex.Add(3);
- IndexChangedFromIndex.Clear();
- IndexChangedToIndex.Clear();
- IndexChangedFromIndex.Add(2);
- IndexChangedFromIndex.Add(3);
- IndexChangedToIndex.Add(0, new int[] { 2, 0 });//平均
- IndexChangedToIndex.Add(1, new int[] { 2/*1*/, 1 });//平均<-求和
- IndexChangedToIndex.Add(2, new int[] { 3, -1 });//级别
- }
- /// <summary>
- /// 计算汇总列表的平均晶粒度级别
- /// </summary>
- /// <returns></returns>
- protected override string getGradeTotalCal(DataGridViewRow dgvr, int digits)
- {
- double value2Total = double.Parse(dgvr.Cells[0].Value.ToString());
- double value4Total = double.Parse(dgvr.Cells[1].Value.ToString());
- decimal M = 1;// this.getGainMultiple();
- double small_l = value2Total / (value4Total * (double)M);
- //毫米转微米
- decimal A = Convert.ToDecimal(small_l * 1);
- double[] lengths = {453, 320 , 269, 226, 190, 177, 160, 135, 113, 106,
- 95.0, 89.0, 80.0, 67.3, 62.0, 56.6, 53.2, 47.6, 44.3, 40.0, 35.4, 33.6, 31.0,
- 28.3, 26.6 , 23.8, 22.2, 20.0, 17.7, 16.8, 14.1, 13.3, 11.9,
- 10.0, 8.86, 8.41, 7.98, 7.07, 6.20, 5.95, 5.32, 5.00, 4.43, 4.20, 3.54, 2.97
- , 2.66, 2.50, 2.22};
- // 差值
- decimal differenceNew;
- decimal differenceOld = Math.Abs(Convert.ToDecimal(Math.Max((double)A - 1.22, (double)A - 454)));
- int first = 0;
- if ((double)A < lengths[lengths.Length - 1])
- first = lengths.Length - 1;
- else
- for (int firstI = 0; firstI < lengths.Length; firstI++)
- {
- double item = lengths[firstI];
- differenceNew = Math.Abs(A - Convert.ToDecimal(item));
- if (differenceNew < differenceOld)
- {
- differenceOld = Math.Abs(A - Convert.ToDecimal(item));
- first = firstI;
- }
- }
- string[] valueG = {"00A", "0" , "0.5", "1.0", "1.5", "1.5", "2.0", "2.5", "3.0", "3.0",
- "3.5", "3.5", "4.0", "4.5", "4.5", "5.0", "5.0", "5.5", "5.5", "6.0", "6.0", "6.5", "6.5",
- "7.0", "7.0" , "7.5", "7.5", "8.0", "8.0", "8.5", "9.0", "9.0", "9.5",
- "10.0", "10.0", "10.5", "10.5", "11.0", "11.0", "11.5", "11.5", "12.0", "12.0", "12.5", "13.0", "13.5"
- , "13.5", "14.0", "14.0"};
- return valueG[first];
- }
- /// <summary>
- /// 是否显示网格
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox4_CheckedChanged(object sender, EventArgs e)
- {
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 是否显示截点
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox5_0_CheckedChanged(object sender, EventArgs e)
- {
- if (!this.checkBox4.Checked)
- MessageBox.Show(PdnResources.GetString("Menu.Nogrid.text")+"!");
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 是否显示晶界
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void checkBox3_0_CheckedChanged(object sender, EventArgs e)
- {
- if (!showOrimat() && getGrainBoundryChecked() && checkBox3_0.Checked)
- {
- this.documentWorkspace.PhaseModels[1].choise = true;
- }
- else
- {
- this.documentWorkspace.PhaseModels[1].choise = false;
- }
- this.documentWorkspace.Refresh();
- }
- /// <summary>
- /// 设置截点样式
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button10_Click(object sender, EventArgs e)
- {//###
- GrainSizeStandard.IntegrationClass.GrainSurveyPointStyleSettingDialog grainSurveyPointStyleSettingDialog = new GrainSizeStandard.IntegrationClass.GrainSurveyPointStyleSettingDialog();//###
- grainSurveyPointStyleSettingDialog.StartPosition = FormStartPosition.CenterScreen;
- grainSurveyPointStyleSettingDialog.ShowDialog(this);
- }
- /// <summary>
- /// 鼠标按下
- /// </summary>
- /// <param name="drawArea"></param>
- /// <param name="e"></param>
- protected override void OnMouseDown(object sender, MouseEventArgs e)
- {
- if (this.documentWorkspace.CompositionSurface == null)
- return;
- // 换算后的点
- PointF point1 = documentWorkspace.GetScalePoint(e.Location);
- if (point1.X <= this.documentWorkspace.CompositionSurface.Width
- && point1.X >= 0
- && point1.Y >= 0
- && point1.Y <= this.documentWorkspace.CompositionSurface.Height)
- {
- RectangleF rectangleF;
- // 复合辅助线
- int add = GSSClass.GuideClass.getAddOfRStyle(point1, this.comboBox1.SelectedItem, out rectangleF);
- if (add == 0 && GSSClass.styleClass.PointKb > 0)
- rectangleF = GSSClass.GuideClass.guideModel.RectangleFLine;
- //手动添加截点
- if (this.documentWorkspace.ActiveTool == Annotation.Enum.DrawToolType.InclusionNoEffect && GSSClass.styleClass.OnMouseDownNext(point1, sender, e))
- GSSClass.styleClass.OnMouseDownFirst(point1, rectangleF, GSSClass.standardModel.linePointList, sender, e);
- }
- if (GSSClass.styleClass.PointKb == 0)
- {
- //辅助线缩放
- GSSClass.GuideClass.OnMouseDown(point1, sender, e);
- //辅助线移动
- base.OnMouseDown(sender, e);//##
- }
- ////手动删除截点或取消添加截点
- //GSSClass.styleClass.OnMouseDownNext(point1, sender, e);
- }
- private int dataTable1sTagInc = 0;
- /// <summary>
- /// 保存测定结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- if (this.matOrg == null)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- return;
- }
- if (this.comboBox1.SelectedItem == null || PdnResources.GetString("Menu.Pleaseselecttheauxiliarylineused.text").Equals(this.comboBox1.SelectedItem))
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectauxiliaryline.text") + "!");
- return;
- }
- DataTable dataTable = new DataTable();
- //this.dataGridView111114.Rows.Clear();
- DataGridViewRow dgvr = new DataGridViewRow();
- dataTable1sTagInc++;
- dgvr.Tag = dataTable1sTagInc + "";
- foreach (DataGridViewColumn c in this.dataGridView1.Columns)
- {
- dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
- }
- dgvr.Cells[0].Value = this.comboBox1.SelectedItem;
- dgvr.Cells[1].Value = GSSClass.GuideClass.LineLength;
- dgvr.Cells[2].Value = GSSClass.GuideClass.LineDec;
- double countPoints = GSSClass.styleClass.styleModel.getCountPoints();
- dgvr.Cells[3].Value = countPoints;
- this.dataGridView1.Rows.Add(dgvr);
- dataTable.TableName = (string)dgvr.Tag;
- for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
- {
- dataTable.Columns.Add("" + i);
- }
- DataRow dataRow = dataTable.NewRow();
- dataRow["0"] = dgvr.Cells[0].Value;
- dataRow["1"] = dgvr.Cells[1].Value;
- dataRow["2"] = dgvr.Cells[2].Value;
- dataRow["3"] = countPoints;// Convert.ToDecimal(this.p1RectangleFs.Count) + Convert.ToDecimal(this.p2RectangleFs.Count) / 2;
- dataTable.Rows.Add(dataRow);
- this.dataTable1s.Add(dataTable);
- //保存处理后的图片
- List<Bitmap> tempBit = new List<Bitmap>();
- Bitmap originalBit = this.bitmap;// this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap();
- tempBit.Add(originalBit);
- Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
- Graphics graphics = Graphics.FromImage(newBit);
- if (this.documentWorkspace.PhaseModels[0].choise && this.documentWorkspace.PhaseModels[0].mat != null)
- {
- Mat targetMat = this.documentWorkspace.PhaseModels[0].mat;
- graphics.DrawImage(OpenCvSharp.Extensions.BitmapConverter.ToBitmap(targetMat), 0, 0, targetMat.Width, targetMat.Height);
- }
- if (this.documentWorkspace.PhaseModels[1].choise && this.documentWorkspace.PhaseModels[1].mat != null)
- {
- Mat targetMat = this.documentWorkspace.PhaseModels[1].mat;
- graphics.DrawImage(OpenCvSharp.Extensions.BitmapConverter.ToBitmap(targetMat), 0, 0, targetMat.Width, targetMat.Height);
- }
- graphics.SmoothingMode = SmoothingMode.AntiAlias;
- drawSubclass/*Draw*/(graphics);
- tempBit.Add(newBit);
- if (bitCeDingDic.ContainsKey((string)dgvr.Tag))
- bitCeDingDic[(string)dgvr.Tag] = tempBit;
- else
- bitCeDingDic.Add((string)dgvr.Tag, tempBit);
- }
- /// <summary>
- /// 删除测定结果
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- if (this.dataGridView1.Rows.Count > 0)
- {
- if (this.dataGridView1.SelectedRows.Count > 0)
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretcteddata.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- DataGridViewRow gridViewRow = this.dataGridView1.SelectedRows[0];
- int selectIndex = gridViewRow.Index;
- foreach (var dataTable in this.dataTable1s)
- {
- if (dataTable.TableName.Equals(gridViewRow.Tag))
- {
- this.dataTable1s.Remove(dataTable);
- break;
- }
- }
- if (bitCeDingDic.ContainsKey((string)gridViewRow.Tag))
- bitCeDingDic.Remove((string)gridViewRow.Tag);
- this.dataGridView1.Rows.RemoveAt(selectIndex);
- //RefreshDataGridView1();
- }
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectthedatatobedeleted.text")+"!");
- }
- else
- MessageBox.Show(PdnResources.GetString("Menu.nodata.text")+"!");
- }
- private void AllShow()
- {
- this.dataGridView2.Rows.Clear();
- for (int i = 0; i < this.dataTables.Count; i++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- dgvr.Tag = this.dataTables[i].TableName;
- foreach (DataGridViewColumn Column in this.dataGridView2.Columns)
- {
- dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
- }
- for (int c = 0; c < this.dataTables[i].Columns.Count; c++)
- {
- //if (c > 2 && c < 4)
- // dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.dataTables[i].Rows[0][c]), Convert.ToInt32(this.numericUpDown1_0.Value)).ToString();
- //else
- dgvr.Cells[c].Value = this.dataTables[i].Rows[0][c].ToString();
- }
- this.dataGridView2.Rows.Add(dgvr);
- }
- }
- /// <summary>
- /// 0.5截点添加
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_0_Click(object sender, EventArgs e)
- {
- if (this.matOrg != null)
- GSSClass.styleClass.PointKb = 1;
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- }
- /// <summary>
- /// 1截点添加
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button7_0_Click(object sender, EventArgs e)
- {
- if (this.matOrg != null)
- GSSClass.styleClass.PointKb = 2;
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- }
- /// <summary>
- /// 1.5截点添加
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button8_Click(object sender, EventArgs e)
- {
- if (this.matOrg != null)
- GSSClass.styleClass.PointKb = 3;
- else
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicture.text")+"!");
- }
- }
- }
|