using OpenCvSharp; using OpenCvSharp.Extensions; using PaintDotNet.Annotation; using PaintDotNet.Annotation.Enum; using PaintDotNet.Base.CommTool; using PaintDotNet.Base.Functionodel; using PaintDotNet.CustomControl; using PaintDotNet.Data.Param; using System; using System.Collections.Generic; using System.Data; using System.Drawing; using System.Drawing.Drawing2D; using System.IO; using System.Linq; using System.Windows.Forms; using Point = OpenCvSharp.Point; using PaintDotNet.DbOpreate.DbModel; using PaintDotNet.DbOpreate.DbBll; using PaintDotNet.DedicatedAnalysis.DuctileIron.Common; using PaintDotNet.GeneralAnalysis; using Metis.ParameterSet; using PaintDotNet.Base; namespace PaintDotNet.DedicatedAnalysis.menuGrayiron { internal partial class GrayironDialog : PdnBaseForm { #region 控件 private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.Button button3; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox4; private System.Windows.Forms.GroupBox groupBox5; private System.Windows.Forms.GroupBox groupBox6; private System.Windows.Forms.GroupBox groupBox7; private System.Windows.Forms.GroupBox groupBox8; private System.Windows.Forms.CheckBox checkBox3; private System.Windows.Forms.Label label3; private System.Windows.Forms.TrackBar trackBar4; private System.Windows.Forms.TrackBar trackBar3; private System.Windows.Forms.RadioButton radioButton2; private System.Windows.Forms.RadioButton radioButton1; private System.Windows.Forms.CheckBox checkBox4; private System.Windows.Forms.CheckBox checkBox5; private PdnNumericUpDown pdnNumericUpDown5; private System.Windows.Forms.Label label4; private System.Windows.Forms.DataGridView dataGridView1; private System.Windows.Forms.GroupBox groupBox9; private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button2; private System.Windows.Forms.ListView listView1; private System.Windows.Forms.ListView listView2; private System.Windows.Forms.DataGridView dataGridView2; private PdnNumericUpDown pdnNumericUpDown6; private System.Windows.Forms.Label label5; private System.Windows.Forms.Button button6; private System.Windows.Forms.Button button5; private System.Windows.Forms.Button button7; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Label label6; private System.Windows.Forms.Button button8; private ImageList imageList1; /// /// 必需的设计器变量。 /// private System.ComponentModel.IContainer components = null; /// /// 图像面板 /// private DocumentWorkspaceWindow documentWorkspace; /// /// 调色板 /// PaintDotNet.ColorsForm colorsForm1; PaintDotNet.ColorsForm colorsForm2; /// /// 单位标尺 /// private double unitLength = 1; private double unitLength1 = 1; /// /// 选中图片的mat /// private Mat imageMat; /// /// 是否显示全部 /// private bool showAll = false; private bool tobinaryAction = true; /// /// 当前图片是否有视场 /// private bool isHadView = false; /// /// 是否仅修改相的颜色 /// private bool changeColor = false; /// /// 画图坐标 /// List pointList = new List(); /// /// 画图长度 /// List length = new List(); /// /// 参数设置后保存的字体大小 /// public static String fontSize = "12"; /// /// 参数设置后保存的字体颜色 /// public static Color fontColor = Color.Black; /// /// 颜色设置1级 /// public static Color setUpColor1; /// /// 颜色设置2级 /// public static Color setUpColor2; /// /// 颜色设置3级 /// public static Color setUpColor3; /// /// 颜色设置4级 /// public static Color setUpColor4; /// /// 颜色设置5级 /// public static Color setUpColor5; /// /// 颜色设置6级 /// public static Color setUpColor6; /// /// 颜色设置7级 /// public static Color setUpColor7; /// /// 颜色设置8级 /// public static Color setUpColor8; /// /// 1级数量 /// private int num1 = 0; /// /// 2级数量 /// private int num2 = 0; /// /// 3级数量 /// private int num3 = 0; /// /// 4级数量 /// private int num4 = 0; /// /// 5级数量 /// private int num5 = 0; /// /// 6级数量 /// private int num6 = 0; /// /// 7级数量 /// private int num7 = 0; /// /// 8级数量 /// private int num8 = 0; /// /// 石墨长度 /// private double graphiteLength = 0; /// /// 石墨含量 /// private double graphiteContent = 0; /// /// 石墨级别 /// private string graphiteLevel; /// /// 保存用于生成报告的图片 /// private List bitList; /// /// 储存点击保存结果后的所有原图与分析图 /// private Dictionary> bitDic = new Dictionary>(); /// /// 计算结果的表格集合 /// private List resultTableList = new List(); /// /// 是否未对图片做其他操作 /// private bool isFirstSwitch = false; private NumericUpDown numericUpDown4; private NumericUpDown numericUpDown3; private Button button9; /// /// 字典取对应轮廓 /// private Dictionary di = new Dictionary(); private BinaryControl bc; /// /// 中间数据 /// private List tempDataModel = new List(); //二值化集成1 BinaryClass binaryClass; private int menuId; private string menuName; private bool isExportResults = false; private bool isExportReports = false; private bool isExportProjects = false; /// /// 是否脚本运行 /// private Boolean initScriptValues = false; private RadioButton radioButton4; private RadioButton radioButton3; private DataGridView dataGridView3; private DataGridViewTextBoxColumn Column2; private DataGridViewTextBoxColumn Column3; private DataGridViewTextBoxColumn Column4; private DataGridViewTextBoxColumn Column5; private DataGridViewTextBoxColumn Column6; private DataGridViewTextBoxColumn Column7; private DataGridViewTextBoxColumn Column8; private DataGridViewTextBoxColumn Column9; private DataGridViewTextBoxColumn Column10; private DataGridViewTextBoxColumn Column13; private DataGridViewTextBoxColumn Column11; private DataGridViewTextBoxColumn Column12; private ToolTip toolTip1; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn8; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn9; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn10; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn11; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn12; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn13; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn14; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn15; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn16; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn17; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn18; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn19; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn20; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn21; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn22; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn23; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn24; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn25; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn26; private Button button10; private Button button11; bool isChanged = false; // //初始化其他控件 // private void InitOtherTools() { // //初始化图像控件 // this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace); this.documentWorkspace.Dock = DockStyle.Fill; this.documentWorkspace.HookMouseEvents(); this.documentWorkspace.AuxiliaryLineEnabled = false; this.documentWorkspace.Visible = false; this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.NullTool; this.groupBox8.Controls.Add(documentWorkspace); // //初始化操作按钮 // this.commonControlButtons = new CommonControlButtons(); this.commonControlButtons.Dock = DockStyle.Top; this.commonControlButtons.Height = 30; this.commonControlButtons.HideZoomToWindowAndActualSize(); this.commonControlButtons.Visible = false; this.groupBox8.Controls.Add(commonControlButtons); // //调色板 // this.colorsForm1 = new ColorsForm(); this.colorsForm1.setSaveBtn_Click(new System.EventHandler(this.colorsForm1Changed)); this.colorsForm1.StartPosition = FormStartPosition.CenterScreen; this.colorsForm2 = new ColorsForm(); this.colorsForm2.setSaveBtn_Click(new System.EventHandler(this.colorsForm2Changed)); this.colorsForm2.StartPosition = FormStartPosition.CenterScreen; // //颜色panel给定初始值 // this.panel2.BackColor = Color.Green; //// ////获取系统标尺-微米 //// //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Millimeter, out unitLength); //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength1); //二值化集成2 bc.OriginCheckedChangedAction += new EventHandler(this.bcOriginCheckedChanged);//初始化原图勾选改变事件 binaryClass.createDocumentItems(new string[] { PdnResources.GetString("Menu.BinaryAction.BinaryExtraction.Text"), PdnResources.GetString("Menu.Particlescreening.text") } , this.bc, this.appWorkspace, this.documentWorkspace, this.listView1);//初始化相的工作结构 binaryClass.BinaryImplFinishAction += new EventHandler(this.bClassBinaryImplFinishAction);//二值化后续处理事件 //binaryClass.SetBinaryBackColor(Color.Red); } //二值化集成3 #region 二值化相关方法 private void InclusionsStandardDialog_FormClosing(object sender, FormClosingEventArgs e) { #region [开启脚本录制] if (appWorkspace.startScriptRecording) { getScriptRecording(); } #endregion this.saveDialogParamValues(); binaryClass.saveParams(); //xml保存路径 string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml"; GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open)); foreach (var analysisItem in this.eachData[GetImgKey()].ListParam) { bool foundItem = false; foreach (var item in analysisModelXml.ListParam) { if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId) { item.param_value = analysisItem.param_value; foundItem = true; break; } } if (!foundItem) analysisModelXml.ListParam.Add(analysisItem.cloneModel()); } //按路径和名称保存xml文件 string userInfoXml = XmlSerializeHelper.XmlSerialize(analysisModelXml); //保存xml FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create); } private void ShownChoiseItemAndInitData(object sender, EventArgs e) { binaryClass.RefreshHistogramControl1Values(); } /// /// 添加参数改变的监听 /// /// /// private void GrainSizeDialog_Load(object sender, EventArgs e) { this.binaryClass.loadParams(); } private bool bcBinaryChecked() { return bc != null && bc.BinaryChecked; } private bool bcOriginChecked() { return bc != null && bc.OriginChecked; } /// /// 参数改变时,重新处理图像 /// /// /// //AppCommon appCommonDisplay = new AppCommon(); private void bClassBinaryImplFinishAction(object sender, EventArgs e) { if (this.documentWorkspace.CompositionSurface == null) return; sum++; isChanged = true; if (bcBinaryChecked()) { if (bcOriginChecked()) { this.documentWorkspace.PhaseModels[1].choise = false; } else { this.documentWorkspace.PhaseModels[1].choise = true; } ResetAreaAndContent(); ReloadDebrisSelection(); changeColor = false; this.documentWorkspace.PhaseModels[0].choise = false; } else { this.documentWorkspace.PhaseModels[0].choise = false; this.documentWorkspace.PhaseModels[1].choise = false; appCommon.DisplayData(this.dataGridView1, false); } this.documentWorkspace.Refresh(); } /// /// 相颜色点击事件 /// /// /// private void bcPanelColorClickAction(object sender, EventArgs e) { this.colorsForm1.UserPrimaryColor = ColorBgra.FromColor(bc.BinaryBackColor); this.colorsForm1.ShowDialog(); } /// /// 显示原图/原图+二值图 /// /// /// private void bcOriginCheckedChanged(object sender, EventArgs e) { if (!bcOriginChecked()) { if (bcBinaryChecked()) { //this.documentWorkspace.PhaseModels[0].choise = false; this.documentWorkspace.PhaseModels[1].choise = true; appCommon.DisplayData(this.dataGridView1, true); } } else { this.documentWorkspace.PhaseModels[0].choise = false; this.documentWorkspace.PhaseModels[1].choise = false; appCommon.DisplayData(this.dataGridView1, false); } this.documentWorkspace.Refresh(); } #endregion private void InitializeLanguageText() { this.bc = new PaintDotNet.CustomControl.BinaryControl(); // // bc // this.bc.BinaryBackColor = System.Drawing.Color.Red; this.bc.BinaryChecked = false; this.bc.BinaryStyle = 1; this.bc.Location = new System.Drawing.Point(157, 57); this.bc.Name = "bc"; this.bc.OriginChecked = false; this.bc.scope1End = 0D; this.bc.scope1Start = 0D; this.bc.scope2End = 0D; this.bc.scope2Start = 0D; this.bc.scope3End = 0D; this.bc.scope3Start = 0D; this.bc.Size = new System.Drawing.Size(360, 292); this.bc.TabIndex = 19; this.Controls.Add(this.bc); this.Controls.SetChildIndex(this.bc, 0); this.groupBox1.Text = PdnResources.GetString("Menu.operation.text"); this.button3.Text = PdnResources.GetString("Menu.Saveresult.text"); this.checkBox1.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text"); this.button1.Text = PdnResources.GetString("Menu.Setting.Text"); this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text"); this.groupBox4.Text = PdnResources.GetString("Menu.Particlescreening.text"); this.label3.Text = PdnResources.GetString("Menu.range.text") + ":"; this.checkBox3.Text = PdnResources.GetString("Menu.filter.text"); this.groupBox5.Text = PdnResources.GetString("Menu.Displayparamssettings.text"); this.label6.Text = PdnResources.GetString("Menu.color.text") + ":"; this.button8.Text = PdnResources.GetString("Menu.Displayparamssettings.text"); this.button7.Text = PdnResources.GetString("Menu.Colorsetting.text"); this.checkBox4.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Showgrayironlength.text"); this.radioButton2.Text = PdnResources.GetString("Menu.Displaydifferentgradesofgraphitecolor.text"); this.radioButton1.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Displaythehitecolor.text"); this.groupBox6.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Measurementparamssetting.text"); this.radioButton4.Text = PdnResources.GetString("Menu.maximumcalaaiperdiameter.Text"); this.radioButton3.Text = PdnResources.GetString("Menu.Measurebyfiberlength.Text"); this.checkBox5.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Totalnumber.text"); this.label4.Text = PdnResources.GetString("Menu.Dedicatedanalysis.blackmetal.Numberofmeasurement.text") + ":"; this.groupBox7.Text = PdnResources.GetString("Menu.Theresultsshowthat.text"); this.Column2.HeaderText = PdnResources.GetString("Menu.view.text"); this.Column3.HeaderText = PdnResources.GetString("Menu.Level1.text"); this.Column4.HeaderText = PdnResources.GetString("Menu.Level2.text"); this.Column5.HeaderText = PdnResources.GetString("Menu.Level3.text"); this.Column6.HeaderText = PdnResources.GetString("Menu.Level4.text"); this.Column7.HeaderText = PdnResources.GetString("Menu.Level5.text"); this.Column8.HeaderText = PdnResources.GetString("Menu.Level6.text"); this.Column9.HeaderText = PdnResources.GetString("Menu.Level7.text"); this.Column10.HeaderText = PdnResources.GetString("Menu.Level8.text"); this.Column13.HeaderText = PdnResources.GetString("Menu.Graphitecontent.text"); this.Column11.HeaderText = PdnResources.GetString("Menu.Graphitelength.text"); this.Column12.HeaderText = PdnResources.GetString("Menu.levdel.Text"); this.groupBox8.Text = PdnResources.GetString("Menu.Preview.text"); this.groupBox9.Text = PdnResources.GetString("Menu.Analysisresult.text"); this.dataGridViewTextBoxColumn14.HeaderText = PdnResources.GetString("Menu.picture.Text"); this.dataGridViewTextBoxColumn15.HeaderText = PdnResources.GetString("Menu.view.text"); this.dataGridViewTextBoxColumn16.HeaderText = PdnResources.GetString("Menu.Level1.text"); this.dataGridViewTextBoxColumn17.HeaderText = PdnResources.GetString("Menu.Level2.text"); this.dataGridViewTextBoxColumn18.HeaderText = PdnResources.GetString("Menu.Level3.text"); this.dataGridViewTextBoxColumn19.HeaderText = PdnResources.GetString("Menu.Level4.text"); this.dataGridViewTextBoxColumn20.HeaderText = PdnResources.GetString("Menu.Level5.text"); this.dataGridViewTextBoxColumn21.HeaderText = PdnResources.GetString("Menu.Level6.text"); this.dataGridViewTextBoxColumn22.HeaderText = PdnResources.GetString("Menu.Level7.text"); this.dataGridViewTextBoxColumn23.HeaderText = PdnResources.GetString("Menu.Level8.text"); this.dataGridViewTextBoxColumn24.HeaderText = PdnResources.GetString("Menu.Graphitecontent.text"); this.dataGridViewTextBoxColumn25.HeaderText = PdnResources.GetString("Menu.Graphitelength.text"); this.dataGridViewTextBoxColumn26.HeaderText = PdnResources.GetString("Menu.levdel.Text"); this.button9.Text = PdnResources.GetString("Menu.Exportproject.text"); this.label5.Text = PdnResources.GetString("Menu.Decimal.text") + ":"; this.button6.Text = PdnResources.GetString("Menu.Exportresults.text"); this.button5.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text"); this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.picture.Text"); this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.view.text"); this.dataGridViewTextBoxColumn3.HeaderText = PdnResources.GetString("Menu.Level1.text"); this.dataGridViewTextBoxColumn4.HeaderText = PdnResources.GetString("Menu.Level2.text"); this.dataGridViewTextBoxColumn5.HeaderText = PdnResources.GetString("Menu.Level3.text"); this.dataGridViewTextBoxColumn6.HeaderText = PdnResources.GetString("Menu.Level4.text"); this.dataGridViewTextBoxColumn7.HeaderText = PdnResources.GetString("Menu.Level5.text"); this.dataGridViewTextBoxColumn8.HeaderText = PdnResources.GetString("Menu.Level6.text"); this.dataGridViewTextBoxColumn9.HeaderText = PdnResources.GetString("Menu.Level7.text"); this.dataGridViewTextBoxColumn10.HeaderText = PdnResources.GetString("Menu.Level8.text"); this.dataGridViewTextBoxColumn11.HeaderText = PdnResources.GetString("Menu.Graphitecontent.text"); this.dataGridViewTextBoxColumn12.HeaderText = PdnResources.GetString("Menu.Graphitelength.text"); this.dataGridViewTextBoxColumn13.HeaderText = PdnResources.GetString("Menu.levdel.Text"); this.button4.Text = PdnResources.GetString("Menu.Edit.Delete.Text"); this.button2.Text = PdnResources.GetString("Menu.Showall.text"); this.button10.Text = PdnResources.GetString("Menu.File.SaveAll.Text"); this.button11.Text = PdnResources.GetString("Menu.Applyall.text"); if (type == 1) { this.Text = "GBT7216" + PdnResources.GetString("Menu.Graphitelength.text"); } else if (type == 2) { this.Text = "A247" + PdnResources.GetString("Menu.Graphitelength.text"); } } /// /// 设计器支持所需的方法 - 不要修改 /// 使用代码编辑器修改此方法的内容。 /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle40 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle41 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle44 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle42 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.button10 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.checkBox1 = new System.Windows.Forms.CheckBox(); this.button1 = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.listView1 = new System.Windows.Forms.ListView(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.numericUpDown4 = new System.Windows.Forms.NumericUpDown(); this.trackBar4 = new System.Windows.Forms.TrackBar(); this.numericUpDown3 = new System.Windows.Forms.NumericUpDown(); this.trackBar3 = new System.Windows.Forms.TrackBar(); this.label3 = new System.Windows.Forms.Label(); this.checkBox3 = new System.Windows.Forms.CheckBox(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.panel2 = new System.Windows.Forms.Panel(); this.label6 = new System.Windows.Forms.Label(); this.button8 = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button(); this.checkBox4 = new System.Windows.Forms.CheckBox(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.groupBox6 = new System.Windows.Forms.GroupBox(); this.radioButton4 = new System.Windows.Forms.RadioButton(); this.radioButton3 = new System.Windows.Forms.RadioButton(); this.checkBox5 = new System.Windows.Forms.CheckBox(); this.pdnNumericUpDown5 = new PaintDotNet.PdnNumericUpDown(); this.label4 = new System.Windows.Forms.Label(); this.groupBox7 = new System.Windows.Forms.GroupBox(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); 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.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column13 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.groupBox8 = new System.Windows.Forms.GroupBox(); this.groupBox9 = new System.Windows.Forms.GroupBox(); this.dataGridView3 = new System.Windows.Forms.DataGridView(); this.dataGridViewTextBoxColumn14 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn15 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn16 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn17 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn18 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn19 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn20 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn21 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn22 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn23 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn24 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn25 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn26 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.button9 = new System.Windows.Forms.Button(); this.pdnNumericUpDown6 = new PaintDotNet.PdnNumericUpDown(); this.label5 = new System.Windows.Forms.Label(); this.button6 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.dataGridView2 = new System.Windows.Forms.DataGridView(); this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn9 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn10 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn11 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn12 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn13 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.listView2 = new System.Windows.Forms.ListView(); this.button4 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBar3)).BeginInit(); this.groupBox5.SuspendLayout(); this.groupBox6.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pdnNumericUpDown5)).BeginInit(); this.groupBox7.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.groupBox9.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pdnNumericUpDown6)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox1.Controls.Add(this.button10); this.groupBox1.Controls.Add(this.button11); this.groupBox1.Controls.Add(this.button3); this.groupBox1.Controls.Add(this.checkBox1); this.groupBox1.Controls.Add(this.button1); this.groupBox1.Location = new System.Drawing.Point(14, 3); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(1194, 50); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; // // button10 // this.button10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.button10.Location = new System.Drawing.Point(1101, 14); this.button10.Name = "button10"; this.button10.Size = new System.Drawing.Size(84, 30); this.button10.TabIndex = 21; this.button10.Text = "保存全部"; this.button10.UseVisualStyleBackColor = true; this.button10.Click += new System.EventHandler(this.button10_Click); // // button11 // this.button11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.button11.Location = new System.Drawing.Point(921, 14); this.button11.Name = "button11"; this.button11.Size = new System.Drawing.Size(84, 30); this.button11.TabIndex = 20; this.button11.Text = "应用全部"; this.button11.UseVisualStyleBackColor = true; this.button11.Click += new System.EventHandler(this.button11_Click); // // button3 // this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.button3.Location = new System.Drawing.Point(1011, 14); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(84, 30); this.button3.TabIndex = 3; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // // checkBox1 // this.checkBox1.AutoEllipsis = true; this.checkBox1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; this.checkBox1.Location = new System.Drawing.Point(105, 20); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing.Size(158, 24); this.checkBox1.TabIndex = 1; this.checkBox1.UseVisualStyleBackColor = true; // // button1 // this.button1.AutoEllipsis = true; this.button1.Location = new System.Drawing.Point(15, 14); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(84, 30); this.button1.TabIndex = 0; this.button1.UseVisualStyleBackColor = false; this.button1.Click += new System.EventHandler(this.button1_Click); // // groupBox2 // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox2.Controls.Add(this.listView1); this.groupBox2.Location = new System.Drawing.Point(14, 59); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(135, 685); this.groupBox2.TabIndex = 2; this.groupBox2.TabStop = false; // // listView1 // this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.listView1.HideSelection = false; this.listView1.LargeImageList = this.imageList1; this.listView1.Location = new System.Drawing.Point(5, 17); this.listView1.MultiSelect = false; this.listView1.Name = "listView1"; this.listView1.Size = new System.Drawing.Size(124, 662); this.listView1.TabIndex = 0; this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged); this.listView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDown); // // imageList1 // this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; this.imageList1.ImageSize = new System.Drawing.Size(64, 64); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; // // groupBox4 // this.groupBox4.Controls.Add(this.numericUpDown4); this.groupBox4.Controls.Add(this.trackBar4); this.groupBox4.Controls.Add(this.numericUpDown3); this.groupBox4.Controls.Add(this.trackBar3); this.groupBox4.Controls.Add(this.label3); this.groupBox4.Controls.Add(this.checkBox3); this.groupBox4.Location = new System.Drawing.Point(157, 352); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(360, 62); this.groupBox4.TabIndex = 4; this.groupBox4.TabStop = false; // // numericUpDown4 // this.numericUpDown4.Location = new System.Drawing.Point(286, 31); this.numericUpDown4.Maximum = new decimal(new int[] { 0, 0, 0, 0}); this.numericUpDown4.Name = "numericUpDown4"; this.numericUpDown4.Size = new System.Drawing.Size(47, 21); this.numericUpDown4.TabIndex = 3; this.numericUpDown4.ValueChanged += new System.EventHandler(this.numericUpDown4_ValueChanged); // // trackBar4 // this.trackBar4.AutoSize = false; this.trackBar4.Location = new System.Drawing.Point(206, 30); this.trackBar4.Maximum = 0; this.trackBar4.Name = "trackBar4"; this.trackBar4.Size = new System.Drawing.Size(75, 26); this.trackBar4.TabIndex = 33; this.trackBar4.TickStyle = System.Windows.Forms.TickStyle.None; this.trackBar4.Scroll += new System.EventHandler(this.trackBar4_Scroll); // // numericUpDown3 // this.numericUpDown3.Location = new System.Drawing.Point(73, 31); this.numericUpDown3.Maximum = new decimal(new int[] { 0, 0, 0, 0}); this.numericUpDown3.Name = "numericUpDown3"; this.numericUpDown3.Size = new System.Drawing.Size(47, 21); this.numericUpDown3.TabIndex = 2; this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown3_ValueChanged); // // trackBar3 // this.trackBar3.AutoSize = false; this.trackBar3.Location = new System.Drawing.Point(123, 31); this.trackBar3.Maximum = 0; this.trackBar3.Name = "trackBar3"; this.trackBar3.Size = new System.Drawing.Size(75, 26); this.trackBar3.TabIndex = 32; this.trackBar3.TickStyle = System.Windows.Forms.TickStyle.None; this.trackBar3.Scroll += new System.EventHandler(this.trackBar3_Scroll); // // label3 // this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label3.AutoEllipsis = true; this.label3.Location = new System.Drawing.Point(26, 35); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(45, 12); this.label3.TabIndex = 3; // // checkBox3 // this.checkBox3.AutoEllipsis = true; this.checkBox3.Location = new System.Drawing.Point(20, 17); this.checkBox3.Name = "checkBox3"; this.checkBox3.Size = new System.Drawing.Size(100, 16); this.checkBox3.TabIndex = 0; this.checkBox3.UseVisualStyleBackColor = true; this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged); // // groupBox5 // this.groupBox5.Controls.Add(this.panel2); this.groupBox5.Controls.Add(this.label6); this.groupBox5.Controls.Add(this.button8); this.groupBox5.Controls.Add(this.button7); this.groupBox5.Controls.Add(this.checkBox4); this.groupBox5.Controls.Add(this.radioButton2); this.groupBox5.Controls.Add(this.radioButton1); this.groupBox5.Location = new System.Drawing.Point(157, 418); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new System.Drawing.Size(360, 87); this.groupBox5.TabIndex = 5; this.groupBox5.TabStop = false; // // panel2 // this.panel2.BackColor = System.Drawing.Color.Maroon; this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panel2.Location = new System.Drawing.Point(263, 19); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(69, 17); this.panel2.TabIndex = 28; this.panel2.Click += new System.EventHandler(this.panel2_Click); // // label6 // this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label6.AutoEllipsis = true; this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(220, 19); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(0, 12); this.label6.TabIndex = 5; // // button8 // this.button8.AutoEllipsis = true; this.button8.BackColor = System.Drawing.SystemColors.Control; this.button8.Location = new System.Drawing.Point(223, 61); this.button8.Name = "button8"; this.button8.Size = new System.Drawing.Size(110, 20); this.button8.TabIndex = 4; this.button8.UseVisualStyleBackColor = false; this.button8.Click += new System.EventHandler(this.button8_Click); // // button7 // this.button7.AutoEllipsis = true; this.button7.BackColor = System.Drawing.SystemColors.Control; this.button7.Location = new System.Drawing.Point(233, 39); this.button7.Name = "button7"; this.button7.Size = new System.Drawing.Size(100, 20); this.button7.TabIndex = 3; this.button7.UseVisualStyleBackColor = false; this.button7.Click += new System.EventHandler(this.button7_Click); // // checkBox4 // this.checkBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.checkBox4.AutoEllipsis = true; this.checkBox4.Location = new System.Drawing.Point(20, 64); this.checkBox4.Name = "checkBox4"; this.checkBox4.Size = new System.Drawing.Size(200, 17); this.checkBox4.TabIndex = 2; this.checkBox4.UseVisualStyleBackColor = true; this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged); // // radioButton2 // this.radioButton2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.radioButton2.AutoEllipsis = true; this.radioButton2.Location = new System.Drawing.Point(20, 42); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new System.Drawing.Size(210, 16); this.radioButton2.TabIndex = 1; this.radioButton2.UseVisualStyleBackColor = true; this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged); // // radioButton1 // this.radioButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.radioButton1.Location = new System.Drawing.Point(20, 20); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new System.Drawing.Size(178, 16); this.radioButton1.TabIndex = 0; this.radioButton1.UseVisualStyleBackColor = true; this.radioButton1.CheckedChanged += new System.EventHandler(this.radioButton1_CheckedChanged); // // groupBox6 // this.groupBox6.Controls.Add(this.radioButton4); this.groupBox6.Controls.Add(this.radioButton3); this.groupBox6.Controls.Add(this.checkBox5); this.groupBox6.Controls.Add(this.pdnNumericUpDown5); this.groupBox6.Controls.Add(this.label4); this.groupBox6.Location = new System.Drawing.Point(157, 509); this.groupBox6.Name = "groupBox6"; this.groupBox6.Size = new System.Drawing.Size(360, 64); this.groupBox6.TabIndex = 6; this.groupBox6.TabStop = false; // // radioButton4 // this.radioButton4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.radioButton4.AutoEllipsis = true; this.radioButton4.Checked = true; this.radioButton4.Location = new System.Drawing.Point(182, 42); this.radioButton4.Name = "radioButton4"; this.radioButton4.Size = new System.Drawing.Size(171, 16); this.radioButton4.TabIndex = 33; this.radioButton4.TabStop = true; this.radioButton4.UseVisualStyleBackColor = true; // // radioButton3 // this.radioButton3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.radioButton3.Location = new System.Drawing.Point(20, 43); this.radioButton3.Name = "radioButton3"; this.radioButton3.Size = new System.Drawing.Size(156, 16); this.radioButton3.TabIndex = 32; this.radioButton3.UseVisualStyleBackColor = true; this.radioButton3.CheckedChanged += new System.EventHandler(this.radioButton3_CheckedChanged); // // checkBox5 // this.checkBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.checkBox5.Location = new System.Drawing.Point(182, 20); this.checkBox5.Name = "checkBox5"; this.checkBox5.Size = new System.Drawing.Size(171, 17); this.checkBox5.TabIndex = 31; this.checkBox5.UseVisualStyleBackColor = true; this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox5_CheckedChanged); // // pdnNumericUpDown5 // this.pdnNumericUpDown5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.pdnNumericUpDown5.Location = new System.Drawing.Point(83, 16); this.pdnNumericUpDown5.Maximum = new decimal(new int[] { 3, 0, 0, 0}); this.pdnNumericUpDown5.Name = "pdnNumericUpDown5"; this.pdnNumericUpDown5.Size = new System.Drawing.Size(39, 21); this.pdnNumericUpDown5.TabIndex = 30; this.pdnNumericUpDown5.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.pdnNumericUpDown5.Value = new decimal(new int[] { 3, 0, 0, 0}); this.pdnNumericUpDown5.ValueChanged += new System.EventHandler(this.pdnNumericUpDown5_ValueChanged); // // label4 // this.label4.AutoEllipsis = true; this.label4.Location = new System.Drawing.Point(4, 21); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(70, 12); this.label4.TabIndex = 29; // // groupBox7 // this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox7.Controls.Add(this.dataGridView1); this.groupBox7.Location = new System.Drawing.Point(157, 577); this.groupBox7.Name = "groupBox7"; this.groupBox7.Size = new System.Drawing.Size(360, 167); this.groupBox7.TabIndex = 7; this.groupBox7.TabStop = false; // // dataGridView1 // this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter; dataGridViewCellStyle23.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle23.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle23.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle23.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle23.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle23.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle23; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Column2, this.Column3, this.Column4, this.Column5, this.Column6, this.Column7, this.Column8, this.Column9, this.Column10, this.Column13, this.Column11, this.Column12}); dataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter; dataGridViewCellStyle36.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle36.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle36.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle36.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle36.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle36.WrapMode = System.Windows.Forms.DataGridViewTriState.False; this.dataGridView1.DefaultCellStyle = dataGridViewCellStyle36; this.dataGridView1.Location = new System.Drawing.Point(8, 20); this.dataGridView1.MultiSelect = false; this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowHeadersVisible = false; this.dataGridView1.RowHeadersWidth = 51; this.dataGridView1.RowTemplate.Height = 23; this.dataGridView1.Size = new System.Drawing.Size(345, 141); this.dataGridView1.TabIndex = 1; // // Column2 // dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column2.DefaultCellStyle = dataGridViewCellStyle24; this.Column2.FillWeight = 659.8984F; this.Column2.HeaderText = "Column2"; this.Column2.Name = "Column2"; this.Column2.ReadOnly = true; // // Column3 // dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column3.DefaultCellStyle = dataGridViewCellStyle25; this.Column3.FillWeight = 113.9963F; this.Column3.HeaderText = "Column3"; this.Column3.Name = "Column3"; this.Column3.ReadOnly = true; // // Column4 // dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column4.DefaultCellStyle = dataGridViewCellStyle26; this.Column4.FillWeight = 2.379776F; this.Column4.HeaderText = "Column4"; this.Column4.Name = "Column4"; this.Column4.ReadOnly = true; // // Column5 // dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column5.DefaultCellStyle = dataGridViewCellStyle27; this.Column5.FillWeight = 2.379776F; this.Column5.HeaderText = "Column5"; this.Column5.Name = "Column5"; this.Column5.ReadOnly = true; // // Column6 // dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column6.DefaultCellStyle = dataGridViewCellStyle28; this.Column6.FillWeight = 2.379776F; this.Column6.HeaderText = "Column6"; this.Column6.Name = "Column6"; this.Column6.ReadOnly = true; // // Column7 // dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column7.DefaultCellStyle = dataGridViewCellStyle29; this.Column7.FillWeight = 2.379776F; this.Column7.HeaderText = "Column7"; this.Column7.Name = "Column7"; this.Column7.ReadOnly = true; // // Column8 // dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column8.DefaultCellStyle = dataGridViewCellStyle30; this.Column8.FillWeight = 2.379776F; this.Column8.HeaderText = "Column8"; this.Column8.Name = "Column8"; this.Column8.ReadOnly = true; // // Column9 // dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column9.DefaultCellStyle = dataGridViewCellStyle31; this.Column9.FillWeight = 2.379776F; this.Column9.HeaderText = "Column9"; this.Column9.Name = "Column9"; this.Column9.ReadOnly = true; // // Column10 // dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column10.DefaultCellStyle = dataGridViewCellStyle32; this.Column10.FillWeight = 2.379776F; this.Column10.HeaderText = "Column10"; this.Column10.Name = "Column10"; this.Column10.ReadOnly = true; // // Column13 // dataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column13.DefaultCellStyle = dataGridViewCellStyle33; this.Column13.FillWeight = 2.379776F; this.Column13.HeaderText = "Column13"; this.Column13.Name = "Column13"; this.Column13.ReadOnly = true; // // Column11 // dataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column11.DefaultCellStyle = dataGridViewCellStyle34; this.Column11.FillWeight = 2.379776F; this.Column11.HeaderText = "Column11"; this.Column11.Name = "Column11"; this.Column11.ReadOnly = true; // // Column12 // dataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column12.DefaultCellStyle = dataGridViewCellStyle35; this.Column12.FillWeight = 2.379776F; this.Column12.HeaderText = "Column12"; this.Column12.Name = "Column12"; this.Column12.ReadOnly = true; // // groupBox8 // this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox8.Location = new System.Drawing.Point(523, 59); this.groupBox8.Name = "groupBox8"; this.groupBox8.Size = new System.Drawing.Size(685, 685); this.groupBox8.TabIndex = 14; this.groupBox8.TabStop = false; this.groupBox8.UseCompatibleTextRendering = true; // // groupBox9 // this.groupBox9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox9.Controls.Add(this.dataGridView3); this.groupBox9.Controls.Add(this.button9); this.groupBox9.Controls.Add(this.pdnNumericUpDown6); this.groupBox9.Controls.Add(this.label5); this.groupBox9.Controls.Add(this.button6); this.groupBox9.Controls.Add(this.button5); this.groupBox9.Controls.Add(this.dataGridView2); this.groupBox9.Controls.Add(this.listView2); this.groupBox9.Controls.Add(this.button4); this.groupBox9.Controls.Add(this.button2); this.groupBox9.Location = new System.Drawing.Point(12, 744); this.groupBox9.Name = "groupBox9"; this.groupBox9.Size = new System.Drawing.Size(1196, 198); this.groupBox9.TabIndex = 15; this.groupBox9.TabStop = false; // // dataGridView3 // this.dataGridView3.AllowUserToAddRows = false; this.dataGridView3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dataGridView3.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView3.BackgroundColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle37.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter; dataGridViewCellStyle37.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle37.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle37.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle37.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle37.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle37.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridView3.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle37; this.dataGridView3.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView3.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridViewTextBoxColumn14, this.dataGridViewTextBoxColumn15, this.dataGridViewTextBoxColumn16, this.dataGridViewTextBoxColumn17, this.dataGridViewTextBoxColumn18, this.dataGridViewTextBoxColumn19, this.dataGridViewTextBoxColumn20, this.dataGridViewTextBoxColumn21, this.dataGridViewTextBoxColumn22, this.dataGridViewTextBoxColumn23, this.dataGridViewTextBoxColumn24, this.dataGridViewTextBoxColumn25, this.dataGridViewTextBoxColumn26}); dataGridViewCellStyle40.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle40.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle40.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle40.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle40.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle40.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle40.WrapMode = System.Windows.Forms.DataGridViewTriState.False; this.dataGridView3.DefaultCellStyle = dataGridViewCellStyle40; this.dataGridView3.Location = new System.Drawing.Point(220, 126); this.dataGridView3.MultiSelect = false; this.dataGridView3.Name = "dataGridView3"; this.dataGridView3.ReadOnly = true; this.dataGridView3.RowHeadersVisible = false; this.dataGridView3.RowHeadersWidth = 51; this.dataGridView3.RowTemplate.Height = 23; this.dataGridView3.Size = new System.Drawing.Size(808, 64); this.dataGridView3.TabIndex = 29; // // dataGridViewTextBoxColumn14 // dataGridViewCellStyle38.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; this.dataGridViewTextBoxColumn14.DefaultCellStyle = dataGridViewCellStyle38; this.dataGridViewTextBoxColumn14.FillWeight = 593.9086F; this.dataGridViewTextBoxColumn14.HeaderText = "dataGridViewTextBoxColumn14"; this.dataGridViewTextBoxColumn14.MinimumWidth = 90; this.dataGridViewTextBoxColumn14.Name = "dataGridViewTextBoxColumn14"; this.dataGridViewTextBoxColumn14.ReadOnly = true; // // dataGridViewTextBoxColumn15 // dataGridViewCellStyle39.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; this.dataGridViewTextBoxColumn15.DefaultCellStyle = dataGridViewCellStyle39; this.dataGridViewTextBoxColumn15.FillWeight = 207.4797F; this.dataGridViewTextBoxColumn15.HeaderText = "dataGridViewTextBoxColumn15"; this.dataGridViewTextBoxColumn15.MinimumWidth = 90; this.dataGridViewTextBoxColumn15.Name = "dataGridViewTextBoxColumn15"; this.dataGridViewTextBoxColumn15.ReadOnly = true; // // dataGridViewTextBoxColumn16 // this.dataGridViewTextBoxColumn16.FillWeight = 412.4987F; this.dataGridViewTextBoxColumn16.HeaderText = "dataGridViewTextBoxColumn16"; this.dataGridViewTextBoxColumn16.MinimumWidth = 90; this.dataGridViewTextBoxColumn16.Name = "dataGridViewTextBoxColumn16"; this.dataGridViewTextBoxColumn16.ReadOnly = true; // // dataGridViewTextBoxColumn17 // this.dataGridViewTextBoxColumn17.FillWeight = 8.611287F; this.dataGridViewTextBoxColumn17.HeaderText = "dataGridViewTextBoxColumn17"; this.dataGridViewTextBoxColumn17.MinimumWidth = 90; this.dataGridViewTextBoxColumn17.Name = "dataGridViewTextBoxColumn17"; this.dataGridViewTextBoxColumn17.ReadOnly = true; // // dataGridViewTextBoxColumn18 // this.dataGridViewTextBoxColumn18.FillWeight = 8.611287F; this.dataGridViewTextBoxColumn18.HeaderText = "dataGridViewTextBoxColumn18"; this.dataGridViewTextBoxColumn18.MinimumWidth = 90; this.dataGridViewTextBoxColumn18.Name = "dataGridViewTextBoxColumn18"; this.dataGridViewTextBoxColumn18.ReadOnly = true; // // dataGridViewTextBoxColumn19 // this.dataGridViewTextBoxColumn19.FillWeight = 8.611287F; this.dataGridViewTextBoxColumn19.HeaderText = "dataGridViewTextBoxColumn19"; this.dataGridViewTextBoxColumn19.MinimumWidth = 90; this.dataGridViewTextBoxColumn19.Name = "dataGridViewTextBoxColumn19"; this.dataGridViewTextBoxColumn19.ReadOnly = true; // // dataGridViewTextBoxColumn20 // this.dataGridViewTextBoxColumn20.FillWeight = 8.611287F; this.dataGridViewTextBoxColumn20.HeaderText = "dataGridViewTextBoxColumn20"; this.dataGridViewTextBoxColumn20.MinimumWidth = 90; this.dataGridViewTextBoxColumn20.Name = "dataGridViewTextBoxColumn20"; this.dataGridViewTextBoxColumn20.ReadOnly = true; // // dataGridViewTextBoxColumn21 // this.dataGridViewTextBoxColumn21.FillWeight = 8.611287F; this.dataGridViewTextBoxColumn21.HeaderText = "dataGridViewTextBoxColumn21"; this.dataGridViewTextBoxColumn21.MinimumWidth = 90; this.dataGridViewTextBoxColumn21.Name = "dataGridViewTextBoxColumn21"; this.dataGridViewTextBoxColumn21.ReadOnly = true; // // dataGridViewTextBoxColumn22 // this.dataGridViewTextBoxColumn22.FillWeight = 8.611287F; this.dataGridViewTextBoxColumn22.HeaderText = "dataGridViewTextBoxColumn22"; this.dataGridViewTextBoxColumn22.MinimumWidth = 90; this.dataGridViewTextBoxColumn22.Name = "dataGridViewTextBoxColumn22"; this.dataGridViewTextBoxColumn22.ReadOnly = true; // // dataGridViewTextBoxColumn23 // this.dataGridViewTextBoxColumn23.FillWeight = 8.611287F; this.dataGridViewTextBoxColumn23.HeaderText = "dataGridViewTextBoxColumn23"; this.dataGridViewTextBoxColumn23.MinimumWidth = 90; this.dataGridViewTextBoxColumn23.Name = "dataGridViewTextBoxColumn23"; this.dataGridViewTextBoxColumn23.ReadOnly = true; // // dataGridViewTextBoxColumn24 // this.dataGridViewTextBoxColumn24.FillWeight = 8.611287F; this.dataGridViewTextBoxColumn24.HeaderText = "dataGridViewTextBoxColumn24"; this.dataGridViewTextBoxColumn24.MinimumWidth = 90; this.dataGridViewTextBoxColumn24.Name = "dataGridViewTextBoxColumn24"; this.dataGridViewTextBoxColumn24.ReadOnly = true; // // dataGridViewTextBoxColumn25 // this.dataGridViewTextBoxColumn25.FillWeight = 8.611287F; this.dataGridViewTextBoxColumn25.HeaderText = "dataGridViewTextBoxColumn25"; this.dataGridViewTextBoxColumn25.MinimumWidth = 90; this.dataGridViewTextBoxColumn25.Name = "dataGridViewTextBoxColumn25"; this.dataGridViewTextBoxColumn25.ReadOnly = true; // // dataGridViewTextBoxColumn26 // this.dataGridViewTextBoxColumn26.FillWeight = 8.611287F; this.dataGridViewTextBoxColumn26.HeaderText = "dataGridViewTextBoxColumn26"; this.dataGridViewTextBoxColumn26.MinimumWidth = 90; this.dataGridViewTextBoxColumn26.Name = "dataGridViewTextBoxColumn26"; this.dataGridViewTextBoxColumn26.ReadOnly = true; // // button9 // this.button9.Anchor = System.Windows.Forms.AnchorStyles.Right; this.button9.AutoEllipsis = true; this.button9.Location = new System.Drawing.Point(1056, 83); this.button9.Name = "button9"; this.button9.Size = new System.Drawing.Size(128, 26); this.button9.TabIndex = 28; this.button9.UseVisualStyleBackColor = true; this.button9.Click += new System.EventHandler(this.button9_Click); // // pdnNumericUpDown6 // this.pdnNumericUpDown6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.pdnNumericUpDown6.Location = new System.Drawing.Point(1112, 163); this.pdnNumericUpDown6.Maximum = new decimal(new int[] { 10, 0, 0, 0}); this.pdnNumericUpDown6.Name = "pdnNumericUpDown6"; this.pdnNumericUpDown6.Size = new System.Drawing.Size(56, 21); this.pdnNumericUpDown6.TabIndex = 27; this.pdnNumericUpDown6.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.pdnNumericUpDown6.Value = new decimal(new int[] { 2, 0, 0, 0}); this.pdnNumericUpDown6.ValueChanged += new System.EventHandler(this.pdnNumericUpDown6_ValueChanged); // // label5 // this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.label5.AutoEllipsis = true; this.label5.Location = new System.Drawing.Point(1073, 169); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(45, 12); this.label5.TabIndex = 26; // // button6 // this.button6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.button6.AutoEllipsis = true; this.button6.Location = new System.Drawing.Point(1056, 46); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(128, 26); this.button6.TabIndex = 25; this.button6.UseVisualStyleBackColor = true; this.button6.Click += new System.EventHandler(this.button6_Click); // // button5 // this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.button5.AutoEllipsis = true; this.button5.Location = new System.Drawing.Point(1056, 14); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(128, 26); this.button5.TabIndex = 24; this.button5.UseVisualStyleBackColor = true; this.button5.Click += new System.EventHandler(this.button5_Click); // // dataGridView2 // this.dataGridView2.AllowUserToAddRows = false; this.dataGridView2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView2.BackgroundColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle41.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter; dataGridViewCellStyle41.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle41.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle41.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle41.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle41.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle41.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle41; this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridViewTextBoxColumn1, this.dataGridViewTextBoxColumn2, this.dataGridViewTextBoxColumn3, this.dataGridViewTextBoxColumn4, this.dataGridViewTextBoxColumn5, this.dataGridViewTextBoxColumn6, this.dataGridViewTextBoxColumn7, this.dataGridViewTextBoxColumn8, this.dataGridViewTextBoxColumn9, this.dataGridViewTextBoxColumn10, this.dataGridViewTextBoxColumn11, this.dataGridViewTextBoxColumn12, this.dataGridViewTextBoxColumn13}); dataGridViewCellStyle44.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle44.BackColor = System.Drawing.SystemColors.Window; dataGridViewCellStyle44.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle44.ForeColor = System.Drawing.SystemColors.ControlText; dataGridViewCellStyle44.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle44.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle44.WrapMode = System.Windows.Forms.DataGridViewTriState.False; this.dataGridView2.DefaultCellStyle = dataGridViewCellStyle44; this.dataGridView2.Location = new System.Drawing.Point(220, 14); this.dataGridView2.MultiSelect = false; this.dataGridView2.Name = "dataGridView2"; this.dataGridView2.ReadOnly = true; this.dataGridView2.RowHeadersVisible = false; this.dataGridView2.RowHeadersWidth = 51; this.dataGridView2.RowTemplate.Height = 23; this.dataGridView2.Size = new System.Drawing.Size(808, 109); this.dataGridView2.TabIndex = 15; // // dataGridViewTextBoxColumn1 // dataGridViewCellStyle42.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle42; this.dataGridViewTextBoxColumn1.FillWeight = 306.162F; this.dataGridViewTextBoxColumn1.HeaderText = "dataGridViewTextBoxColumn1"; this.dataGridViewTextBoxColumn1.MinimumWidth = 90; this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; this.dataGridViewTextBoxColumn1.ReadOnly = true; // // dataGridViewTextBoxColumn2 // dataGridViewCellStyle43.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle43; this.dataGridViewTextBoxColumn2.FillWeight = 395.9391F; this.dataGridViewTextBoxColumn2.HeaderText = "dataGridViewTextBoxColumn2"; this.dataGridViewTextBoxColumn2.MinimumWidth = 90; this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; this.dataGridViewTextBoxColumn2.ReadOnly = true; // // dataGridViewTextBoxColumn3 // this.dataGridViewTextBoxColumn3.FillWeight = 89.25066F; this.dataGridViewTextBoxColumn3.HeaderText = "dataGridViewTextBoxColumn3"; this.dataGridViewTextBoxColumn3.MinimumWidth = 90; this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; this.dataGridViewTextBoxColumn3.ReadOnly = true; // // dataGridViewTextBoxColumn4 // this.dataGridViewTextBoxColumn4.FillWeight = 86.23344F; this.dataGridViewTextBoxColumn4.HeaderText = "dataGridViewTextBoxColumn4"; this.dataGridViewTextBoxColumn4.MinimumWidth = 90; this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; this.dataGridViewTextBoxColumn4.ReadOnly = true; // // dataGridViewTextBoxColumn5 // this.dataGridViewTextBoxColumn5.FillWeight = 73.43429F; this.dataGridViewTextBoxColumn5.HeaderText = "dataGridViewTextBoxColumn5"; this.dataGridViewTextBoxColumn5.MinimumWidth = 90; this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5"; this.dataGridViewTextBoxColumn5.ReadOnly = true; // // dataGridViewTextBoxColumn6 // this.dataGridViewTextBoxColumn6.FillWeight = 64.06709F; this.dataGridViewTextBoxColumn6.HeaderText = "dataGridViewTextBoxColumn6"; this.dataGridViewTextBoxColumn6.MinimumWidth = 90; this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6"; this.dataGridViewTextBoxColumn6.ReadOnly = true; // // dataGridViewTextBoxColumn7 // this.dataGridViewTextBoxColumn7.FillWeight = 56.51134F; this.dataGridViewTextBoxColumn7.HeaderText = "dataGridViewTextBoxColumn7"; this.dataGridViewTextBoxColumn7.MinimumWidth = 90; this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7"; this.dataGridViewTextBoxColumn7.ReadOnly = true; // // dataGridViewTextBoxColumn8 // this.dataGridViewTextBoxColumn8.FillWeight = 49.3501F; this.dataGridViewTextBoxColumn8.HeaderText = "dataGridViewTextBoxColumn8"; this.dataGridViewTextBoxColumn8.MinimumWidth = 90; this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8"; this.dataGridViewTextBoxColumn8.ReadOnly = true; // // dataGridViewTextBoxColumn9 // this.dataGridViewTextBoxColumn9.FillWeight = 44.2613F; this.dataGridViewTextBoxColumn9.HeaderText = "dataGridViewTextBoxColumn9"; this.dataGridViewTextBoxColumn9.MinimumWidth = 90; this.dataGridViewTextBoxColumn9.Name = "dataGridViewTextBoxColumn9"; this.dataGridViewTextBoxColumn9.ReadOnly = true; // // dataGridViewTextBoxColumn10 // this.dataGridViewTextBoxColumn10.FillWeight = 39.12654F; this.dataGridViewTextBoxColumn10.HeaderText = "dataGridViewTextBoxColumn10"; this.dataGridViewTextBoxColumn10.MinimumWidth = 90; this.dataGridViewTextBoxColumn10.Name = "dataGridViewTextBoxColumn10"; this.dataGridViewTextBoxColumn10.ReadOnly = true; // // dataGridViewTextBoxColumn11 // this.dataGridViewTextBoxColumn11.FillWeight = 34.903F; this.dataGridViewTextBoxColumn11.HeaderText = "dataGridViewTextBoxColumn11"; this.dataGridViewTextBoxColumn11.MinimumWidth = 90; this.dataGridViewTextBoxColumn11.Name = "dataGridViewTextBoxColumn11"; this.dataGridViewTextBoxColumn11.ReadOnly = true; // // dataGridViewTextBoxColumn12 // this.dataGridViewTextBoxColumn12.FillWeight = 32.60351F; this.dataGridViewTextBoxColumn12.HeaderText = "dataGridViewTextBoxColumn12"; this.dataGridViewTextBoxColumn12.MinimumWidth = 90; this.dataGridViewTextBoxColumn12.Name = "dataGridViewTextBoxColumn12"; this.dataGridViewTextBoxColumn12.ReadOnly = true; // // dataGridViewTextBoxColumn13 // this.dataGridViewTextBoxColumn13.FillWeight = 28.15768F; this.dataGridViewTextBoxColumn13.HeaderText = "dataGridViewTextBoxColumn13"; this.dataGridViewTextBoxColumn13.MinimumWidth = 90; this.dataGridViewTextBoxColumn13.Name = "dataGridViewTextBoxColumn13"; this.dataGridViewTextBoxColumn13.ReadOnly = true; // // listView2 // this.listView2.FullRowSelect = true; this.listView2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; this.listView2.HideSelection = false; this.listView2.Location = new System.Drawing.Point(16, 56); this.listView2.Name = "listView2"; this.listView2.Size = new System.Drawing.Size(180, 132); this.listView2.TabIndex = 22; this.listView2.UseCompatibleStateImageBehavior = false; this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged); // // button4 // this.button4.AutoEllipsis = true; this.button4.Location = new System.Drawing.Point(111, 20); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(86, 26); this.button4.TabIndex = 1; this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.button4_Click); // // button2 // this.button2.AutoEllipsis = true; this.button2.Location = new System.Drawing.Point(15, 20); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(86, 26); this.button2.TabIndex = 0; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // // GrayironDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScroll = true; this.ClientSize = new System.Drawing.Size(1215, 944); this.Controls.Add(this.groupBox9); this.Controls.Add(this.groupBox8); this.Controls.Add(this.groupBox7); this.Controls.Add(this.groupBox6); this.Controls.Add(this.groupBox5); this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Name = "GrayironDialog"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InclusionsStandardDialog_FormClosing); this.Load += new System.EventHandler(this.GrainSizeDialog_Load); this.Shown += new System.EventHandler(this.ShownChoiseItemAndInitData); this.Controls.SetChildIndex(this.groupBox1, 0); this.Controls.SetChildIndex(this.groupBox2, 0); this.Controls.SetChildIndex(this.groupBox4, 0); this.Controls.SetChildIndex(this.groupBox5, 0); this.Controls.SetChildIndex(this.groupBox6, 0); this.Controls.SetChildIndex(this.groupBox7, 0); this.Controls.SetChildIndex(this.groupBox8, 0); this.Controls.SetChildIndex(this.groupBox9, 0); this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox4.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBar4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.trackBar3)).EndInit(); this.groupBox5.ResumeLayout(false); this.groupBox5.PerformLayout(); this.groupBox6.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pdnNumericUpDown5)).EndInit(); this.groupBox7.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.groupBox9.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pdnNumericUpDown6)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit(); this.ResumeLayout(false); } #endregion /// /// 主控件 /// private AppWorkspace appWorkspace; /// /// 公共按钮 /// private CommonControlButtons commonControlButtons; private int defaultIndex = -1; /// /// 1-灰铁GB/T 7216-2009,2-灰铁A247 /// private int type = 1; /// /// 保存窗口参数 /// /// /// 各个图片对应数据 /// private Dictionary eachData = new Dictionary(); private const string ParamKey_Report = "report";//报告设置 private const string ParamKey_Screen = "screen";//筛选 private const string ParamKey_ScreenMin = "screenMin";//面积最小值 private const string ParamKey_ScreenMax = "screenMax";//面积最大值 private const string ParamKey_MeasureSelect = "measureSelect";//显示测量的石墨颜色 private const string ParamKey_DifferentSelect = "differentSelect";//显示不同颜色 private const string ParamKey_MeasureColor = "peasureColor";//测量的石墨颜色 private const string ParamKey_Length = "length";//灰铁长度 private const string ParamKey_MeasureNumber = "measureNumber";//测量条数 private const string ParamKey_WholeNumber = "wholeNumber";//全部条数 private const string ParamKey_FibreLength = "fibreLength";//按照纤维长度测量 private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数 private decimal areaMin = -1;//面积区间最小 private decimal areaMax = -1;//面积区间最大 private bool isScriptExecution; public GrayironDialog(AppWorkspace appWorkspace, int type, PdnMenuItem menuItem) { this.menuId = menuItem.MenuId; this.menuName = menuItem.Text; binaryClass = new BinaryClass(menuId); this.appWorkspace = appWorkspace; this.type = type; NullKey(); InitializeComponent(); InitializeLanguageText(); InitGridHeader(); InitOtherTools(); InitPicList(); InitCommonButtonEvent(); AddPictureBoxEvent(); if (type == 1) { SetAnalyzeModelFromXml("Template.Manager.item3.GrayironGBT7216Length"); } else if (type == 2) { SetAnalyzeModelFromXml("Template.Manager.item3.GrayironA247"); } } public GrayironDialog() { } private void ShowImgEvent(object sender, EventArgs e) { listView1.Focus(); if (this.defaultIndex != -1) { this.listView1.Items[defaultIndex].Focused = true; this.listView1.Items[defaultIndex].Selected = true; //如果是脚本执行,将参数带入 if (appWorkspace.ScriptRunning && appWorkspace.ScriptCurrentParam != null) { this.initScriptValues = true;//ScriptAutomatic //Boolean initScriptValues = true; ////在这里反射出对应功能的参数类 string className = InvariantData.path_Action + ".Action" + menuId; ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className); foreach (Args arg in param.Lists) { Args param1 = appWorkspace.ScriptCurrentParam.Lists.Find(m => m.Key.Equals(arg.Key)); if (param1.value != null) arg.Value = param1.value; getValue(arg.key, arg.Value); } this.isScriptExecution = true; appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数 } else {//读取上次关闭窗口时保存的参数 GetXmlParameter(); GetListParamModel(); } if (this.initScriptValues && this.appWorkspace.ScriptAutomatic) this.startScriptAutomaticAction(); } } /// /// 初始化表头 /// private void InitGridHeader() { // //结果展示表 // this.dataGridView1.ColumnHeadersHeight = 50; DataGridViewTextBoxColumn h1 = new DataGridViewTextBoxColumn(); h1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; h1.Width = 66; DataGridViewTextBoxColumn h2 = new DataGridViewTextBoxColumn(); h2.Width = 138; DataGridViewTextBoxColumn h3 = new DataGridViewTextBoxColumn(); h3.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; h3.Width = 66; DataGridViewTextBoxColumn h4 = new DataGridViewTextBoxColumn(); h4.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; h4.Width = 66; // //分析结果表 // this.dataGridView2.ColumnHeadersHeight = 30; DataGridViewTextBoxColumn h5 = new DataGridViewTextBoxColumn(); h5.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; h5.Width = 115; DataGridViewTextBoxColumn h6 = new DataGridViewTextBoxColumn(); h6.Width = 155; DataGridViewTextBoxColumn h7 = new DataGridViewTextBoxColumn(); h7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; h7.Width = 190; DataGridViewTextBoxColumn h8 = new DataGridViewTextBoxColumn(); h8.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; h8.Width = 115; DataGridViewTextBoxColumn h9 = new DataGridViewTextBoxColumn(); h9.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; h9.Width = 115; // //左下表 // this.listView2.View = View.Details; ColumnHeader header0 = new ColumnHeader(); header0.Text = PdnResources.GetString("Menu.Imagelist.Text"); header0.Width = 175; this.listView2.Columns.Add(header0); } /// /// 初始化画布按键功能 /// private void InitCommonButtonEvent() { this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click); this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click); this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click); this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click); this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click); this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click); } private void mobileModeButton_Click(object sender, EventArgs e) { this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode; } private void pointerButton_Click(object sender, EventArgs e) { this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer; } private void actualSizeButton_Click(object sender, EventArgs e) { this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor; this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne; } private void zoomToWindowButton_Click(object sender, EventArgs e) { this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow; } private void zoomOutButton_Click(object sender, EventArgs e) { this.documentWorkspace.ZoomOut(); } private void zoomInButton_Click(object sender, EventArgs e) { this.documentWorkspace.ZoomIn(); } // //初始化图片列表数据 // public void InitPicList() { //初始化图片列表 for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++) { this.imageList1.Images.Add("img" + i, this.appWorkspace.DocumentWorkspaces[i].BinarizationThumbnail); this.listView1.Items.Add("", i); this.listView1.Items[i].ImageIndex = i; this.listView1.Items[i].Text = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName(); this.listView1.Items[i].Name = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName(); if (this.appWorkspace.DocumentWorkspaces[i].Equals(this.appWorkspace.ActiveDocumentWorkspace)) { defaultIndex = i; } } this.Shown += ShowImgEvent; } /// /// 图像索引切换选中事件 /// /// /// int sum;//判断是否二值过 private void listView1_SelectedIndexChanged(object sender, EventArgs e) { if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected) { //获取标尺-微米 unitLength1 = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron); //获取标尺-毫米 unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Millimeter); sum = 0; this.dataGridView1.Rows.Clear(); //this.documentWorkspace.PhaseModels.Clear(); this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList; isChanged = false; this.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat(); //二值化集成5 binaryClass.listView1_SelectedIndexChanged(this.imageMat.Clone(), this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]); this.documentWorkspace.Visible = true; this.commonControlButtons.Visible = true; isFirstSwitch = true; changeColor = false; if (sum == 0) { if (bcOriginChecked() || !bcBinaryChecked()) { this.documentWorkspace.PhaseModels[1].choise = false; } else { this.documentWorkspace.PhaseModels[1].choise = true; } ResetAreaAndContent(); ReloadDebrisSelection(); } else { if (bcOriginChecked() || !bcBinaryChecked()) { this.documentWorkspace.PhaseModels[1].choise = false; } else { this.documentWorkspace.PhaseModels[1].choise = true; } this.documentWorkspace.Refresh(); } sum = 0; GetListParamModel(); } } /// /// 刷新二值效果 /// private void ReLoadBinarization() { if (this.documentWorkspace.CompositionSurface == null) return; if (bcBinaryChecked()) { ResetAreaAndContent(); ReloadDebrisSelection(); } else { isFirstSwitch = false; this.dataGridView1.Rows.Clear(); } this.documentWorkspace.Refresh(); } /// /// 刷新其他信息 /// private void ResetAreaAndContent() { if (this.documentWorkspace.PhaseModels[0].mat != null && bcBinaryChecked()) { int n = 0; OpenCvSharp.Point[][] contours;//原始轮廓信息 HierarchyIndex[] hierachy; Mat tempCopy = BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat); Rect rectCopy; Cv2.FindContours(BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone); if (hierachy.Length > 0) { double maxArea = 0;//面积最大值 double minArea = 9999999999;//面积最小值 for (int i = 0; i < hierachy.Length; i++) { if (hierachy[i].Parent == -1) { n++; int lengthArea = Cv2.FloodFill(tempCopy, contours[i][0], new Scalar(0, 0, 0, 0), out rectCopy, null, null, FloodFillFlags.Link8); double area = lengthArea; if (maxArea < area) maxArea = area; if (minArea > area) minArea = area; } } if (!changeColor) { maxArea = maxArea * unitLength1 * unitLength1; minArea = minArea * unitLength1 * unitLength1; int maxNum = (int)Math.Ceiling(maxArea);//获取面积最大值 int minNum = (int)Math.Floor(minArea);//获取面积最小值 //先解绑事件以防数据赋值异常 this.numericUpDown3.ValueChanged -= numericUpDown3_ValueChanged; this.numericUpDown4.ValueChanged -= numericUpDown4_ValueChanged; this.trackBar3.Scroll -= trackBar3_Scroll; this.trackBar4.Scroll -= trackBar4_Scroll; this.numericUpDown3.Maximum = maxNum; this.numericUpDown3.Minimum = minNum; this.trackBar3.Maximum = maxNum; this.trackBar3.Minimum = minNum; this.numericUpDown4.Maximum = maxNum; this.numericUpDown4.Minimum = minNum; this.trackBar4.Maximum = maxNum; this.trackBar4.Minimum = minNum; this.numericUpDown3.Value = minNum; this.trackBar3.Value = minNum; this.numericUpDown4.Value = maxNum; this.trackBar4.Value = maxNum; if (areaMin != -1 && areaMin >= this.numericUpDown3.Minimum && areaMin <= this.numericUpDown4.Maximum) { trackBar3.Value = (int)areaMin; this.numericUpDown3.Value = areaMin; } if (areaMax != -1 && areaMax >= this.numericUpDown3.Value && areaMax <= this.numericUpDown4.Maximum) { trackBar4.Value = (int)areaMax; this.numericUpDown4.Value = areaMax; } this.numericUpDown3.ValueChanged += new EventHandler(numericUpDown3_ValueChanged); this.numericUpDown4.ValueChanged += new EventHandler(numericUpDown4_ValueChanged); this.trackBar3.Scroll += new EventHandler(trackBar3_Scroll); this.trackBar4.Scroll += new EventHandler(trackBar4_Scroll); } } this.pdnNumericUpDown5.Maximum = n; if (n <= 3) { this.pdnNumericUpDown5.Value = n; } else { this.pdnNumericUpDown5.Value = 3; } } } DataTable dtDataGridView1 = null; DataTable dtResult = null; AppCommon appCommon = new AppCommon(); /// /// 刷新颗粒筛选效果 /// private void ReloadDebrisSelection() { if (this.documentWorkspace != null && this.documentWorkspace.PhaseModels[0].mat != null) { this.dataGridView1.Rows.Clear(); dtDataGridView1 = new DataTable(); Mat mat = new Mat(); this.documentWorkspace.PhaseModels[0].mat.CopyTo(mat); pointList.Clear(); length.Clear(); List> ps = new List>();//轮廓的拓扑信息 if (this.documentWorkspace.GraphicsList.IsExsitView()) { List points = new List();//各石墨轮廓集合 List> lstAttribute = new List>();//各个视场属性集合,索引0-横坐标,1-纵坐标,2-视场宽度,3-视场高度,4-视场面积 int sumFieldl = 0; //视场个数 Mat tempCopy = BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat); //Rect rectCopy; //调用处理视场方法 appCommon.MultiFieldView(appWorkspace, this.documentWorkspace.PhaseModels[0].mat, listView1, documentWorkspace, out points, out lstAttribute, out sumFieldl); //记录上个视场个数 double sumNum1 = 0; double sumNum2 = 0; double sumNum3 = 0; double sumNum4 = 0; double sumNum5 = 0; double sumNum6 = 0; double sumNum7 = 0; double sumNum8 = 0; double Proportion1 = 0; double Proportion2 = 0; double Proportion3 = 0; double Proportion4 = 0; double Proportion5 = 0; double Proportion6 = 0; double Proportion7 = 0; double Proportion8 = 0; double sumGraphiteContent = 0; double sumGraphiteLength = 0; int h = 0; foreach (OpenCvSharp.Point[][] contours in points) { h++; di.Clear(); double sumArea = 0; double avgLength = 0; int graphiteNum = 0; int toNum = 0;//记录石墨总数 graphiteLevel = string.Empty; List wordBitmapList = new List(); List contoursList = new List(); List wordBitmapListValue = new List(); List wordBitmapList1 = new List(); List wordBitmapList2 = new List(); List wordBitmapList3 = new List(); List wordBitmapList4 = new List(); List wordBitmapList5 = new List(); List wordBitmapList6 = new List(); List wordBitmapList7 = new List(); List wordBitmapList8 = new List(); for (int i = 0; i < contours.Length; i++) { for (int f = 0; f < contours[i].Length; f++) { contours[i][f].X = contours[i][f].X + lstAttribute[h - 1][0]; contours[i][f].Y = contours[i][f].Y + lstAttribute[h - 1][1]; } int lengthArea = appCommon.Area(tempCopy, contours[i][0]); double area = lengthArea * unitLength1 * unitLength1; //double area = Math.Abs(Cv2.ContourArea(contours[i])) * unitLength1 * unitLength1; if (this.checkBox3.Checked) { if (area >= (this.trackBar3.Value) && area <= (this.trackBar4.Value)) { ps.Add(contours[i].ToList()); } else { pointList.Add(contours[i][contours[i].Count() - 1]); double are = 0;//石墨长度 if (this.radioButton4.Checked) { //计算最大卡规直径(长径) are = BasicCalculationHelper.CalcLongTrail(contours[i]) * 2 * unitLength1; } else if (this.radioButton3.Checked) { //计算纤维长度 double perimeter = contours[i].Length * unitLength1; are = (perimeter + Math.Sqrt(perimeter * perimeter - 16 * area / 1000000)) / 4; } di.Add(contours[i], are); String areas = Math.Round(are, 3).ToString(); length.Add(are.ToString()); if (checkBox5.Checked) { graphiteNum = di.Count(); wordBitmapList.Add(contours[i]); wordBitmapListValue.Add(are); sumArea += Math.Abs(Cv2.ContourArea(contours[i])); avgLength += BasicCalculationHelper.CalcLongTrail(contours[i]) * 2 * unitLength1; } else { graphiteNum = int.Parse(this.pdnNumericUpDown5.Value.ToString()); } } } else { //存入坐標點 pointList.Add(contours[i][contours[i].Count() - 1]); double are = 0;//石墨长度 if (this.radioButton4.Checked) { //计算最大卡规直径(长径) are = BasicCalculationHelper.CalcLongTrail(contours[i]) * 2 * unitLength1; } else if (this.radioButton3.Checked) { //计算纤维长度 double perimeter = contours[i].Length * unitLength1; are = (perimeter + Math.Sqrt(perimeter * perimeter - 16 * area / 1000000)) / 4; } //存入字典 di.Add(contours[i], are); //String areas = Math.Round(are, 3).ToString(); length.Add(are.ToString()); if (checkBox5.Checked) { graphiteNum = di.Count(); wordBitmapList.Add(contours[i]); wordBitmapListValue.Add(are); sumArea += Math.Abs(Cv2.ContourArea(contours[i])); avgLength += BasicCalculationHelper.CalcLongTrail(contours[i]) * 2 * unitLength1; } else { graphiteNum = int.Parse(this.pdnNumericUpDown5.Value.ToString()); } } } if (di != null && di.Count > 0) { var dictSort = from objDic in di orderby objDic.Value descending select objDic;//重新按key排序 int k = 0; foreach (KeyValuePair kvp in dictSort) { if (checkBox5.Checked) { if (radioButton1.Checked) { Mat[] arr = mat.Split(); mat = mat.CvtColor(ColorConversionCodes.BGRA2BGR); //int length1 = Cv2.FloodFill(mat, kvp.Key[0], new Scalar(this.panel2.BackColor.B, this.panel2.BackColor.G, this.panel2.BackColor.R), out rectCopy, null, null, FloodFillFlags.Link8); appCommon.DifferentColor(mat, kvp.Key[0], this.panel2.BackColor); Mat[] arr2 = mat.Split(); arr[0] = arr2[0]; arr[1] = arr2[1]; arr[2] = arr2[2]; Cv2.Merge(arr, mat); k++; if (k == dictSort.ToList().Count - 1) { break; } } } else { wordBitmapList.Add(kvp.Key); wordBitmapListValue.Add(kvp.Value); if (k < int.Parse(this.pdnNumericUpDown5.Value.ToString())) { sumArea += Math.Abs(Cv2.ContourArea(kvp.Key)); contoursList.Add(kvp.Key); avgLength += BasicCalculationHelper.CalcLongTrail(kvp.Key) * 2 * unitLength1; k++; } } } } graphiteContent = sumArea / lstAttribute[h - 1][4]; if (graphiteNum != 0) { graphiteLength = avgLength / graphiteNum; } else { graphiteLength = 0; } if (type == 1) { if (graphiteLength >= 1000) { graphiteLevel = "1"; } else if (graphiteLength >= 500 && graphiteLength < 1000) { graphiteLevel = "2"; } else if (graphiteLength >= 250 && graphiteLength < 500) { graphiteLevel = "3"; } else if (graphiteLength >= 120 && graphiteLength < 250) { graphiteLevel = "4"; } else if (graphiteLength >= 60 && graphiteLength < 120) { graphiteLevel = "5"; } else if (graphiteLength >= 30 && graphiteLength < 60) { graphiteLevel = "6"; } else if (graphiteLength > 15 && graphiteLength < 30) { graphiteLevel = "7"; } else if (graphiteLength > 0 && graphiteLength <= 15) { graphiteLevel = "8"; } else { graphiteLevel = "-"; } for (int i = 0; i < wordBitmapListValue.Count; i++) { toNum++; double level = wordBitmapListValue[i]; if (level >= 1000) { num1++; wordBitmapList1.Add(wordBitmapList[i]); } else if (level >= 500 && level < 1000) { num2++; wordBitmapList2.Add(wordBitmapList[i]); } else if (level >= 250 && level < 500) { num3++; wordBitmapList3.Add(wordBitmapList[i]); } else if (level >= 120 && level < 250) { num4++; wordBitmapList4.Add(wordBitmapList[i]); } else if (level >= 60 && level < 120) { num5++; wordBitmapList5.Add(wordBitmapList[i]); } else if (level >= 30 && level < 60) { num6++; wordBitmapList6.Add(wordBitmapList[i]); } else if (level > 15 && level < 30) { num7++; wordBitmapList7.Add(wordBitmapList[i]); } else if (level <= 15) { num8++; wordBitmapList8.Add(wordBitmapList[i]); } } } else if (type == 2) { if (graphiteLength >= 1280) { graphiteLevel = "1"; } else if (graphiteLength >= 640 && graphiteLength < 1280) { graphiteLevel = "2"; } else if (graphiteLength >= 320 && graphiteLength < 640) { graphiteLevel = "3"; } else if (graphiteLength >= 160 && graphiteLength < 320) { graphiteLevel = "4"; } else if (graphiteLength >= 80 && graphiteLength < 160) { graphiteLevel = "5"; } else if (graphiteLength >= 40 && graphiteLength < 80) { graphiteLevel = "6"; } else if (graphiteLength >= 20 && graphiteLength < 40) { graphiteLevel = "7"; } else if (graphiteLength > 0 && graphiteLength < 20) { graphiteLevel = "8"; } else { graphiteLevel = "-"; } for (int i = 0; i < wordBitmapListValue.Count; i++) { toNum++; double level = wordBitmapListValue[i]; if (level >= 1280) { num1++; wordBitmapList1.Add(wordBitmapList[i]); } else if (level >= 640 && level < 1280) { num2++; wordBitmapList2.Add(wordBitmapList[i]); } else if (level >= 320 && level < 640) { num3++; wordBitmapList3.Add(wordBitmapList[i]); } else if (level >= 160 && level < 320) { num4++; wordBitmapList4.Add(wordBitmapList[i]); } else if (level >= 80 && level < 160) { num5++; wordBitmapList5.Add(wordBitmapList[i]); } else if (level >= 40 && level < 80) { num6++; wordBitmapList6.Add(wordBitmapList[i]); } else if (level >= 20 && level < 40) { num7++; wordBitmapList7.Add(wordBitmapList[i]); } else if (level < 20) { num8++; wordBitmapList8.Add(wordBitmapList[i]); } } } if (radioButton1.Checked) { if (contoursList.Count > 0) { Mat[] arr = mat.Split(); mat = mat.CvtColor(ColorConversionCodes.BGRA2BGR); appCommon.DifferentColor(mat, contoursList, this.panel2.BackColor); Mat[] arr2 = mat.Split(); arr[0] = arr2[0]; arr[1] = arr2[1]; arr[2] = arr2[2]; Cv2.Merge(arr, mat); //Cv2.FillPoly(mat, wordBitmapList, new Scalar(this.panel2.BackColor.B, this.panel2.BackColor.G, this.panel2.BackColor.R, 255)); } } if (radioButton2.Checked) { Mat[] arr = mat.Split(); mat = mat.CvtColor(ColorConversionCodes.BGRA2BGR); if (GrayironDialog.setUpColor1.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList1, Color.Red); } else { appCommon.DifferentColor(mat, wordBitmapList1, setUpColor1); } if (GrayironDialog.setUpColor2.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList2, Color.Orange); } else { appCommon.DifferentColor(mat, wordBitmapList1, setUpColor2); } if (GrayironDialog.setUpColor3.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList3, Color.Yellow); } else { appCommon.DifferentColor(mat, wordBitmapList3, setUpColor3); } if (GrayironDialog.setUpColor4.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList4, Color.Green); } else { appCommon.DifferentColor(mat, wordBitmapList4, setUpColor4); } if (GrayironDialog.setUpColor5.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList5, Color.Blue); } else { appCommon.DifferentColor(mat, wordBitmapList5, setUpColor5); } if (GrayironDialog.setUpColor6.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList6, Color.GreenYellow); } else { appCommon.DifferentColor(mat, wordBitmapList6, setUpColor6); } if (GrayironDialog.setUpColor7.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList7, Color.Purple); } else { appCommon.DifferentColor(mat, wordBitmapList7, setUpColor7); } if (GrayironDialog.setUpColor8.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList8, Color.Pink); } else { appCommon.DifferentColor(mat, wordBitmapList8, setUpColor8); } Mat[] arr2 = mat.Split(); arr[0] = arr2[0]; arr[1] = arr2[1]; arr[2] = arr2[2]; Cv2.Merge(arr, mat); } if (toNum > 0) { this.dataGridView1.Rows.Add($"{PdnResources.GetString("Menu.view.text")}{h}", (num1 - sumNum1) / toNum, (num2 - sumNum2) / toNum, (num3 - sumNum3) / toNum, (num4 - sumNum4) / toNum, (num5 - sumNum5) / toNum, (num6 - sumNum6) / toNum, (num7 - sumNum7) / toNum, (num8 - sumNum8) / toNum, graphiteContent * 100, graphiteLength, graphiteLevel); Proportion1 += (num1 - sumNum1) / toNum; Proportion2 += (num2 - sumNum2) / toNum; Proportion3 += (num3 - sumNum3) / toNum; Proportion4 += (num4 - sumNum4) / toNum; Proportion5 += (num5 - sumNum5) / toNum; Proportion6 += (num6 - sumNum6) / toNum; Proportion7 += (num7 - sumNum7) / toNum; Proportion8 += (num8 - sumNum8) / toNum; sumNum1 = num1; sumNum2 = num2; sumNum3 = num3; sumNum4 = num4; sumNum5 = num5; sumNum6 = num6; sumNum7 = num7; sumNum8 = num8; sumGraphiteContent += graphiteContent; sumGraphiteLength += graphiteLength; } else { this.dataGridView1.Rows.Add($"{PdnResources.GetString("Menu.view.text")}{h}", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "-"); } } if (sumFieldl > 1) { double avgGraphiteContent = sumGraphiteContent / sumFieldl; double avgGraphiteLength = sumGraphiteLength / sumFieldl; string avgGraphiteLevel = string.Empty; if (type == 1) { if (avgGraphiteLength >= 1000) { avgGraphiteLevel = "1"; } else if (avgGraphiteLength > 500 && avgGraphiteLength < 1000) { avgGraphiteLevel = "2"; } else if (avgGraphiteLength >= 250 && avgGraphiteLength < 500) { avgGraphiteLevel = "3"; } else if (avgGraphiteLength >= 120 && avgGraphiteLength < 250) { avgGraphiteLevel = "4"; } else if (avgGraphiteLength >= 60 && avgGraphiteLength < 120) { avgGraphiteLevel = "5"; } else if (avgGraphiteLength >= 30 && avgGraphiteLength < 60) { avgGraphiteLevel = "6"; } else if (avgGraphiteLength > 15 && avgGraphiteLength < 30) { avgGraphiteLevel = "7"; } else if (avgGraphiteLength > 0 && avgGraphiteLength <= 15) { avgGraphiteLevel = "8"; } else { avgGraphiteLevel = "-"; } } else if (type == 2) { if (avgGraphiteLength >= 1280) { avgGraphiteLevel = "1"; } else if (avgGraphiteLength >= 640 && avgGraphiteLength < 1280) { avgGraphiteLevel = "2"; } else if (avgGraphiteLength >= 320 && avgGraphiteLength < 640) { avgGraphiteLevel = "3"; } else if (avgGraphiteLength >= 160 && avgGraphiteLength < 320) { avgGraphiteLevel = "4"; } else if (avgGraphiteLength >= 80 && avgGraphiteLength < 160) { avgGraphiteLevel = "5"; } else if (avgGraphiteLength >= 40 && avgGraphiteLength < 80) { avgGraphiteLevel = "6"; } else if (avgGraphiteLength >= 20 && avgGraphiteLength < 40) { avgGraphiteLevel = "7"; } else if (avgGraphiteLength > 0 && avgGraphiteLength < 20) { avgGraphiteLevel = "8"; } else { avgGraphiteLevel = "-"; } } this.dataGridView1.Rows.Add(PdnResources.GetString("Menu.Image.Average.Text"), Proportion1 / sumFieldl, Proportion2 / sumFieldl, Proportion3 / sumFieldl, Proportion4 / sumFieldl, Proportion5 / sumFieldl, Proportion6 / sumFieldl, Proportion7 / sumFieldl, Proportion8 / sumFieldl, 100 * avgGraphiteContent, avgGraphiteLength, avgGraphiteLevel); } } else { di.Clear(); OpenCvSharp.Point[][] contours;//原始轮廓信息 HierarchyIndex[] hierachy; Mat tempCopy = BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat); //Rect rectCopy; Cv2.FindContours(BinaryClass.BGRA2GRAY(this.documentWorkspace.PhaseModels[0].mat), out contours, out hierachy, RetrievalModes.CComp, ContourApproximationModes.ApproxNone); double sumArea = 0; double avgLength = 0; int graphiteNum = 0; int toNum = 0;//记录石墨总数 List wordBitmapList = new List(); List contoursList = new List(); List wordBitmapListValue = new List(); List wordBitmapList1 = new List(); List wordBitmapList2 = new List(); List wordBitmapList3 = new List(); List wordBitmapList4 = new List(); List wordBitmapList5 = new List(); List wordBitmapList6 = new List(); List wordBitmapList7 = new List(); List wordBitmapList8 = new List(); for (int i = 0; i < hierachy.Length; i++) { if (hierachy[i].Parent == -1) { //int lengthArea = Cv2.FloodFill(tempCopy, contours[i][0], new Scalar(0, 0, 0, 0), out rectCopy, null, null, FloodFillFlags.Link8); int lengthArea = appCommon.Area(tempCopy, contours[i][0]); double area = lengthArea * unitLength1 * unitLength1; //double area = Math.Abs(Cv2.ContourArea(contours[i])) * unitLength1 * unitLength1; if (this.checkBox3.Checked) { if (area >= (this.trackBar3.Value) && area <= (this.trackBar4.Value)) { ps.Add(contours[i].ToList()); } else { pointList.Add(contours[i][contours[i].Count() - 1]); double are = 0;//石墨长度 if (this.radioButton4.Checked) { //计算最大卡规直径(长径) are = BasicCalculationHelper.CalcLongTrail(contours[i]) * 2 * unitLength1; } else if (this.radioButton3.Checked) { //计算纤维长度 double perimeter = contours[i].Length * unitLength1; are = (perimeter + Math.Sqrt(perimeter * perimeter - 16 * area / 1000000)) / 4; } di.Add(contours[i], are); String areas = Math.Round(are, 3).ToString(); length.Add(are.ToString()); if (checkBox5.Checked) { graphiteNum = di.Count(); wordBitmapList.Add(contours[i]); wordBitmapListValue.Add(are); sumArea += Math.Abs(Cv2.ContourArea(contours[i])); avgLength += are; } else { graphiteNum = int.Parse(this.pdnNumericUpDown5.Value.ToString()); } } } else { //存入坐標點 pointList.Add(contours[i][contours[i].Count() - 1]); double are = 0;//石墨长度 if (this.radioButton4.Checked) { //计算最大卡规直径(长径) are = BasicCalculationHelper.CalcLongTrail(contours[i]) * 2 * unitLength1; } else if (this.radioButton3.Checked) { //计算纤维长度 double perimeter = contours[i].Length * unitLength1; are = (perimeter + Math.Sqrt(perimeter * perimeter - 16 * area / 1000000)) / 4; } //存入字典 di.Add(contours[i], are); String areas = Math.Round(are, 3).ToString(); length.Add(are.ToString()); if (checkBox5.Checked) { graphiteNum = di.Count(); wordBitmapList.Add(contours[i]); wordBitmapListValue.Add(are); sumArea += Math.Abs(Cv2.ContourArea(contours[i])); avgLength += are; } else { graphiteNum = int.Parse(this.pdnNumericUpDown5.Value.ToString()); } } } } if (di != null && di.Count > 0) { var dictSort = from objDic in di orderby objDic.Value descending select objDic;//重新按key排序 int k = 0; foreach (KeyValuePair kvp in dictSort) { if (checkBox5.Checked) { if (radioButton1.Checked) { Mat[] arr = mat.Split(); mat = mat.CvtColor(ColorConversionCodes.BGRA2BGR); //int length1 = Cv2.FloodFill(mat, kvp.Key[0], new Scalar(this.panel2.BackColor.B, this.panel2.BackColor.G, this.panel2.BackColor.R), out rectCopy, null, null, FloodFillFlags.Link8); appCommon.DifferentColor(mat, kvp.Key[0], this.panel2.BackColor); Mat[] arr2 = mat.Split(); arr[0] = arr2[0]; arr[1] = arr2[1]; arr[2] = arr2[2]; Cv2.Merge(arr, mat); k++; if (k == dictSort.ToList().Count) { break; } } } else { wordBitmapList.Add(kvp.Key); wordBitmapListValue.Add(kvp.Value); if (k < int.Parse(this.pdnNumericUpDown5.Value.ToString())) { sumArea += Math.Abs(Cv2.ContourArea(kvp.Key)); contoursList.Add(kvp.Key); avgLength += BasicCalculationHelper.CalcLongTrail(kvp.Key) * 2 * unitLength1; k++; } } } graphiteContent = sumArea / (this.imageMat.Width) / (this.imageMat.Height); if (graphiteNum != 0) { graphiteLength = avgLength / graphiteNum; } else { graphiteLength = 0; } if (type == 1) { if (graphiteLength >= 1000) { graphiteLevel = "1"; } else if (graphiteLength >= 500 && graphiteLength < 1000) { graphiteLevel = "2"; } else if (graphiteLength >= 250 && graphiteLength < 500) { graphiteLevel = "3"; } else if (graphiteLength >= 120 && graphiteLength < 250) { graphiteLevel = "4"; } else if (graphiteLength >= 60 && graphiteLength < 120) { graphiteLevel = "5"; } else if (graphiteLength >= 30 && graphiteLength < 60) { graphiteLevel = "6"; } else if (graphiteLength > 15 && graphiteLength < 30) { graphiteLevel = "7"; } else if (graphiteLength > 0 && graphiteLength <= 15) { graphiteLevel = "8"; } else { graphiteLevel = "-"; } for (int i = 0; i < wordBitmapListValue.Count; i++) { toNum++; double level = wordBitmapListValue[i]; if (level >= 1000) { num1++; wordBitmapList1.Add(wordBitmapList[i]); } else if (level >= 500 && level < 1000) { num2++; wordBitmapList2.Add(wordBitmapList[i]); } else if (level >= 250 && level < 500) { num3++; wordBitmapList3.Add(wordBitmapList[i]); } else if (level >= 120 && level < 250) { num4++; wordBitmapList4.Add(wordBitmapList[i]); } else if (level >= 60 && level < 120) { num5++; wordBitmapList5.Add(wordBitmapList[i]); } else if (level >= 30 && level < 60) { num6++; wordBitmapList6.Add(wordBitmapList[i]); } else if (level > 15 && level < 30) { num7++; wordBitmapList7.Add(wordBitmapList[i]); } else if (level <= 15) { num8++; wordBitmapList8.Add(wordBitmapList[i]); } } } else if (type == 2) { if (graphiteLength >= 1280) { graphiteLevel = "1"; } else if (graphiteLength >= 640 && graphiteLength < 1280) { graphiteLevel = "2"; } else if (graphiteLength >= 320 && graphiteLength < 640) { graphiteLevel = "3"; } else if (graphiteLength >= 160 && graphiteLength < 320) { graphiteLevel = "4"; } else if (graphiteLength >= 80 && graphiteLength < 160) { graphiteLevel = "5"; } else if (graphiteLength >= 40 && graphiteLength < 80) { graphiteLevel = "6"; } else if (graphiteLength >= 20 && graphiteLength < 40) { graphiteLevel = "7"; } else if (graphiteLength > 0 && graphiteLength < 20) { graphiteLevel = "8"; } else { graphiteLevel = "-"; } for (int i = 0; i < wordBitmapListValue.Count; i++) { toNum++; double level = wordBitmapListValue[i]; if (level >= 1280) { num1++; wordBitmapList1.Add(wordBitmapList[i]); } else if (level >= 640 && level < 1280) { num2++; wordBitmapList2.Add(wordBitmapList[i]); } else if (level >= 320 && level < 640) { num3++; wordBitmapList3.Add(wordBitmapList[i]); } else if (level >= 160 && level < 320) { num4++; wordBitmapList4.Add(wordBitmapList[i]); } else if (level >= 80 && level < 160) { num5++; wordBitmapList5.Add(wordBitmapList[i]); } else if (level >= 40 && level < 80) { num6++; wordBitmapList6.Add(wordBitmapList[i]); } else if (level >= 20 && level < 40) { num7++; wordBitmapList7.Add(wordBitmapList[i]); } else if (level < 20) { num8++; wordBitmapList8.Add(wordBitmapList[i]); } } } if (radioButton1.Checked) { if (contoursList.Count > 0) { Mat[] arr = mat.Split(); mat = mat.CvtColor(ColorConversionCodes.BGRA2BGR); appCommon.DifferentColor(mat, contoursList, this.panel2.BackColor); Mat[] arr2 = mat.Split(); arr[0] = arr2[0]; arr[1] = arr2[1]; arr[2] = arr2[2]; Cv2.Merge(arr, mat); } } if (radioButton2.Checked) { Mat[] arr = mat.Split(); mat = mat.CvtColor(ColorConversionCodes.BGRA2BGR); if (GrayironDialog.setUpColor1.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList1, Color.Red); } else { appCommon.DifferentColor(mat, wordBitmapList1, setUpColor1); } if (GrayironDialog.setUpColor2.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList2, Color.Orange); } else { appCommon.DifferentColor(mat, wordBitmapList1, setUpColor2); } if (GrayironDialog.setUpColor3.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList3, Color.Yellow); } else { appCommon.DifferentColor(mat, wordBitmapList3, setUpColor3); } if (GrayironDialog.setUpColor4.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList4, Color.Green); } else { appCommon.DifferentColor(mat, wordBitmapList4, setUpColor4); } if (GrayironDialog.setUpColor5.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList5, Color.Blue); } else { appCommon.DifferentColor(mat, wordBitmapList5, setUpColor5); } if (GrayironDialog.setUpColor6.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList6, Color.GreenYellow); } else { appCommon.DifferentColor(mat, wordBitmapList6, setUpColor6); } if (GrayironDialog.setUpColor7.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList7, Color.Purple); } else { appCommon.DifferentColor(mat, wordBitmapList7, setUpColor7); } if (GrayironDialog.setUpColor8.IsEmpty) { appCommon.DifferentColor(mat, wordBitmapList8, Color.Pink); } else { appCommon.DifferentColor(mat, wordBitmapList8, setUpColor8); } Mat[] arr2 = mat.Split(); arr[0] = arr2[0]; arr[1] = arr2[1]; arr[2] = arr2[2]; Cv2.Merge(arr, mat); } } if (pointList.Count > 0) { this.dataGridView1.Rows.Add(PdnResources.GetString("Menu.view.text")+"1", (double)num1/ toNum, (double)num2 / toNum, (double)num3 / toNum, (double)num4 / toNum, (double)num5 / toNum, (double)num6 / toNum, (double)num7 / toNum, (double)num8 / toNum, graphiteContent * 100, graphiteLength, graphiteLevel); } } Cv2.FillPoly(mat, ps, new Scalar(0, 0, 0, 0)); this.documentWorkspace.PhaseModels[0].choise = false; this.documentWorkspace.PhaseModels[1].mat = mat; //if (pointList.Count <= 3) //{ // this.pdnNumericUpDown5.Maximum = 3; //} //else //{ //} this.documentWorkspace.Refresh(); //数据结果保存 dtDataGridView1 = appCommon.ResultDataSaving(dataGridView1); string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName(); string tag = this.imageList1.Images.Keys[this.listView1.FocusedItem.Index]; //dtResult = new DataTable(tag); //分析数据保存 dtResult = appCommon.AnalysisDataSaving(dataGridView1, imgName, tag); if (dtDataGridView1.Rows.Count > 0) { RefreshDataGridView1(); } if (bcOriginChecked()) { appCommon.DisplayData(this.dataGridView1, false); } } } /// /// 刷新数据展示表 /// private void RefreshDataGridView1() { this.dataGridView1.Rows.Clear(); if (dtDataGridView1 != null && dtDataGridView1.Rows.Count > 0) { dataGridView1.Rows.Add(dtDataGridView1.Rows.Count);//增加同等数量的行数 int i = 0; foreach (DataRow row in dtDataGridView1.Rows)//逐个读取单元格的内容; { DataGridViewRow r1 = dataGridView1.Rows[i]; r1.Cells[0].Value = row.RowState.ToString(); for (int j = 0; j < dtDataGridView1.Columns.Count; j++) { if (j == 0 || j == 11) { r1.Cells[j].Value = row[j].ToString(); } else { r1.Cells[j].Value = Math.Round(double.Parse(string.IsNullOrEmpty(row[j].ToString()) ? "0" : row[j].ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)); } } i++; } this.num1 = 0; this.num2 = 0; this.num3 = 0; this.num4 = 0; this.num5 = 0; this.num6 = 0; this.num7 = 0; this.num8 = 0; } } /// /// 添加内容单元格 /// /// /// /// private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag) { DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell(); textboxcell.Value = text; textboxcell.Tag = tag; return textboxcell; } private void colorsForm1Changed(object sender, EventArgs e) { binaryClass.SetBinaryBackColor(this.colorsForm1.UserPrimaryColor.ToColor()); this.colorsForm1.Close(); changeColor = true; ReLoadBinarization(); this.documentWorkspace.Refresh(); } /// /// 颗粒筛选范围最小值 /// /// /// private void trackBar3_Scroll(object sender, EventArgs e) { this.numericUpDown3.Value = this.trackBar3.Value; } /// /// 颗粒筛选范围最大值 /// /// /// private void trackBar4_Scroll(object sender, EventArgs e) { this.numericUpDown4.Value = this.trackBar4.Value; } //测量标准 private void radioButton3_CheckedChanged(object sender, EventArgs e) { ReloadDebrisSelection(); } /// /// 是否筛选 /// /// /// private void checkBox3_CheckedChanged(object sender, EventArgs e) { if (this.documentWorkspace.CompositionSurface == null) return; if (bcBinaryChecked()/* && this.checkBox3.Checked*/) { ReloadDebrisSelection(); changeColor = false; //if (!bcOriginChecked()) //{ // if (bcBinaryChecked()) // { // this.documentWorkspace.PhaseModels[0].choise = false; // this.documentWorkspace.PhaseModels[1].choise = true; // } //} } //else if (bcBinaryChecked()/* && !this.checkBox3.Checked*/) //{ // changeColor = false; // ReLoadBinarization(); // if (!bcOriginChecked()) // { // if (bcBinaryChecked()) // { // this.documentWorkspace.PhaseModels[0].choise = false; // this.documentWorkspace.PhaseModels[1].choise = true; // } // } //} //this.documentWorkspace.Refresh(); } /// /// 添加画布绑定事件 /// private void AddPictureBoxEvent() { this.documentWorkspace.panel.Paint += new PaintEventHandler(this.BoxPaintHandler); } /// /// 绘制事件 /// /// /// private void BoxPaintHandler(object sender, PaintEventArgs e) { if (this.documentWorkspace.CompositionSurface != null) { Rectangle rc = this.documentWorkspace.panel.ClientRectangle; int width = (int)(this.documentWorkspace.CompositionSurface.Width * this.documentWorkspace.ScaleFactor.Ratio); int height = (int)(this.documentWorkspace.CompositionSurface.Height * this.documentWorkspace.ScaleFactor.Ratio); int x = (rc.Width < width) ? this.documentWorkspace.panel.AutoScrollPosition.X : (rc.Width - width) / 2; int y = (rc.Height < height) ? this.documentWorkspace.panel.AutoScrollPosition.Y : (rc.Height - height) / 2; e.Graphics.TranslateTransform(x, y); e.Graphics.ScaleTransform((float)this.documentWorkspace.ScaleFactor.Ratio, (float)this.documentWorkspace.ScaleFactor.Ratio); Draw(e.Graphics); e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio); e.Graphics.TranslateTransform(-x, -y); } } /// /// 绘制 /// private void Draw(Graphics graphics) { graphics.SmoothingMode = SmoothingMode.AntiAlias; Pen rectPen = new Pen(Color.Black); rectPen.DashStyle = DashStyle.Custom; float[] dashArray = { 2.0f, 3.0f }; rectPen.DashPattern = dashArray; if (pointList.Count > 0 && pointList != null) { if (checkBox4.Checked && !bcOriginChecked() && bcBinaryChecked()) { for (int i = 0; i < pointList.Count; i++) { if (!(length[i].Equals("0"))) { if (fontSize != null && fontColor != null) { String a = Math.Round(double.Parse(length[i]),int.Parse(pdnNumericUpDown6.Value.ToString())).ToString(); graphics.DrawString(a, new Font("宋体", Convert.ToSingle(fontSize), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(fontColor), pointList[i].X, pointList[i].Y); } else { String a = Math.Round(double.Parse(length[i]), int.Parse(pdnNumericUpDown6.Value.ToString())).ToString(); graphics.DrawString(a, new Font("宋体", Convert.ToSingle(fontSize), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))), new SolidBrush(fontColor), pointList[i].X, pointList[i].Y); } } } } } rectPen.Dispose(); } /// /// 按照最大卡规直径测量 /// /// /// private void checkBox4_CheckedChanged(object sender, EventArgs e) { if (this.documentWorkspace != null) { this.documentWorkspace.Refresh(); } } private void button8_Click(object sender, EventArgs e) { ChangeParameter changeParameter = new ChangeParameter(); changeParameter.StartPosition = FormStartPosition.CenterScreen; changeParameter.ShowDialog(this); this.documentWorkspace.Refresh(); } private void panel2_Click(object sender, EventArgs e) { this.colorsForm2.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor); this.colorsForm2.ShowDialog(); } private void colorsForm2Changed(object sender, EventArgs e) { this.panel2.BackColor = this.colorsForm2.UserPrimaryColor.ToColor(); this.colorsForm2.Close(); changeColor = true; ReLoadBinarization(); this.documentWorkspace.Refresh(); } private void pdnNumericUpDown5_ValueChanged(object sender, EventArgs e) { if (bcBinaryChecked()) ReloadDebrisSelection(); //else if (bcBinaryChecked() & !this.checkBox3.Checked) //{ // changeColor = false; // ReLoadBinarization(); //} this.documentWorkspace.PhaseModels[1].choise = true; //this.documentWorkspace.Refresh(); } private void radioButton1_CheckedChanged(object sender, EventArgs e) { if (radioButton1.Checked && this.documentWorkspace != null) { if (bcBinaryChecked() && this.checkBox3.Checked) ReloadDebrisSelection(); else if (bcBinaryChecked() && !this.checkBox3.Checked) { changeColor = false; ReloadDebrisSelection(); } this.documentWorkspace.PhaseModels[1].choise = true; this.documentWorkspace.Refresh(); } } private void checkBox5_CheckedChanged(object sender, EventArgs e) { if (bcBinaryChecked() && this.checkBox3.Checked) ReloadDebrisSelection(); else if (bcBinaryChecked() && !this.checkBox3.Checked) { changeColor = false; ReloadDebrisSelection(); } this.documentWorkspace.PhaseModels[1].choise = true; this.documentWorkspace.Refresh(); } private void button7_Click(object sender, EventArgs e) { ChangeColor changeColor1 = new ChangeColor(); changeColor1.StartPosition = FormStartPosition.CenterScreen; changeColor1.ShowDialog(this); if (bcBinaryChecked() && this.checkBox3.Checked) ReloadDebrisSelection(); else if (bcBinaryChecked() && !this.checkBox3.Checked) { changeColor = false; ReLoadBinarization(); } this.documentWorkspace.Refresh(); } private void radioButton2_CheckedChanged(object sender, EventArgs e) { if (radioButton2.Checked && this.documentWorkspace != null) { if (bcBinaryChecked() && this.checkBox3.Checked) ReloadDebrisSelection(); else if (bcBinaryChecked() && !this.checkBox3.Checked) { changeColor = false; ReloadDebrisSelection(); } this.documentWorkspace.PhaseModels[1].choise = true; this.documentWorkspace.Refresh(); } } private void pdnNumericUpDown6_ValueChanged(object sender, EventArgs e) { //if (bcBinaryChecked() && this.checkBox3.Checked) // ReloadDebrisSelection(); //else if (bcBinaryChecked() && !this.checkBox3.Checked) //{ // changeColor = false; // ReLoadBinarization(); //} RefreshDataGridView1(); RefreshDataGridView2(); this.documentWorkspace.Refresh(); } /// /// 设置按钮 /// /// /// private void button1_Click(object sender, EventArgs e) { AnalyzeSettingDialog metallographicMethodSetDialog = null; if (type == 1) { metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.GrayironGBT7216Length"); } else if (type == 2) { metallographicMethodSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.GrayironA247"); } if (metallographicMethodSetDialog.hasModule) { metallographicMethodSetDialog.StartPosition = FormStartPosition.CenterScreen; metallographicMethodSetDialog.ShowDialog(); } else { metallographicMethodSetDialog = null; } } DialogResult dr; /// /// 保存结果按钮 /// /// /// private void button3_Click(object sender, EventArgs e) { if (this.listView1.SelectedItems.Count > 0) { string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName(); string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index]; bool replace = false; int rowIndex = 0; if (this.dataGridView1.Rows.Count > 0) { if (this.listView2.Items.Count > 0) { foreach (ListViewItem item in this.listView2.Items) { if (!blSaveAll && item.Name.Equals(tag)) { dr = MessageBox.Show(PdnResources.GetString("Menu.Theanalysisreertoreplaceit.text") + "?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); break; } } foreach (ListViewItem item in this.listView2.Items) { if (item.Name.Equals(tag)) { if (dr == DialogResult.OK || blSaveAll) { replace = true; } else { return; } break; } } } //有重名需要替换 if (replace) { for (int i = 0; i < this.resultTableList.Count; i++) { if (this.resultTableList[i].TableName.Equals(tag)) { rowIndex = i; this.resultTableList.Remove(this.resultTableList[i]); if (this.pointList.Count > 0) { resultTableList.Insert(rowIndex, dtResult); } } } } //新增 else { ListViewItem listViewItem = new ListViewItem(); listViewItem.Name = tag; listViewItem.SubItems[0].Text = imgName; this.listView2.Items.Add(listViewItem); this.listView2.SelectedItems.Clear(); this.listView2.Items[this.listView2.Items.Count - 1].Selected = true; if (this.pointList.Count > 0) { resultTableList.Insert(rowIndex, dtResult); } } RefreshDataGridView2(); //保存处理后的图片 double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数 List tempBit = new List(); Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap(); originalBit.Tag = pantographRatio; tempBit.Add(originalBit); Bitmap processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[1].mat); Bitmap newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat); Graphics graphics = Graphics.FromImage(newBit); graphics.DrawImage(processedBit, new PointF(0, 0)); newBit.Tag = pantographRatio; tempBit.Add(newBit); if (bitDic.ContainsKey(tag)) bitDic[tag] = tempBit; else bitDic.Add(tag, tempBit); //拼接中间数据 List> dataList = new List>(); List columnName = new List(); columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text")); columnName.Add(PdnResources.GetString("Menu.Graphitelength.text")); columnName.Add(PdnResources.GetString("Menu.unit.text")+"/mm"); dataList.Add(columnName); List list = di.Values.ToList(); if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { List strList = new List(); strList.Add((i + 1).ToString()); strList.Add((list[i]).ToString()); strList.Add("mm"); dataList.Add(strList); } } bool isExist = false;//是否已存在进行替换 int modelIndex = -1;//要替换的下标 for (int j = 0; j < tempDataModel.Count; j++) { if (tempDataModel[j].tagName.Equals(tag)) { isExist = true; modelIndex = j; break; } } if (isExist && modelIndex > -1) tempDataModel[modelIndex].dataList = dataList; else { ExportProjectModel newModel = new ExportProjectModel(); newModel.tagName = tag; newModel.picName = imgName; newModel.dataList = dataList; tempDataModel.Add(newModel); } } else { MessageBox.Show(PdnResources.GetString("Menu.Noinformationtosave.text")); } } else { MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapictaurefirst.Text")); } } /// /// 刷新分析结果表 /// private void RefreshDataGridView2() { //需要计算平均值的集合 List lstNum1 = new List(); List lstNum2 = new List(); List lstNum3 = new List(); List lstNum4 = new List(); List lstNum5 = new List(); List lstNum6 = new List(); List lstNum7 = new List(); List lstNum8 = new List(); List lstContent = new List(); List lstLength = new List(); //综合平均值 double avglstNum1 = 0; double avglstNum2 = 0; double avglstNum3 = 0; double avglstNum4 = 0; double avglstNum5 = 0; double avglstNum6 = 0; double avglstNum7 = 0; double avglstNum8 = 0; double avglstContent = 0; double avglstLength = 0; if (resultTableList.Count > 0) { dataGridView2.Rows.Clear(); dataGridView3.Rows.Clear(); if (this.showAll) { //dataGridView2.Rows.Clear(); int i = 0; for (int k = 0; k < resultTableList.Count; k++) { dataGridView2.Rows.Add(resultTableList[k].Rows.Count);//增加同等数量的行数 foreach (DataRow row in resultTableList[k].Rows)//逐个读取单元格的内容; { DataGridViewRow r1 = dataGridView2.Rows[i]; r1.Cells[0].Value = row.RowState.ToString(); for (int j = 0; j < resultTableList[k].Columns.Count; j++) { if (j == 0 || j == 1 || j == 12) { r1.Cells[j].Value = row[j].ToString(); } else { r1.Cells[j].Value = Math.Round(double.Parse(string.IsNullOrEmpty(row[j].ToString()) ? "0" : row[j].ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)); } //r1.Cells[j].Value = row[j]; if (!row[1].Equals(PdnResources.GetString("Menu.Image.Average.Text"))) { if (j == 2) { lstNum1.Add(double.Parse(row[j].ToString())); } if (j == 3) { lstNum2.Add(double.Parse(row[j].ToString())); } if (j == 4) { lstNum3.Add(double.Parse(row[j].ToString())); } if (j == 5) { lstNum4.Add(double.Parse(row[j].ToString())); } if (j == 6) { lstNum5.Add(double.Parse(row[j].ToString())); } if (j == 7) { lstNum6.Add(double.Parse(row[j].ToString())); } if (j == 8) { lstNum7.Add(double.Parse(row[j].ToString())); } if (j == 9) { lstNum8.Add(double.Parse(row[j].ToString())); } if (j == 10) { lstContent.Add(double.Parse(row[j].ToString())); } if (j == 11) { lstLength.Add(double.Parse(row[j].ToString())); } } } i++; } } } else { //dataGridView2.Rows.Clear(); if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0) { int h = 0; for (int i = 0; i < this.listView2.SelectedItems.Count; i++) { string tableName = this.listView2.SelectedItems[i].Name; foreach (DataTable dt in resultTableList) { if (dt.TableName.Equals(tableName)) { dataGridView2.Rows.Add(dt.Rows.Count);//增加同等数量的行数 foreach (DataRow row in dt.Rows)//逐个读取单元格的内容; { DataGridViewRow r1 = dataGridView2.Rows[h]; r1.Cells[0].Value = row.RowState.ToString(); for (int j = 0; j < dt.Columns.Count; j++) { if (j == 0 || j == 1 || j == 12) { r1.Cells[j].Value = row[j].ToString(); } else { r1.Cells[j].Value = Math.Round(double.Parse(string.IsNullOrEmpty(row[j].ToString()) ? "0" : row[j].ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)); } //r1.Cells[j].Value = row[j]; if (!row[1].Equals(PdnResources.GetString("Menu.Image.Average.Text"))) { if (j == 2) { lstNum1.Add(double.Parse(row[j].ToString())); } if (j == 3) { lstNum2.Add(double.Parse(row[j].ToString())); } if (j == 4) { lstNum3.Add(double.Parse(row[j].ToString())); } if (j == 5) { lstNum4.Add(double.Parse(row[j].ToString())); } if (j == 6) { lstNum5.Add(double.Parse(row[j].ToString())); } if (j == 7) { lstNum6.Add(double.Parse(row[j].ToString())); } if (j == 8) { lstNum7.Add(double.Parse(row[j].ToString())); } if (j == 9) { lstNum8.Add(double.Parse(row[j].ToString())); } if (j == 10) { lstContent.Add(double.Parse(row[j].ToString())); } if (j == 11) { lstLength.Add(double.Parse(row[j].ToString())); } } } h++; } } } } } } if (dataGridView2.Rows.Count > 0) { if (lstNum1.Count > 0) { avglstNum1 = (double)lstNum1.Average(); } if (lstNum2.Count > 0) { avglstNum2 = (double)lstNum2.Average(); } if (lstNum3.Count > 0) { avglstNum3 = (double)lstNum3.Average(); } if (lstNum4.Count > 0) { avglstNum4 = (double)lstNum4.Average(); } if (lstNum5.Count > 0) { avglstNum5 = (double)lstNum5.Average(); } if (lstNum6.Count > 0) { avglstNum6 = (double)lstNum6.Average(); } if (lstNum7.Count > 0) { avglstNum7 = (double)lstNum7.Average(); } if (lstNum8.Count > 0) { avglstNum8 = (double)lstNum8.Average(); } if (lstContent.Count > 0) { avglstContent = (double)lstContent.Average(); } if (lstLength.Count > 0) { avglstLength = (double)lstLength.Average(); } string avgLevel = string.Empty; if (type == 1) { if (avglstLength >= 1000) { avgLevel = "1"; } else if (avglstLength >= 500 && avglstLength < 1000) { avgLevel = "2"; } else if (avglstLength >= 250 && avglstLength < 500) { avgLevel = "3"; } else if (avglstLength >= 120 && avglstLength < 250) { avgLevel = "4"; } else if (avglstLength >= 60 && avglstLength < 120) { avgLevel = "5"; } else if (avglstLength >= 30 && avglstLength < 60) { avgLevel = "6"; } else if (avglstLength > 15 && avglstLength < 30) { avgLevel = "7"; } else if (avglstLength > 0 && avglstLength <= 15) { avgLevel = "8"; } else { avgLevel = "-"; } } else if (type == 2) { if (avglstLength >= 1280) { avgLevel = "1"; } else if (avglstLength >= 640 && avglstLength < 1280) { avgLevel = "2"; } else if (avglstLength >= 320 && avglstLength < 640) { avgLevel = "3"; } else if (avglstLength >= 160 && avglstLength < 320) { avgLevel = "4"; } else if (avglstLength >= 80 && avglstLength < 160) { avgLevel = "5"; } else if (avglstLength >= 40 && avglstLength < 80) { avgLevel = "6"; } else if (avglstLength >= 20 && avglstLength < 40) { avgLevel = "7"; } else if (avglstLength > 0 && avglstLength < 20) { avgLevel = "8"; } else { avgLevel = "-"; } } this.dataGridView3.Rows.Add(PdnResources.GetString("Menu.comprehensive.text"), PdnResources.GetString("Menu.Comprehensivaverage.text"), Math.Round(double.Parse(string.IsNullOrEmpty(avglstNum1.ToString()) ? "0" : avglstNum1.ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglstNum2.ToString()) ? "0" : avglstNum2.ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglstNum3.ToString()) ? "0" : avglstNum3.ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglstNum4.ToString()) ? "0" : avglstNum4.ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglstNum5.ToString()) ? "0" : avglstNum5.ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglstNum6.ToString()) ? "0" : avglstNum6.ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglstNum7.ToString()) ? "0" : avglstNum7.ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglstNum8.ToString()) ? "0" : avglstNum8.ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglstContent.ToString()) ? "0" : avglstContent.ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)), Math.Round(double.Parse(string.IsNullOrEmpty(avglstLength.ToString()) ? "0" : avglstLength.ToString()), Convert.ToInt32(this.pdnNumericUpDown6.Value)), avgLevel); } } else { dataGridView2.Rows.Clear(); dataGridView3.Rows.Clear(); } } /// /// 全部显示按钮 /// /// /// private void button2_Click(object sender, EventArgs e) { if (this.button2.Text == PdnResources.GetString("Menu.Showall.text")) { this.button2.Text = PdnResources.GetString("Menu.Cancelshowall.text"); this.showAll = true; RefreshDataGridView2(); } else if (this.button2.Text == PdnResources.GetString("Menu.Cancelshowall.text")) { this.button2.Text = PdnResources.GetString("Menu.Showall.text"); this.showAll = false; RefreshDataGridView2(); } } /// /// 删除按钮 /// /// /// private void button4_Click(object sender, EventArgs e) { if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0) { DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Determineallanalysisrlete.text")+"?", PdnResources.GetString("Menu.alert.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { for (int i = 0; i < this.listView2.SelectedItems.Count; i++) { string tableName = this.listView2.SelectedItems[i].Name; foreach (DataTable dt in resultTableList) { if (dt.TableName.Equals(tableName)) { resultTableList.Remove(dt); break; } } if (bitDic.ContainsKey(tableName)) bitDic.Remove(tableName); } foreach (ListViewItem item in this.listView2.Items) { if (item.Selected) this.listView2.Items.Remove(item); } RefreshDataGridView2(); } } } /// /// 分析结果列表选择切换 /// /// /// private void listView2_SelectedIndexChanged(object sender, EventArgs e) { if (this.showAll) return; RefreshDataGridView2(); } /// /// 生成报告按钮 /// /// /// private void button5_Click(object sender, EventArgs e) { if (dataGridView2.Rows.Count == 0) { MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text")+"!"); return; } if (this.checkBox1.Checked) this.button1.PerformClick(); if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify)) { //获取word书签与excel单元格的关系,以字典方式存储 List mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify); Dictionary tagInfos = new Dictionary(); 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> analysisContent = new List>(); List contentHead = new List(); contentHead.Add(PdnResources.GetString("Menu.picture.Text")); contentHead.Add(PdnResources.GetString("Menu.view.text")); contentHead.Add(PdnResources.GetString("Menu.Level1.text")); contentHead.Add(PdnResources.GetString("Menu.Level2.text")); contentHead.Add(PdnResources.GetString("Menu.Level3.text")); contentHead.Add(PdnResources.GetString("Menu.Level4.text")); contentHead.Add(PdnResources.GetString("Menu.Level5.text")); contentHead.Add(PdnResources.GetString("Menu.Level6.text")); contentHead.Add(PdnResources.GetString("Menu.Level7.text")); contentHead.Add(PdnResources.GetString("Menu.Level8.text")); contentHead.Add(PdnResources.GetString("Menu.Graphitecontent.text")); contentHead.Add(PdnResources.GetString("Menu.Graphitelength.text")); contentHead.Add(PdnResources.GetString("Menu.levdel.Text")); analysisContent.Add(contentHead); foreach (DataGridViewRow item in this.dataGridView2.Rows) { List content = new List(); content.Add(item.Cells[0].Value.ToString()); content.Add(item.Cells[1].Value.ToString()); content.Add(item.Cells[2].Value.ToString()); content.Add(item.Cells[3].Value.ToString()); content.Add(item.Cells[4].Value.ToString()); content.Add(item.Cells[5].Value.ToString()); content.Add(item.Cells[6].Value.ToString()); content.Add(item.Cells[7].Value.ToString()); content.Add(item.Cells[8].Value.ToString()); content.Add(item.Cells[9].Value.ToString()); content.Add(item.Cells[10].Value.ToString()); content.Add(item.Cells[11].Value.ToString()); content.Add(item.Cells[12].Value.ToString()); analysisContent.Add(content); } analysisContent.Add(new List() { "\r" }); foreach (DataGridViewRow item in this.dataGridView3.Rows) { List content = new List(); content.Add(item.Cells[0].Value.ToString()); content.Add(item.Cells[1].Value.ToString()); content.Add(item.Cells[2].Value.ToString()); content.Add(item.Cells[3].Value.ToString()); content.Add(item.Cells[4].Value.ToString()); content.Add(item.Cells[5].Value.ToString()); content.Add(item.Cells[6].Value.ToString()); content.Add(item.Cells[7].Value.ToString()); content.Add(item.Cells[8].Value.ToString()); content.Add(item.Cells[9].Value.ToString()); content.Add(item.Cells[10].Value.ToString()); content.Add(item.Cells[11].Value.ToString()); content.Add(item.Cells[12].Value.ToString()); analysisContent.Add(content); } //图片 bitList = new List(); if (this.showAll) { foreach (KeyValuePair> kv in this.bitDic) { bitList.Add(kv.Value[0]); bitList.Add(kv.Value[1]); } } else { if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0) { foreach (ListViewItem item in this.listView2.SelectedItems) { if (bitDic.ContainsKey(item.Name)) { bitList.Add(bitDic[item.Name][0]); bitList.Add(bitDic[item.Name][1]); } } } } this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos); } else MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!"); } /// /// 导出结果按钮 /// /// /// private void button6_Click(object sender, EventArgs e) { if (this.dataGridView2.Rows.Count > 0) { SaveFileDialog exe = new SaveFileDialog(); exe.Filter = "Execl files (*.xlsx)|*.xlsx"; exe.FilterIndex = 0; exe.RestoreDirectory = true; //exe.CreatePrompt = true; exe.Title = "Export Excel File"; exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); if (type == 1) { exe.FileName = PdnResources.GetString("Menu.Grayironlengthanalysisresults.Text") + DateTime.Now.ToString("yyyyMMddHHmmss"); } else if (type == 2) { exe.FileName = PdnResources.GetString("Menu.Graphitelength.text") + "(A247-16a)" + DateTime.Now.ToString("yyyyMMddHHmmss"); } DialogResult dr = exe.ShowDialog(); if (dr != DialogResult.OK) return; DataTable dtb = new DataTable(); dtb.Columns.Add(PdnResources.GetString("Menu.picture.Text")); dtb.Columns.Add(PdnResources.GetString("Menu.view.text")); dtb.Columns.Add(PdnResources.GetString("Menu.Level1.text")); dtb.Columns.Add(PdnResources.GetString("Menu.Level2.text")); dtb.Columns.Add(PdnResources.GetString("Menu.Level3.text")); dtb.Columns.Add(PdnResources.GetString("Menu.Level4.text")); dtb.Columns.Add(PdnResources.GetString("Menu.Level5.text")); dtb.Columns.Add(PdnResources.GetString("Menu.Level6.text")); dtb.Columns.Add(PdnResources.GetString("Menu.Level7.text")); dtb.Columns.Add(PdnResources.GetString("Menu.Level8.text")); dtb.Columns.Add(PdnResources.GetString("Menu.Graphitecontent.text")); dtb.Columns.Add(PdnResources.GetString("Menu.Graphitelength.text")); dtb.Columns.Add(PdnResources.GetString("Menu.levdel.Text")); for (int i = 0; i < this.dataGridView2.Rows.Count; i++) { DataRow dataRow = dtb.NewRow(); dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView2.Rows[i].Cells[0].Value; dataRow[PdnResources.GetString("Menu.view.text")] = this.dataGridView2.Rows[i].Cells[1].Value; dataRow[PdnResources.GetString("Menu.Level1.text")] = this.dataGridView2.Rows[i].Cells[2].Value; dataRow[PdnResources.GetString("Menu.Level2.text")] = this.dataGridView2.Rows[i].Cells[3].Value; dataRow[PdnResources.GetString("Menu.Level3.text")] = this.dataGridView2.Rows[i].Cells[4].Value; dataRow[PdnResources.GetString("Menu.Level4.text")] = this.dataGridView2.Rows[i].Cells[5].Value; dataRow[PdnResources.GetString("Menu.Level5.text")] = this.dataGridView2.Rows[i].Cells[6].Value; dataRow[PdnResources.GetString("Menu.Level6.text")] = this.dataGridView2.Rows[i].Cells[7].Value; dataRow[PdnResources.GetString("Menu.Level7.text")] = this.dataGridView2.Rows[i].Cells[8].Value; dataRow[PdnResources.GetString("Menu.Level8.text")] = this.dataGridView2.Rows[i].Cells[9].Value; dataRow[PdnResources.GetString("Menu.Graphitecontent.text")] = this.dataGridView2.Rows[i].Cells[10].Value; dataRow[PdnResources.GetString("Menu.Graphitelength.text")] = this.dataGridView2.Rows[i].Cells[11].Value; dataRow[PdnResources.GetString("Menu.levdel.Text")] = this.dataGridView2.Rows[i].Cells[12].Value; dtb.Rows.Add(dataRow); } for (int i = 0; i < this.dataGridView3.Rows.Count; i++) { DataRow dataRow = dtb.NewRow(); dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView3.Rows[i].Cells[0].Value; dataRow[PdnResources.GetString("Menu.view.text")] = this.dataGridView3.Rows[i].Cells[1].Value; dataRow[PdnResources.GetString("Menu.Level1.text")] = this.dataGridView3.Rows[i].Cells[2].Value; dataRow[PdnResources.GetString("Menu.Level2.text")] = this.dataGridView3.Rows[i].Cells[3].Value; dataRow[PdnResources.GetString("Menu.Level3.text")] = this.dataGridView3.Rows[i].Cells[4].Value; dataRow[PdnResources.GetString("Menu.Level4.text")] = this.dataGridView3.Rows[i].Cells[5].Value; dataRow[PdnResources.GetString("Menu.Level5.text")] = this.dataGridView3.Rows[i].Cells[6].Value; dataRow[PdnResources.GetString("Menu.Level6.text")] = this.dataGridView3.Rows[i].Cells[7].Value; dataRow[PdnResources.GetString("Menu.Level7.text")] = this.dataGridView3.Rows[i].Cells[8].Value; dataRow[PdnResources.GetString("Menu.Level8.text")] = this.dataGridView3.Rows[i].Cells[9].Value; dataRow[PdnResources.GetString("Menu.Graphitecontent.text")] = this.dataGridView3.Rows[i].Cells[10].Value; dataRow[PdnResources.GetString("Menu.Graphitelength.text")] = this.dataGridView3.Rows[i].Cells[11].Value; dataRow[PdnResources.GetString("Menu.levdel.Text")] = this.dataGridView3.Rows[i].Cells[12].Value; dtb.Rows.Add(dataRow); } //DataTable dtb1 = new DataTable(); //dtb1.Columns.Add(PdnResources.GetString("Menu.picture.Text")); //dtb1.Columns.Add(PdnResources.GetString("Menu.view.text")); //dtb1.Columns.Add(PdnResources.GetString("Menu.Level1.text")); //dtb1.Columns.Add(PdnResources.GetString("Menu.Level2.text")); //dtb1.Columns.Add(PdnResources.GetString("Menu.Level3.text")); //dtb1.Columns.Add(PdnResources.GetString("Menu.Level4.text")); //dtb1.Columns.Add(PdnResources.GetString("Menu.Level5.text")); //dtb1.Columns.Add(PdnResources.GetString("Menu.Level6.text")); //dtb1.Columns.Add(PdnResources.GetString("Menu.Level7.text")); //dtb1.Columns.Add(PdnResources.GetString("Menu.Level8.text")); //dtb1.Columns.Add(PdnResources.GetString("Menu.Graphitecontent.text")); //dtb1.Columns.Add(PdnResources.GetString("Menu.Graphitelength.text")); //dtb1.Columns.Add(PdnResources.GetString("Menu.levdel.Text")); //for (int i = 0; i < this.dataGridView3.Rows.Count; i++) //{ // DataRow dataRow = dtb1.NewRow(); // dataRow[PdnResources.GetString("Menu.picture.Text")] = this.dataGridView3.Rows[i].Cells[0].Value; // dataRow[PdnResources.GetString("Menu.view.text")] = this.dataGridView3.Rows[i].Cells[1].Value; // dataRow[PdnResources.GetString("Menu.Level1.text")] = this.dataGridView3.Rows[i].Cells[2].Value; // dataRow[PdnResources.GetString("Menu.Level2.text")] = this.dataGridView3.Rows[i].Cells[3].Value; // dataRow[PdnResources.GetString("Menu.Level3.text")] = this.dataGridView3.Rows[i].Cells[4].Value; // dataRow[PdnResources.GetString("Menu.Level4.text")] = this.dataGridView3.Rows[i].Cells[5].Value; // dataRow[PdnResources.GetString("Menu.Level5.text")] = this.dataGridView3.Rows[i].Cells[6].Value; // dataRow[PdnResources.GetString("Menu.Level6.text")] = this.dataGridView3.Rows[i].Cells[7].Value; // dataRow[PdnResources.GetString("Menu.Level7.text")] = this.dataGridView3.Rows[i].Cells[8].Value; // dataRow[PdnResources.GetString("Menu.Level8.text")] = this.dataGridView3.Rows[i].Cells[9].Value; // dataRow[PdnResources.GetString("Menu.Graphitecontent.text")] = this.dataGridView3.Rows[i].Cells[10].Value; // dataRow[PdnResources.GetString("Menu.Graphitelength.text")] = this.dataGridView3.Rows[i].Cells[11].Value; // dataRow[PdnResources.GetString("Menu.levdel.Text")] = this.dataGridView3.Rows[i].Cells[12].Value; // dtb1.Rows.Add(dataRow); //} List list = new List(); list.Add(dtb); //list.Add(dtb1); this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true); } else MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text")+"!"); } /// /// 颗粒筛选范围最小值 /// /// /// private void numericUpDown3_ValueChanged(object sender, EventArgs e) { if (this.numericUpDown3.Value > this.numericUpDown4.Value) this.numericUpDown3.Value = this.numericUpDown4.Value; this.trackBar3.Value = Convert.ToInt32(this.numericUpDown3.Value); areaMin = this.numericUpDown3.Value; areaMax = this.numericUpDown4.Value; if (this.checkBox3.Checked && bcBinaryChecked()) ReloadDebrisSelection(); } /// /// 颗粒筛选范围最大值 /// /// /// private void numericUpDown4_ValueChanged(object sender, EventArgs e) { if (this.numericUpDown4.Value < this.numericUpDown3.Value) this.numericUpDown4.Value = this.numericUpDown3.Value; this.trackBar4.Value = Convert.ToInt32(this.numericUpDown4.Value); areaMin = this.numericUpDown3.Value; areaMax = this.numericUpDown4.Value; if (this.checkBox3.Checked && bcBinaryChecked()) ReloadDebrisSelection(); } /// /// 导出项目 /// /// /// private void button9_Click(object sender, EventArgs e) { if (dataGridView2.Rows.Count == 0) { MessageBox.Show(PdnResources.GetString("Menu.Noanalysineratereport.text")+"!"); return; } if (this.checkBox1.Checked) this.button1.PerformClick(); if (this.analyzeSettingModel != null && !string.IsNullOrEmpty(this.analyzeSettingModel.analyzeClassify)) { Instrument.ProjectEngineering.NodeItem nodeItem = this.appWorkspace.GetInsertProjectPath(2, "Menu.DedicatedAnalysis.BlackMetal.GrayIron.Text", this.analyzeSettingModel.savePath); if (nodeItem == null) return; //获取word书签与excel单元格的关系,以字典方式存储 List mic_module_infos = mic_module_infos_BLL.FindAll().FindAll(a => a.analyze_classify == this.analyzeSettingModel.analyzeClassify); Dictionary tagInfos = new Dictionary(); 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> analysisContent = new List>(); List contentHead = new List(); contentHead.Add(PdnResources.GetString("Menu.picture.Text")); contentHead.Add(PdnResources.GetString("Menu.view.text")); contentHead.Add(PdnResources.GetString("Menu.Level1.text")); contentHead.Add(PdnResources.GetString("Menu.Level2.text")); contentHead.Add(PdnResources.GetString("Menu.Level3.text")); contentHead.Add(PdnResources.GetString("Menu.Level4.text")); contentHead.Add(PdnResources.GetString("Menu.Level5.text")); contentHead.Add(PdnResources.GetString("Menu.Level6.text")); contentHead.Add(PdnResources.GetString("Menu.Level7.text")); contentHead.Add(PdnResources.GetString("Menu.Level8.text")); contentHead.Add(PdnResources.GetString("Menu.Graphitecontent.text")); contentHead.Add(PdnResources.GetString("Menu.Graphitelength.text")); contentHead.Add(PdnResources.GetString("Menu.levdel.Text")); analysisContent.Add(contentHead); foreach (DataGridViewRow item in this.dataGridView2.Rows) { List content = new List(); content.Add(item.Cells[0].Value.ToString()); content.Add(item.Cells[1].Value.ToString()); content.Add(item.Cells[2].Value.ToString()); content.Add(item.Cells[3].Value.ToString()); content.Add(item.Cells[4].Value.ToString()); content.Add(item.Cells[5].Value.ToString()); content.Add(item.Cells[6].Value.ToString()); content.Add(item.Cells[7].Value.ToString()); content.Add(item.Cells[8].Value.ToString()); content.Add(item.Cells[9].Value.ToString()); content.Add(item.Cells[10].Value.ToString()); content.Add(item.Cells[11].Value.ToString()); content.Add(item.Cells[12].Value.ToString()); analysisContent.Add(content); } analysisContent.Add(new List() { "\r" }); foreach (DataGridViewRow item in this.dataGridView3.Rows) { List content = new List(); content.Add(item.Cells[0].Value.ToString()); content.Add(item.Cells[1].Value.ToString()); content.Add(item.Cells[2].Value.ToString()); content.Add(item.Cells[3].Value.ToString()); content.Add(item.Cells[4].Value.ToString()); content.Add(item.Cells[5].Value.ToString()); content.Add(item.Cells[6].Value.ToString()); content.Add(item.Cells[7].Value.ToString()); content.Add(item.Cells[8].Value.ToString()); content.Add(item.Cells[9].Value.ToString()); content.Add(item.Cells[10].Value.ToString()); content.Add(item.Cells[11].Value.ToString()); content.Add(item.Cells[12].Value.ToString()); analysisContent.Add(content); } //图片 bitList = new List(); if (this.showAll) { foreach (KeyValuePair> kv in this.bitDic) { bitList.Add(kv.Value[0]); bitList.Add(kv.Value[1]); } } else { if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0) { foreach (ListViewItem item in this.listView2.SelectedItems) { if (bitDic.ContainsKey(item.Name)) { bitList.Add(bitDic[item.Name][0]); bitList.Add(bitDic[item.Name][1]); } } } } this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, nodeItem.path, nodeItem.code); //保存项目信息到数据库 this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, nodeItem); } else MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!"); } #region 参数保存及提取 /// /// 保存参数的key,value和type /// /// /// /// private void saveParamValue(string param_key, string param_value, int param_type) { bool foundItem = false; if (!this.eachData.ContainsKey(GetImgKey())) { GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel(); analysisItem.menuId = this.menuId; analysisItem.param_key = param_key; analysisItem.param_type = param_type; analysisItem.param_value = param_value; analysisItem.setValue(); analysisItem.ListParam = new List(); analysisItem.ListParam.Add(analysisItem); this.eachData.Add(GetImgKey(), analysisItem); } foreach (var item in this.eachData[GetImgKey()].ListParam) { if (item.param_key.Equals(param_key) && item.menuId == this.menuId) { item.param_value = param_value; item.setValue(); foundItem = true; break; } } if (!foundItem) { GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel(); analysisItem.menuId = this.menuId; analysisItem.param_key = param_key; analysisItem.param_type = param_type; analysisItem.param_value = param_value; analysisItem.setValue(); this.eachData[GetImgKey()].ListParam.Add(analysisItem); } } /// /// 保存界面中的参数到model /// private void saveDialogParamValues() { saveParamValue(ParamKey_Report, checkBox1.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//报告设置 saveParamValue(ParamKey_Screen, checkBox3.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//筛选 saveParamValue(ParamKey_ScreenMin, numericUpDown3 != null ? numericUpDown3.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//面积最小值 saveParamValue(ParamKey_ScreenMax, numericUpDown4 != null ? numericUpDown4.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//面积最大值 saveParamValue(ParamKey_MeasureSelect, radioButton1.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//显示测量的石墨颜色 saveParamValue(ParamKey_DifferentSelect, radioButton2.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//显示不同颜色 saveParamValue(ParamKey_MeasureColor, panel2 != null ? panel2.BackColor.ToArgb().ToString() : " ", (int)PaintDotNet.Base.Dtryt.Color);//测量的石墨颜色 saveParamValue(ParamKey_Length, checkBox4.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//灰铁长度 saveParamValue(ParamKey_MeasureNumber, pdnNumericUpDown5 != null ? pdnNumericUpDown5.Value.ToString() : " ", (int)PaintDotNet.Base.Dtryt.Decimal);//测量条数 saveParamValue(ParamKey_WholeNumber, checkBox5.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//全部条数 saveParamValue(ParamKey_FibreLength, radioButton3.Checked ? "0" : "1", (int)PaintDotNet.Base.Dtryt.Boolean);//按照纤维长度测量 saveParamValue(ParamKey_DecimalPlace, pdnNumericUpDown6 != null ? pdnNumericUpDown6.Value.ToString() : "", (int)PaintDotNet.Base.Dtryt.Decimal);//保留小数位数 } /// /// 获取保存的参数 /// private void GetListParamModel() { if (this.eachData.ContainsKey(GetImgKey()) && this.eachData[GetImgKey()] != null) { for (int i = 0; i < this.eachData[GetImgKey()].ListParam.Count; i++) { switch (this.eachData[GetImgKey()].ListParam[i].param_key) { case ParamKey_Report: checkBox1.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value; break; case ParamKey_Screen: checkBox3.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value; break; case ParamKey_ScreenMin: areaMin = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].value.ToString()); break; case ParamKey_ScreenMax: areaMax = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].value.ToString()); break; case ParamKey_MeasureSelect: radioButton1.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value; break; case ParamKey_DifferentSelect: radioButton2.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value; break; case ParamKey_MeasureColor: panel2.BackColor = Color.FromArgb((int)this.eachData[GetImgKey()].ListParam[i].value); break; case ParamKey_Length: checkBox4.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value; break; case ParamKey_MeasureNumber: pdnNumericUpDown5.Value = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].value.ToString()); break; case ParamKey_WholeNumber: checkBox5.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value; break; case ParamKey_FibreLength: radioButton3.Checked = (Boolean)this.eachData[GetImgKey()].ListParam[i].value; break; case ParamKey_DecimalPlace: pdnNumericUpDown6.Value = decimal.Parse(this.eachData[GetImgKey()].ListParam[i].value.ToString()); break; } } } } /// /// 获取XML保存的参数 /// private void GetXmlParameter() { string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml"; GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open)); for (int i = 0; i < listView1.Items.Count; i++) { if (this.eachData.ContainsKey(listView1.Items[i].Index.ToString())) { this.eachData[listView1.Items[i].Index.ToString()] = analysisModelXml.cloneListParamModel(this.menuId); } else { this.eachData.Add(listView1.Items[i].Index.ToString(), analysisModelXml.cloneListParamModel(this.menuId)); } } foreach (var item in this.eachData[GetImgKey()].ListParam) item.setValue(); } /// /// 保存参数,防止没有图片 /// private void NullKey() { GrainSizeAnalysisModel grainsizeanalysismodel = new GrainSizeAnalysisModel(); grainsizeanalysismodel.ListParam = new List(); this.eachData.Add("null", grainsizeanalysismodel); } private string GetImgKey() { string key = this.listView1.FocusedItem != null ? this.listView1.FocusedItem.Index.ToString() : "null"; return key; } #endregion private void button11_Click(object sender, EventArgs e) { if (this.listView1.FocusedItem == null) { return; } binaryClass.saveParams(); binaryClass.applyToAll(this.imageList1.Images.Keys, this.imageList1.Images.Keys[int.Parse(GetImgKey())]); saveDialogParamValues(); GrainSizeAnalysisModel data = new GrainSizeAnalysisModel(); if (eachData.ContainsKey(GetImgKey())) { data = eachData[GetImgKey()]; } for (int i = 0; i < listView1.Items.Count; i++) { eachData[i.ToString()] = data.cloneListParamModel(this.menuId); this.listView1.EnsureVisible(i); this.listView1.Items[i].Focused = true; this.listView1.Items[i].Selected = true; } } private bool blSaveAll = false; private void button10_Click(object sender, EventArgs e) { if (this.listView1.FocusedItem == null) { return; } if (eachData.Count - 1 != listView1.Items.Count) { MessageBox.Show("请先点击应用全部!"); return; } saveDialogParamValues(); int current = int.Parse(GetImgKey()); for (int i = 0; i < listView1.Items.Count; i++) { this.listView1.EnsureVisible(i); this.listView1.Items[i].Focused = true; this.listView1.Items[i].Selected = true; this.button3.PerformClick(); blSaveAll = true; } this.listView1.EnsureVisible(current); this.listView1.Items[current].Focused = true; this.listView1.Items[current].Selected = true; blSaveAll = false; } private void listView1_MouseDown(object sender, MouseEventArgs e) { if (this.listView1.FocusedItem != null) saveDialogParamValues(); } #region [脚本相关] private void getValue(string key, object value) { switch (key) { case "parameter1": checkBox3.Checked = Convert.ToBoolean(value); break; case "parameter2": int min = Convert.ToInt32(value); decimal minDec = Convert.ToDecimal(value); if (bcBinaryChecked()) { if (trackBar3.Minimum > min || trackBar3.Maximum < min) { trackBar3.Value = trackBar3.Minimum; } else { trackBar3.Value = min; } if (numericUpDown3.Minimum > min || numericUpDown3.Maximum < min) { numericUpDown3.Value = numericUpDown3.Minimum; } else { numericUpDown3.Value = minDec; } } break; case "parameter3": int max = Convert.ToInt32(value); decimal maxDec = Convert.ToDecimal(value); if (bcBinaryChecked()) { if (trackBar4.Minimum > max || trackBar4.Maximum < max) { trackBar4.Value = trackBar4.Maximum; } else { trackBar4.Value = max; } if (numericUpDown4.Minimum > max || numericUpDown4.Maximum < max) { numericUpDown4.Value = numericUpDown4.Maximum; } else { numericUpDown4.Value = maxDec; } } break; case "parameter4": radioButton1.Checked = Convert.ToBoolean(value); break; case "parameter5": int val1 = (int)value; panel2.BackColor = Color.FromArgb(val1); break; case "parameter6": radioButton2.Checked = Convert.ToBoolean(value); break; case "parameter7": fontSize = value.ToString(); break; case "parameter8": fontColor = Color.FromArgb(Convert.ToInt32(value)); break; case "parameter9": setUpColor1 = Color.FromArgb(Convert.ToInt32(value)); break; case "parameter10": setUpColor2 = Color.FromArgb(Convert.ToInt32(value)); break; case "parameter11": setUpColor3 = Color.FromArgb(Convert.ToInt32(value)); break; case "parameter12": setUpColor4 = Color.FromArgb(Convert.ToInt32(value)); break; case "parameter13": setUpColor5 = Color.FromArgb(Convert.ToInt32(value)); break; case "parameter14": setUpColor6 = Color.FromArgb(Convert.ToInt32(value)); break; case "parameter24": setUpColor7 = Color.FromArgb(Convert.ToInt32(value)); break; case "parameter25": setUpColor8 = Color.FromArgb(Convert.ToInt32(value)); break; case "parameter20": var val = Convert.ToDecimal(value); if (val < pdnNumericUpDown5.Minimum || val > pdnNumericUpDown5.Maximum) { pdnNumericUpDown5.Value = pdnNumericUpDown5.Maximum; } else { pdnNumericUpDown5.Value = Convert.ToDecimal(value); } break; case "parameter21": checkBox5.Checked = Convert.ToBoolean(value); break; case "parameter22": radioButton3.Checked = Convert.ToBoolean(value); break; case "parameter23": if (!radioButton3.Checked) { radioButton3.Checked = Convert.ToBoolean(value); } break; case "parameter26": radioButton2.Checked = Convert.ToBoolean(value); break; case "OpenWhileExportReport": checkBox1.Checked = Convert.ToBoolean(value); break; case "CalculatorDecimalDigits": pdnNumericUpDown6.Value = Convert.ToDecimal(value); break; case "ExportResults": isExportResults = Convert.ToBoolean(value); break; case "ExportReports": isExportReports = Convert.ToBoolean(value); break; case "ExportProjects": isExportProjects = Convert.ToBoolean(value); break; } } private void startScriptAutomaticAction() { this.button11.PerformClick(); this.button10.PerformClick(); this.button2.Text = PdnResources.GetString("Menu.Cancelshowall.text"); this.showAll = true; RefreshDataGridView2(); if (isExportResults)//导出结果 this.button6.PerformClick(); if (isExportReports)//生成报告 this.button5.PerformClick(); if (isExportProjects)//导出项目 this.button9.PerformClick(); this.appWorkspace.ScriptAutomatic = false; this.Close(); } #endregion #region [脚本录制] private void getScriptRecording() { string className = InvariantData.path_Action + ".Action" + menuId; ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className); List args = param.Lists; foreach (var item in args) { item.value = setScriptRecording(item.key); } //找出二值相关参数 进行赋值 List isNullList = args.Where(m => m.value == null).ToList(); foreach (var item in isNullList) { item.value = binaryClass.setScriptRecording(item.key); } appWorkspace.SetScriptStartRecording(this.menuId, menuName, args); } private object setScriptRecording(string key) { object value = null; switch (key) { case "parameter1": value = checkBox3.Checked; break; case "parameter2": value = trackBar3.Value; break; case "parameter3": value = trackBar4.Value; break; case "parameter4": value = radioButton1.Checked; break; case "parameter5": value = panel2.BackColor.ToArgb(); break; case "parameter6": value = checkBox4.Checked; break; case "parameter7": value = fontSize; break; case "parameter8": value = fontColor.ToArgb(); break; case "parameter9": value = setUpColor1.ToArgb(); break; case "parameter10": value = setUpColor2.ToArgb(); break; case "parameter11": value = setUpColor3.ToArgb(); break; case "parameter12": value = setUpColor4.ToArgb(); break; case "parameter13": value = setUpColor5.ToArgb(); break; case "parameter14": value = setUpColor6.ToArgb(); break; case "parameter24": value = setUpColor7.ToArgb(); break; case "parameter25": value = setUpColor8.ToArgb(); break; case "parameter20": value = pdnNumericUpDown5.Value; break; case "parameter21": value = checkBox5.Checked; break; case "parameter22": value = radioButton3.Checked; break; case "parameter23": value = radioButton4.Checked; break; case "parameter26": value = radioButton2.Checked; break; case "OpenWhileExportReport": value = checkBox1.Checked; break; case "CalculatorDecimalDigits": value = pdnNumericUpDown6.Value; break; case "ExportResults": value = isExportResults; break; case "ExportReports": value = isExportReports; break; case "ExportProjects": value = isExportProjects; break; } return value; } #endregion } }