using Microsoft.Win32;
using PaintDotNet.Annotation;
using PaintDotNet.Annotation.Enum;
using PaintDotNet.Annotation.Label;
using PaintDotNet.Base.CommTool;
using PaintDotNet.Base.SettingModel;
using PaintDotNet.CustomControl;
using PaintDotNet.GeneralAnalysis.AnalysisResultTemplate;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static PaintDotNet.Base.SettingModel.LabelStyleModel;
using SaveFileDialog = System.Windows.Forms.SaveFileDialog;
using PaintDotNet.DbOpreate.DbBll;
using PaintDotNet.DbOpreate.DbModel;
using PaintDotNet.Base.Functionodel;
using OpenCvSharp;
using Point = System.Drawing.Point;
using PaintDotNet.Instrument;
using OpenCvSharp.Extensions;
using static PaintDotNet.Base.DedicatedAnalysis.Inclusions.MethodOfAssessment;
using System.Collections;
using Metis.ParameterSet;
using PaintDotNet.Data.Param;
using PaintDotNet.Base;
namespace PaintDotNet.GeneralAnalysis
{
///
/// 计数统计
///
internal class CountNumberAnalysisDialog : PdnBaseForm
{
#region 控件
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox_review;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.GroupBox groupBox7;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.ImageList imageList1;
private GroupBox groupBox3;
private DataGridView dataGridView_results;
private Button button5;
private GroupBox groupBox8;
private DataGridView dataGridView1;
private Label label2;
private RadioButton rb_LeftSquare;
private RadioButton rb_LeftCircle;
private Label label5;
private TextBox txt_LeftSize;
private Label label4;
private TextBox txt_LeftLineWeight;
private Label label6;
private Label label7;
private TextBox txt_RightLineWeight;
private Label label8;
private TextBox txt_RightSize;
private Label label9;
private RadioButton rb_RightSquare;
private RadioButton rb_RightCircle;
private Label label11;
private GroupBox groupBox9;
private RadioButton rb_RightFill;
private GroupBox groupBox10;
private RadioButton rb_leftNoFill;
private RadioButton rb_leftFill;
private Panel panel2;
private Panel panel1;
private Button But_DelPhase;
private Button but_AddPhase;
private Button but_Clear;
private NumericUpDown numericUpDown1;
private Label label3;
private Label label10;
private IContainer components;
#endregion
///
/// 选中图片的mat
///
private Mat imageMat;
private Dictionary documentItems;
///
/// 选中图片的bitmap
///
private Bitmap workmap;
///
/// 是否全部显示
///
private bool allShow = false;
///
/// 主空间
///
private AppWorkspace appWorkspace;
///
/// 中间数据
///
private List tempDataModel = new List();
///
/// 图像面板
///
private DocumentWorkspaceWindow documentWorkspace;
private DrawAnalysisModel leftStyle, rightStyle;
private int leftNumber, rightNumber;
private List activeResults;
private List allResults;
private List finalViewResults;
private int selectIndex;
private bool isFirstClick = true;
private bool isDoubleClick = false;
private int milliseconds = 0;
private Timer clickTimer;
private ColorsForm colorsFormGrid;
private ColorsForm halfColorsFormGrid;
///
/// 1 面积 2 面积比 3
///
private int workType = 0;
private int decnum = 2;
BindingSource bindingSource = new BindingSource();
private GeneralAnalysisCommonControlButtons commonControlButtons;
///
/// 书签分类名
///
private string analyzeClassify;
private List bitList = new List();
private Button button6;
private DataGridViewTextBoxColumn Column5;
private DataGridViewTextBoxColumn Column1;
private DataGridViewTextBoxColumn Column8;
private DataGridViewTextBoxColumn Column9;
private DataGridViewTextBoxColumn Column10;
private DataGridViewTextBoxColumn Column11;
private ListView listView2;
private Button button16;
private Button button11;
private Button button12;
private NumericUpDown numericUpDown3;
private NumericUpDown numericUpDown2;
private NumericUpDown numericUpDown5;
private NumericUpDown numericUpDown4;
private Dictionary> bitDic = new Dictionary>();
private Dictionary> bitDic1 = new Dictionary>();
///
/// 所有截点
///
public List> p1RectangleFs = new List>();
public List> p2RectangleFs = new List>();
private DataGridViewTextBoxColumn Column2;
private DataGridViewTextBoxColumn Column3;
private DataGridViewTextBoxColumn Column4;
private DataGridViewTextBoxColumn Column6;
private DataGridViewTextBoxColumn Column7;
private int mutuallyIndex = 1;
private int defaultIndex = -1;
private RadioButton rb_RightNoFill;
private GeneralAnalysisModel generalAnalysisModel = new GeneralAnalysisModel();
private Dictionary everyImgData = new Dictionary();
private string selectedImg = string.Empty;
private int menuId;
private string menuName;
///
/// 是否脚本运行
///
private Boolean initScriptValues = false;
public CountNumberAnalysisDialog()
{
InitializeComponent();
}
public CountNumberAnalysisDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem)
{
InitializeComponent();
InitializeLanguageText();
this.colorsFormGrid = new ColorsForm();
this.colorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
this.menuId = menuItem.MenuId;
this.menuName = menuItem.Text;
this.halfColorsFormGrid = new ColorsForm();
this.halfColorsFormGrid.StartPosition = FormStartPosition.CenterScreen;
this.appWorkspace = appWorkspace;
this.documentWorkspace = new DocumentWorkspaceWindow(appWorkspace);
this.documentWorkspace.Dock = DockStyle.Fill;
this.documentWorkspace.HookMouseEvents();
this.documentWorkspace.AuxiliaryLineEnabled = false;
this.documentWorkspace.Visible = false;
this.groupBox_review.Controls.Add(this.documentWorkspace);
this.commonControlButtons = new GeneralAnalysisCommonControlButtons();
this.commonControlButtons.Dock = DockStyle.Top;
this.commonControlButtons.Height = 30;
this.commonControlButtons.HideZoomToWindowAndActualSize();
this.commonControlButtons.trackLabel.Text = PdnResources.GetString("Menu.1point:clicktelete:doubleclick.text");
this.commonControlButtons.trackLabel.Visible = true;
this.commonControlButtons.trackLabel.Width = 300;
this.groupBox_review.Controls.Add(commonControlButtons);
Graphics g = this.documentWorkspace.panel.CreateGraphics();
this.documentWorkspace.panel.MouseDown += Panel_MouseDown;
InitPicList();
//BindingResults();
this.listView1.SelectedIndexChanged += new EventHandler(this.ListViewSelectedIndexChanged);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
//初始化头
this.listView2.View = View.Details;
ColumnHeader header0 = new ColumnHeader();
header0.Text = "";
header0.Width = 191;
this.listView2.Columns.Add(header0);
dataGridView1.SelectionChanged += DataGridView1_SelectionChanged;
SetAnalyzeModelFromXml("Template.Manager.item2.CountNumberAnalysis");
allResults = new List();
activeResults = new List();
finalViewResults = new List();
this.button11.Visible = true;
this.button16.Visible = false;
InitCommonButtonEvent();
this.documentWorkspace.panel.Paint += Panel_Paint;
for (int i = 0; i < this.dataGridView1.Columns.Count; i++)
{
this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
}
for (int i = 0; i < this.dataGridView_results.Columns.Count; i++)
{
this.dataGridView_results.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
}
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.saveLastData);
}
#region 公共按钮
private void InitCommonButtonEvent()
{
this.commonControlButtons.zoomInButton.Click += new EventHandler(zoomInButton_Click);
this.commonControlButtons.zoomOutButton.Click += new EventHandler(zoomOutButton_Click);
this.commonControlButtons.zoomToWindowButton.Click += new EventHandler(zoomToWindowButton_Click);
this.commonControlButtons.actualSizeButton.Click += new EventHandler(actualSizeButton_Click);
this.commonControlButtons.pointerButton.Click += new EventHandler(pointerButton_Click);
this.commonControlButtons.mobileModeButton.Click += new EventHandler(mobileModeButton_Click);
}
private void zoomInButton_Click(object sender, EventArgs e)
{
if(this.imageMat != null)
this.documentWorkspace.ZoomIn();
}
private void zoomOutButton_Click(object sender, EventArgs e)
{
if (this.imageMat != null)
this.documentWorkspace.ZoomOut();
}
private void zoomToWindowButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ZoomBasis = ZoomBasis.FitToWindow;
}
private void actualSizeButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ZoomBasis = ZoomBasis.ScaleFactor;
this.documentWorkspace.ScaleFactor = ScaleFactor.OneToOne;
}
private void pointerButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.Pointer;
}
private void mobileModeButton_Click(object sender, EventArgs e)
{
this.documentWorkspace.ActiveTool = Annotation.Enum.DrawToolType.MoveMode;
}
#endregion
private void Init()
{
this.activeResults.Clear();
this.documentWorkspace.GraphicsList.Clear();
this.p1RectangleFs.Clear();
this.p2RectangleFs.Clear();
//this.documentWorkspace.phaseModels.RemoveAll(u=>u.)
}
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);
}
appWorkspace.ScriptCurrentParam = null;//阻止第二次进入仍然被赋值参数
}
else
{//读取上次关闭窗口时保存的参数
getLastData();
}
}
}
///
/// 获取上次操作参数
///
private void getLastData()
{
string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
if (!System.IO.File.Exists(filePath))
{
generalAnalysisModel = new GeneralAnalysisModel();
generalAnalysisModel.PolyphaseMutiAreaContentModels = new GeneralAnalysisModel.PolyphaseMutiAreaContentModel();
generalAnalysisModel.PolyphaseCounterAnalysisModels = new GeneralAnalysisModel.PolyphaseCounterAnalysisModel();
generalAnalysisModel.TwoPhaseScaleModels = new GeneralAnalysisModel.TwoPhaseScaleModel();
generalAnalysisModel.PolyphaseContentModels = new GeneralAnalysisModel.PolyphaseContentModel();
generalAnalysisModel.PolyphaseDistanceModels = new GeneralAnalysisModel.PolyphaseDistanceModel();
generalAnalysisModel.DebrisSelectionModels = new GeneralAnalysisModel.DebrisSelectionModel();
generalAnalysisModel.CountNumberAnalysisModels = new GeneralAnalysisModel.CountNumberAnalysisModel();
generalAnalysisModel.PolyphaseMutiAreaContentModels.hasUsed = false;
generalAnalysisModel.PolyphaseCounterAnalysisModels.hasUsed = false;
generalAnalysisModel.TwoPhaseScaleModels.hasUsed = false;
generalAnalysisModel.PolyphaseContentModels.hasUsed = false;
generalAnalysisModel.PolyphaseDistanceModels.hasUsed = false;
generalAnalysisModel.DebrisSelectionModels.hasUsed = false;
generalAnalysisModel.CountNumberAnalysisModels.hasUsed = false;
string porosityInfoXml = XmlSerializeHelper.XmlSerialize(generalAnalysisModel);
Directory.CreateDirectory(Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
}
else
{
generalAnalysisModel = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
if (generalAnalysisModel.CountNumberAnalysisModels == null) {
generalAnalysisModel.CountNumberAnalysisModels = new GeneralAnalysisModel.CountNumberAnalysisModel();
}
if (generalAnalysisModel.CountNumberAnalysisModels.hasUsed)
{
rb_LeftCircle.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter1 == 1 ? true : false;
rb_LeftSquare.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter1 == 1 ? false : true;
rb_leftFill.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter2 == 1 ? true : false;
rb_leftNoFill.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter2 == 1 ? false : true;
numericUpDown2.Value = generalAnalysisModel.CountNumberAnalysisModels.parameter3;
numericUpDown3.Value = generalAnalysisModel.CountNumberAnalysisModels.parameter4;
panel1.BackColor = Color.FromArgb(generalAnalysisModel.CountNumberAnalysisModels.parameter5);
rb_RightCircle.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter6 == 1 ? true : false;
rb_RightSquare.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter6 == 1 ? false : true;
rb_RightFill.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter7 == 1 ? true : false;
rb_RightNoFill.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter7 == 1 ? false : true;
numericUpDown4.Value = generalAnalysisModel.CountNumberAnalysisModels.parameter8;
numericUpDown5.Value = generalAnalysisModel.CountNumberAnalysisModels.parameter9;
panel2.BackColor = Color.FromArgb(generalAnalysisModel.CountNumberAnalysisModels.parameter10);
numericUpDown1.Value = generalAnalysisModel.CountNumberAnalysisModels.parameter11;
checkBox1.Checked = generalAnalysisModel.CountNumberAnalysisModels.parameter12;
for (int i = 0; i < listView1.Items.Count; i++)
{
if (everyImgData.ContainsKey(listView1.Items[i].Name))
{
everyImgData[listView1.Items[i].Name] = generalAnalysisModel.CountNumberAnalysisModels;
}
else
{
everyImgData.Add(listView1.Items[i].Name, generalAnalysisModel.CountNumberAnalysisModels);
}
}
}
}
}
///
/// 保存上次操作参数
///
private void saveLastData(object sender, EventArgs e)
{
#region [开启脚本录制]
if (appWorkspace.startScriptRecording)
{
getScriptRecording();
}
#endregion
if (generalAnalysisModel.CountNumberAnalysisModels == null)
{
generalAnalysisModel.CountNumberAnalysisModels = new GeneralAnalysisModel.CountNumberAnalysisModel();
}
generalAnalysisModel.CountNumberAnalysisModels.hasUsed = true;
if (rb_LeftCircle.Checked)
{
generalAnalysisModel.CountNumberAnalysisModels.parameter1 = 1;
}
else if (rb_LeftSquare.Checked)
{
generalAnalysisModel.CountNumberAnalysisModels.parameter1 = 2;
}
else
{
generalAnalysisModel.CountNumberAnalysisModels.parameter1 = 3;
}
if (rb_leftFill.Checked)
{
generalAnalysisModel.CountNumberAnalysisModels.parameter2 = 1;
}
else if (rb_leftNoFill.Checked)
{
generalAnalysisModel.CountNumberAnalysisModels.parameter2 = 2;
}
else
{
generalAnalysisModel.CountNumberAnalysisModels.parameter2 = 3;
}
if (rb_RightCircle.Checked)
{
generalAnalysisModel.CountNumberAnalysisModels.parameter6 = 1;
}
else if (rb_RightSquare.Checked)
{
generalAnalysisModel.CountNumberAnalysisModels.parameter6 = 2;
}
else
{
generalAnalysisModel.CountNumberAnalysisModels.parameter6 = 3;
}
if (rb_RightFill.Checked)
{
generalAnalysisModel.CountNumberAnalysisModels.parameter7 = 1;
}
else if (rb_RightNoFill.Checked)
{
generalAnalysisModel.CountNumberAnalysisModels.parameter7 = 2;
}
else
{
generalAnalysisModel.CountNumberAnalysisModels.parameter7 = 3;
}
generalAnalysisModel.CountNumberAnalysisModels.parameter3 = (int)numericUpDown2.Value;
generalAnalysisModel.CountNumberAnalysisModels.parameter4 = (int)numericUpDown3.Value;
generalAnalysisModel.CountNumberAnalysisModels.parameter5 = panel1.BackColor.ToArgb();
generalAnalysisModel.CountNumberAnalysisModels.parameter8 = (int)numericUpDown4.Value;
generalAnalysisModel.CountNumberAnalysisModels.parameter9 = (int)numericUpDown5.Value;
generalAnalysisModel.CountNumberAnalysisModels.parameter10 = panel2.BackColor.ToArgb();
generalAnalysisModel.CountNumberAnalysisModels.parameter11 = (int)numericUpDown1.Value;
generalAnalysisModel.CountNumberAnalysisModels.parameter12 = checkBox1.Checked;
string filePath = Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterGeneralAnalysis.xml";
string porosityInfoXml = XmlSerializeHelper.XmlSerialize(generalAnalysisModel);
FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create);
}
private void Panel_MouseDown(object sender, MouseEventArgs e)
{
if (dataGridView1.CurrentRow == null)
{
MessageBox.Show(PdnResources.GetString("Menu.seselectthephaseIfnotaddphasefirs.Text"));
return;
}
// 换算后的点
PointF point1 = documentWorkspace.GetScalePoint(e.Location);
bool canAdd1 = true;
bool canAdd2 = true;
if (p2RectangleFs.Count > 0)
{
foreach (var rectangleF in p2RectangleFs[this.dataGridView1.SelectedRows[0].Index])
{
if (rectangleF.Contains(point1))
{
canAdd1 = false;
if (e.Button == MouseButtons.Left && e.Clicks == 2)
{
p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Remove(rectangleF);
break;
}
}
}
}
if (p1RectangleFs.Count > 0)
{
foreach (var rectangleF in p1RectangleFs[this.dataGridView1.SelectedRows[0].Index])
{
if (rectangleF.Contains(point1))
{
canAdd2 = false;
if (e.Button == MouseButtons.Left && e.Clicks == 2)
{
p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Remove(rectangleF);
break;
}
}
}
}
if (e.Button == MouseButtons.Left)
{
if (canAdd1 && canAdd2)
{
p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Add(new RectangleF(point1.X - Convert.ToInt32(txt_LeftSize.Text) / 2
, point1.Y - Convert.ToInt32(txt_LeftSize.Text) / 2, Convert.ToInt32(txt_LeftSize.Text), Convert.ToInt32(txt_LeftSize.Text)));
}
}
if (e.Button == MouseButtons.Right)
{
if (canAdd1 && canAdd2)
{
p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Add(new RectangleF(point1.X - Convert.ToInt32(txt_RightSize.Text) / 2
, point1.Y - Convert.ToInt32(txt_RightSize.Text) / 2, Convert.ToInt32(txt_RightSize.Text), Convert.ToInt32(txt_RightSize.Text)));
}
}
double count = 0;
if (this.p1RectangleFs.Count > 0)
{
this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[1].Value = p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count;
count += p1RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count;
}
else
this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[1].Value = 0;
if (this.p2RectangleFs.Count > 0)
{
this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[2].Value = p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count;
count += Convert.ToDouble(p2RectangleFs[this.dataGridView1.SelectedRows[0].Index].Count) / 2;
}
else
this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[2].Value = 0;
double allCount = 0;
foreach (var item in p1RectangleFs)
{
allCount += item.Count;
}
foreach (var item in p2RectangleFs)
{
allCount += Convert.ToDouble(item.Count) / 2;
}
this.dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[3].Value = Math.Round(count, Convert.ToInt32(this.numericUpDown1.Value));
for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
{
double percentage = 0;
if (Convert.ToInt32(this.dataGridView1.Rows[i].Cells[3].Value) > 0)
{
percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[i].Cells[1].Value)
+ Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[i].Cells[2].Value) * 0.5))
/ allCount) * 100;
}
this.dataGridView1.Rows[i].Cells[4].Value = Math.Round(percentage, Convert.ToInt32(this.numericUpDown1.Value));
}
this.documentWorkspace.Refresh();
}
private void DataGridView1_SelectionChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void updateResults()
{
dataGridView1.Rows.Clear();
AddTwoRow();
for (int i = 0; i < activeResults.Count; i++)
{
activeResults[i].OneNumber = activeResults[i].LeftObjectIds.Count;
activeResults[i].HalfNumber = activeResults[i].RightObjectIds.Count;
activeResults[i].AllNumber = activeResults[i].OneNumber + (Single)activeResults[i].HalfNumber/2;
}
for (int j=0;j a.AllNumber) > 0)
{
activeResults[j].RateFromAll = (Single)activeResults[j].AllNumber / activeResults.Sum(a => a.AllNumber);
}else
{
activeResults[j].RateFromAll = 0;
}
dataGridView1.Rows.Add(activeResults[j].PhaseName, activeResults[j].OneNumber, activeResults[j].HalfNumber, AnalysisTools.GetDecNum(activeResults[j].AllNumber,decnum), AnalysisTools.GetDecNum(activeResults[j].RateFromAll,decnum));
}
if (dataGridView1.Rows.Count > 0)
{
dataGridView1.Rows[selectIndex].Selected = true;
dataGridView1.CurrentCell = this.dataGridView1.Rows[selectIndex].Cells[0];
}
}
public void InitPicList()
{
this.documentItems = new Dictionary();
// 构造工作结构
for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++)
{
GraphicsList graphicsList = new GraphicsList();
for (int j = 0; j < this.appWorkspace.DocumentWorkspaces[i].GraphicsList.Count; j++)
{
graphicsList.Add(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[j]);
}
List phaseModels = new List();
//二值化相关
PhaseModel analysisModel = this.appWorkspace.DocumentWorkspaces[i].AnalysisPhaseModel;
if (analysisModel == null)
{
}
else
phaseModels.Add(analysisModel);
this.documentItems.Add(i, new DocumentItem(graphicsList, phaseModels));
}
//初始化图片列表
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;
}
internal class DocumentItem
{
public GraphicsList graphicsList;
public List phaseModels;
public AnalysisResult analysisResult;
public DocumentItem(GraphicsList graphicsList, List phaseModels)
{
this.graphicsList = graphicsList;
this.phaseModels = phaseModels;
}
}
private void rb_LeftSquare_CheckedChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void rb_RightSquare_CheckedChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void rb_leftFill_CheckedChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void rb_RightFill_CheckedChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void rb_RightNoFill_CheckedChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void rb_leftNoFill_CheckedChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void panel1_Click(object sender, EventArgs e)
{
this.colorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel1.BackColor);
this.colorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColorChanged));
this.colorsFormGrid.ShowDialog();
}
///
/// Panel2的调色板颜色改变
///
///
///
private void gridColorChanged(object sender, EventArgs e)
{
Color color = this.colorsFormGrid.UserPrimaryColor.ToColor();
//更改背景色,触发事件
this.panel1.BackColor = color;
//改变配置文件里面的相颜色
//this.binaryExtractionModel.PhaseColor = color.ToArgb();
//关闭色板
this.documentWorkspace.Refresh();
this.colorsFormGrid.Close();
}
private void panel2_Click(object sender, EventArgs e)
{
this.halfColorsFormGrid.UserPrimaryColor = ColorBgra.FromColor(this.panel2.BackColor);
this.halfColorsFormGrid.setSaveBtn_Click(new System.EventHandler(this.gridColor2Changed));
this.halfColorsFormGrid.ShowDialog();
}
///
/// Panel2的调色板颜色改变
///
///
///
private void gridColor2Changed(object sender, EventArgs e)
{
Color color = this.halfColorsFormGrid.UserPrimaryColor.ToColor();
//更改背景色,触发事件
this.panel2.BackColor = color;
//改变配置文件里面的相颜色
this.documentWorkspace.Refresh();
this.halfColorsFormGrid.Close();
}
private void rb_LeftCircle_CheckedChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void rb_RightCircle_CheckedChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void txt_LeftSize_TextChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void txt_LeftLineWeight_TextChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void txt_RightSize_TextChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void txt_RightLineWeight_TextChanged(object sender, EventArgs e)
{
this.documentWorkspace.Refresh();
}
private void button5_Click(object sender, EventArgs e)
{
this.documentWorkspace.GraphicsList.Clear();
this.documentWorkspace.Refresh();
this.Close();
}
///
/// 图片测量记录
///
private List pictureDataTables = new List();
private void button2_Click(object sender, EventArgs e)
{
if (dataGridView1.Rows.Count == 0)
{
MessageBox.Show(PdnResources.GetString("Menu.Pleaseaddaphoto.text"));
return;
}
this.listView2.SelectedItems.Clear();
string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName();
string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index];
if (listView1.SelectedItems.Count > 0)
{
DataTable dataTable1 = new DataTable();
bool replace = false;
int add = 0;
foreach (ListViewItem item in this.listView2.Items)
{
if (item.Tag.Equals(tag))
{
add++;
DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Themeasurementdertoreplace.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dr == DialogResult.OK)
{
replace = true;
this.listView2.Items.Remove(item);
}
break;
}
}
double allCount = 0;
foreach (var item in p1RectangleFs)
{
allCount += item.Count;
}
foreach (var item in p2RectangleFs)
{
allCount += Convert.ToDouble(item.Count) / 2;
}
if (replace || this.listView2.Items.Count == 0 || add == 0)
{
ListViewItem listViewItem = new ListViewItem();
listViewItem.SubItems[0].Text = imgName;
listViewItem.Tag = tag;
if (this.listView2.Items.Count == 0)
this.listView2.Items.Add(listViewItem);
else
this.listView2.Items.Insert(0, listViewItem);
dataTable1.TableName = tag;
this.dataGridView_results.Rows.Clear();
foreach (DataGridViewRow Row in this.dataGridView1.Rows)
{
DataGridViewRow dgvr = new DataGridViewRow();
dgvr.Tag = tag;
foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
{
dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
}
dgvr.Cells[0].Value = imgName;
dgvr.Cells[1].Value = Row.Cells[0].Value;
dgvr.Cells[2].Value = Row.Cells[1].Value;
dgvr.Cells[3].Value = Row.Cells[2].Value;
dgvr.Cells[4].Value = Row.Cells[3].Value;
dgvr.Cells[5].Value = Row.Cells[4].Value;
this.dataGridView_results.Rows.Add(dgvr);
}
foreach (DataTable dataTable2 in pictureDataTables)
{
if (dataTable2.TableName.Equals(dataTable1.TableName))
{
pictureDataTables.Remove(dataTable2);
break;
}
}
foreach (DataGridViewColumn c in this.dataGridView_results.Columns)
{
dataTable1.Columns.Add(c.HeaderText);
}
for (int r = 0; r < this.dataGridView1.Rows.Count; r++)
{
double count = 0;
if (this.p1RectangleFs.Count > 0)
{
count += p1RectangleFs[r].Count;
}
if (this.p2RectangleFs.Count > 0)
{
count += Convert.ToDouble(p2RectangleFs[r].Count) / 2;
}
DataRow dataRow = dataTable1.NewRow();
for (int c = 0; c < this.dataGridView1.Rows[r].Cells.Count + 1; c++)
{
if (c == 0)
dataRow[this.dataGridView_results.Columns[0].HeaderText] = imgName;
else
{
if (c == this.dataGridView1.Rows[r].Cells.Count)
{
double percentage = 0;
if (Convert.ToInt32(this.dataGridView1.Rows[r].Cells[4].Value) > 0)
{
percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[r].Cells[1].Value)
+ Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[r].Cells[2].Value) * 0.5))
/ allCount) * 100;
}
dataRow[this.dataGridView_results.Columns[c].HeaderText] = percentage;
}
else if (c == this.dataGridView1.Rows[r].Cells.Count - 1)
dataRow[this.dataGridView_results.Columns[c].HeaderText] = count;
else
dataRow[this.dataGridView_results.Columns[c].HeaderText] = this.dataGridView1.Rows[r].Cells[c - 1].Value;
}
}
dataTable1.Rows.Add(dataRow);
}
this.pictureDataTables.Add(dataTable1);
if (this.allShow)
AllShow();
this.listView2.Items[0].Selected = true;
this.bitDic.Clear();
foreach (var item in this.bitDic1)
{
this.bitDic.Add(item.Key, item.Value);
}
//拼接中间数据
List> dataList = new List>();
List columnName = new List();
columnName.Add(PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text"));
foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
{
columnName.Add(Column.HeaderText);
}
dataList.Add(columnName);
for (int r = 0; r < this.dataGridView1.Rows.Count; r++)
{
double count = 0;
if (this.p1RectangleFs.Count > 0)
{
count += p1RectangleFs[r].Count;
}
if (this.p2RectangleFs.Count > 0)
{
count += Convert.ToDouble(p2RectangleFs[r].Count) / 2;
}
List strList = new List();
strList.Add((r + 1).ToString());
for (int c = 0; c < this.dataGridView1.Rows[r].Cells.Count + 1; c++)
{
if (c == 0)
strList.Add(imgName);
else
{
if (c == this.dataGridView1.Rows[r].Cells.Count)
{
double percentage = 0;
if (!this.dataGridView1.Rows[r].Cells[4].Value.ToString().Equals("0"))
{
percentage = Convert.ToDouble((Convert.ToDouble(this.dataGridView1.Rows[r].Cells[2].Value)
+ Convert.ToDouble(Convert.ToDouble(this.dataGridView1.Rows[r].Cells[3].Value) * 0.5))
/ allCount) * 100;
}
strList.Add(percentage.ToString());
}
else if (c == this.dataGridView1.Rows[r].Cells.Count - 1)
strList.Add(count.ToString());
else
strList.Add(this.dataGridView1.Rows[r].Cells[c - 1].Value.ToString());
}
}
dataList.Add(strList);
}
bool isExist = false;//是否已存在进行替换
int modelIndex = -1;//要替换的下标
for (int j = 0; j < tempDataModel.Count; j++)
{
if (tempDataModel[j].tagName.Equals(tag))
{
isExist = true;
modelIndex = j;
break;
}
}
if (isExist && modelIndex > -1)
tempDataModel[modelIndex].dataList = dataList;
else
{
ExportProjectModel newModel = new ExportProjectModel();
newModel.tagName = tag;
newModel.picName = imgName;
newModel.dataList = dataList;
tempDataModel.Add(newModel);
}
}
}
else
{
MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectthepicturetosave.text")+"!");
}
}
private void Draw(Graphics graphics)
{
if (this.p1RectangleFs.Count > 0 && this.dataGridView1.SelectedRows.Count > 0)
{
// 1截点
foreach (var pointRectangleF in this.p1RectangleFs[this.dataGridView1.SelectedRows[0].Index])
{
// 绘制点
PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
int size = Convert.ToInt32(this.txt_LeftSize.Text);
// 圆形
if (this.rb_LeftCircle.Checked)
{
// 实心
if (this.rb_leftFill.Checked)
graphics.FillEllipse(new SolidBrush(this.panel1.BackColor), pointF.X - (float)size / 2, pointF.Y - (float)size / 2
, size, size);
// 空心
else
graphics.DrawEllipse(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
, pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
}
// 方形
else
{
// 实心
if (this.rb_leftFill.Checked)
graphics.FillRectangle(new SolidBrush(this.panel1.BackColor)
, pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
// 空心
else
graphics.DrawRectangle(new Pen(this.panel1.BackColor, Convert.ToInt32(this.txt_LeftLineWeight.Text))
, pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
}
}
}
if (this.p2RectangleFs.Count > 0 && this.dataGridView1.SelectedRows.Count > 0)
{
// 0.5截点
foreach (var pointRectangleF in this.p2RectangleFs[this.dataGridView1.SelectedRows[0].Index])
{
// 绘制点
PointF pointF = new PointF(pointRectangleF.X + pointRectangleF.Width / 2, pointRectangleF.Y + pointRectangleF.Height / 2);
int size = Convert.ToInt32(this.txt_RightSize.Text);
// 圆形
if (this.rb_RightCircle.Checked)
{
// 实心
if (this.rb_RightFill.Checked)
graphics.FillEllipse(new SolidBrush(this.panel2.BackColor)
, pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
// 空心
else
graphics.DrawEllipse(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
, pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
}
// 方形
else
{
// 实心
if (this.rb_RightFill.Checked)
graphics.FillRectangle(new SolidBrush(this.panel2.BackColor)
, pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
// 空心
else
graphics.DrawRectangle(new Pen(this.panel2.BackColor, Convert.ToInt32(this.txt_RightLineWeight.Text))
, pointF.X - (float)size / 2, pointF.Y - (float)size / 2, size, size);
}
}
}
if (this.documentWorkspace.phaseModels.Count > 0)
{
foreach (PhaseModel model in this.documentWorkspace.phaseModels)
{
if (model.choise && model.mat != null)
{
Bitmap map = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(model.mat);
graphics.DrawImage(map, 0, 0, map.Width, map.Height);
}
}
}
}
private void DrawObjects(Graphics graphics,GraphicsList graphicsList)
{
if (graphicsList != null)
{
graphicsList.Draw(graphics);
}
}
private void but_Clear_Click(object sender, EventArgs e)
{
if(this.dataGridView1.Rows.Count == 0)
{
MessageBox.Show(PdnResources.GetString("Menu.Nonedata.Text") + "!");
return;
}
string tag = listView1.FocusedItem.Text + "|" + this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
string key = tag.Substring(0, tag.IndexOf("|"));
DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Whethertocleartheresults.text")+"?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dr == DialogResult.OK)
{
for (int i = 0; i < bitDic1.Count; i++)
{
foreach (var item in bitDic1)
{
string keyDe = item.Key.Substring(0, item.Key.IndexOf("|"));
if (key.Equals(keyDe))
{
bitDic1.Remove(item.Key);
break;
}
}
}
this.p1RectangleFs.Clear();
this.p2RectangleFs.Clear();
dataGridView1.Rows.Clear();
mutuallyIndex = 1;
documentWorkspace.Refresh();
}
}
///
/// 默认添加两个相
///
private void AddTwoRow()
{
//bitDic1.Clear();多图保存生成报告只保存最后一张,所以注掉
for (int i = 0; i < 2; i++)
{
DataGridViewRow dgvr = new DataGridViewRow();
foreach (DataGridViewColumn c in this.dataGridView1.Columns)
{
dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
}
dgvr.Cells[0].Value = "相" + mutuallyIndex;
dgvr.Cells[1].Value = 0;
dgvr.Cells[2].Value = 0;
dgvr.Cells[3].Value = 0;
dgvr.Cells[4].Value = 0;
this.dataGridView1.Rows.Add(dgvr);
this.p1RectangleFs.Add(new List());
this.p2RectangleFs.Add(new List());
string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + mutuallyIndex;
mutuallyIndex++;
if (this.dataGridView1.Rows.Count > 0)
this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;
//保存处理后的图片
double pantographRatio = 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);
Graphics graphics;
Bitmap newBit;
Bitmap processedBit;
if (this.documentItems[this.listView1.FocusedItem.Index].phaseModels.Count != 0
&& this.documentItems[this.listView1.FocusedItem.Index].phaseModels[0].mat != null)
{
processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
graphics = Graphics.FromImage(newBit);
graphics.DrawImage(processedBit, new PointF(0, 0));
Draw(graphics);
newBit.Tag = pantographRatio;
tempBit.Add(newBit);
}
else
{
newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
graphics = Graphics.FromImage(newBit);
Draw(graphics);
newBit.Tag = pantographRatio;
tempBit.Add(newBit);
}
if (bitDic1.ContainsKey(tag))
bitDic1[tag] = tempBit;
else
bitDic1.Add(tag, tempBit);
}
}
private void but_AddPhase_Click(object sender, EventArgs e)
{
if(this.listView1.SelectedItems.Count == 0)
{
MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapicturefirst.text"));
return;
}
DataGridViewRow dgvr = new DataGridViewRow();
foreach (DataGridViewColumn c in this.dataGridView1.Columns)
{
dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell);
}
dgvr.Cells[0].Value = "相" + mutuallyIndex;
dgvr.Cells[1].Value = 0;
dgvr.Cells[2].Value = 0;
dgvr.Cells[3].Value = 0;
dgvr.Cells[4].Value = 0;
this.dataGridView1.Rows.Add(dgvr);
this.p1RectangleFs.Add(new List());
this.p2RectangleFs.Add(new List());
string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + mutuallyIndex;
mutuallyIndex++;
if (this.dataGridView1.Rows.Count > 0)
this.dataGridView1.Rows[this.dataGridView1.Rows.Count-1].Selected = true;
//保存处理后的图片
double pantographRatio = 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);
Graphics graphics;
Bitmap newBit;
Bitmap processedBit;
if (this.documentItems[this.listView1.FocusedItem.Index].phaseModels.Count != 0
&& this.documentItems[this.listView1.FocusedItem.Index].phaseModels[0].mat != null)
{
processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
graphics = Graphics.FromImage(newBit);
graphics.DrawImage(processedBit, new PointF(0, 0));
Draw(graphics);
newBit.Tag = pantographRatio;
tempBit.Add(newBit);
}
else
{
newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
graphics = Graphics.FromImage(newBit);
Draw(graphics);
newBit.Tag = pantographRatio;
tempBit.Add(newBit);
}
if (bitDic1.ContainsKey(tag))
bitDic1[tag] = tempBit;
else
bitDic1.Add(tag, tempBit);
}
private void But_DelPhase_Click(object sender, EventArgs e)
{
if (dataGridView1.Rows.Count == 0)
{
MessageBox.Show(PdnResources.GetString("Menu.Nophaseselectedtodelete.text")+"!");
return;
}
DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.deleteornot.text") + dataGridView1.Rows[this.dataGridView1.SelectedRows[0].Index].Cells[0].Value + PdnResources.GetString("Menu.Phaseresult.text")+" ?", PdnResources.GetString("Menu.Edit.Delete.Text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dr == DialogResult.OK)
{
int selIndex = this.dataGridView1.SelectedRows[0].Index;
if (this.dataGridView1.Rows.Count > 0)
{
this.p1RectangleFs.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
this.p2RectangleFs.RemoveAt(this.dataGridView1.SelectedRows[0].Index);
}
else
{
this.p1RectangleFs.RemoveAt(0);
this.p2RectangleFs.RemoveAt(0);
}
string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString().Replace("相", string.Empty);
//int num =Convert.ToInt32(tag.Substring(tag.IndexOf("|") + 1, tag.Length - tag.IndexOf("|") - 1));
if (bitDic1.ContainsKey(tag))
bitDic1.Remove(tag);
//foreach (string key in bitDic.Keys.ToArray())
//{
// int num1 = Convert.ToInt32(key.Substring(key.IndexOf("|") + 1, key.Length - key.IndexOf("|") - 1));
// if(num1 > num)
// {
// List bitmaps = new List();
// bitmaps = bitDic[key];
// string newKeyNum = key.Substring(key.IndexOf("|") + 1, key.Length - key.IndexOf("|") - 1);
// string newKey = key.Substring(0, key.IndexOf("|")) + "|" + (Convert.ToInt32(newKeyNum) - 1);
// bitDic.Remove(key);
// bitDic.Add(newKey, bitmaps);
// }
//}
//for (int i = 0; i < dataGridView1.Rows.Count; i++)
//{
// int num1 = Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value.ToString().Replace("相",string.Empty));
// if (num1 > num)
// {
// dataGridView1.Rows[i].Cells[0].Value = "相" + (num1 - 1);
// }
//}
this.dataGridView1.Rows.Remove(this.dataGridView1.SelectedRows[0]);
if (this.dataGridView1.Rows.Count > 0)
this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true;
//mutuallyIndex--;
documentWorkspace.Refresh();
}
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
double allCount = 0;
foreach (var item in p1RectangleFs)
{
allCount += item.Count;
}
foreach (var item in p2RectangleFs)
{
allCount += Convert.ToDouble(item.Count) / 2;
}
for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
{
double count = 0;
if (this.p1RectangleFs.Count > 0)
{
count += p1RectangleFs[i].Count;
}
if (this.p2RectangleFs.Count > 0)
{
count += Convert.ToDouble(p2RectangleFs[i].Count) / 2;
}
double percentage = 0;
if (Convert.ToInt32(this.dataGridView1.Rows[i].Cells[4].Value) > 0)
{
percentage = Convert.ToDouble((Convert.ToInt32(this.dataGridView1.Rows[i].Cells[1].Value)
+ Convert.ToDouble(Convert.ToInt32(this.dataGridView1.Rows[i].Cells[2].Value) * 0.5))
/ allCount) * 100;
}
this.dataGridView1.Rows[i].Cells[3].Value = Math.Round(count, Convert.ToInt32(this.numericUpDown1.Value));
this.dataGridView1.Rows[i].Cells[4].Value = Math.Round(percentage, Convert.ToInt32(this.numericUpDown1.Value));
}
RefreshDataGridView4();
}
private void groupBox10_Paint(object sender, PaintEventArgs e)
{
e.Graphics.Clear(this.BackColor);
}
private void groupBox9_Paint(object sender, PaintEventArgs e)
{
e.Graphics.Clear(this.BackColor);
}
private void button1_Click(object sender, EventArgs e)
{
AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item2.CountNumberAnalysis");
if (recombinationRateSetDialog.hasModule)
{
recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
recombinationRateSetDialog.ShowDialog();
}
else
{
recombinationRateSetDialog = null;
}
}
private void button4_Click(object sender, EventArgs e)
{
if (this.dataGridView_results.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);
exe.FileName = PdnResources.GetString("Menu.GeneralAnalysis.CountStatistics.Text")+ PdnResources.GetString("Menu.Analysisresult.text") + DateTime.Now.ToString("yyyyMMddhhmmss");
DialogResult dr = exe.ShowDialog();
if (dr == DialogResult.OK)
{
DataTable dtb = new DataTable();
foreach (DataGridViewColumn c in this.dataGridView_results.Columns)
{
dtb.Columns.Add(c.HeaderText);
}
for (int r = 0; r < this.dataGridView_results.Rows.Count; r++)
{
DataRow dataRow = dtb.NewRow();
for (int c = 0; c < this.dataGridView_results.Rows[r].Cells.Count; c++)
{
dataRow[this.dataGridView_results.Columns[c].HeaderText] = this.dataGridView_results.Rows[r].Cells[c].Value;
}
dtb.Rows.Add(dataRow);
}
List list = new List();
list.Add(dtb);
this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, true, false, true);
}
}
else
{
MessageBox.Show(PdnResources.GetString("Menu.Noanalysisresults.text")+"!");
}
}
private void button3_Click(object sender, EventArgs e)
{
if(checkBox1.Checked)
{
AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item2.CountNumberAnalysis");
if (recombinationRateSetDialog.hasModule)
{
recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen;
recombinationRateSetDialog.ShowDialog();
}
else
{
recombinationRateSetDialog = null;
}
}
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>();
for (int i = 0; i < this.dataGridView_results.Rows.Count; i++)
{
List content1 = new List();
if (i == 0)
{
content1.Add(this.dataGridView_results.Columns[0].HeaderText);
content1.Add(this.dataGridView_results.Columns[1].HeaderText);
content1.Add(this.dataGridView_results.Columns[2].HeaderText);
content1.Add(this.dataGridView_results.Columns[3].HeaderText);
content1.Add(this.dataGridView_results.Columns[4].HeaderText);
content1.Add(this.dataGridView_results.Columns[5].HeaderText);
analysisContent.Add(content1);
}
content1 = new List();
content1.Add(this.dataGridView_results.Rows[i].Cells[0].Value.ToString());
content1.Add(this.dataGridView_results.Rows[i].Cells[1].Value.ToString());
content1.Add(this.dataGridView_results.Rows[i].Cells[2].Value.ToString());
content1.Add(this.dataGridView_results.Rows[i].Cells[3].Value.ToString());
content1.Add(this.dataGridView_results.Rows[i].Cells[4].Value.ToString());
content1.Add(this.dataGridView_results.Rows[i].Cells[5].Value.ToString());
analysisContent.Add(content1);
}
bitList = new List();
if (this.allShow)
{
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 (DataGridViewRow itemRow in this.dataGridView_results.Rows)
{
foreach (ListViewItem item in this.listView2.SelectedItems)
{
if (bitDic.ContainsKey(item.Tag.ToString() + "|" + itemRow.Cells[1].Value.ToString().Replace("相", string.Empty)) && itemRow.Tag.Equals(item.Tag))
{
bitList.Add(bitDic[item.Tag.ToString() + "|" + itemRow.Cells[1].Value.ToString().Replace("相", string.Empty)][0]);
bitList.Add(bitDic[item.Tag.ToString() + "|" + itemRow.Cells[1].Value.ToString().Replace("相", string.Empty)][1]);
}
}
}
}
}
this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos);
}
else
MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!");
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
}
///
/// 导出项目
///
///
///
private void button6_Click(object sender, EventArgs e)
{
try
{
if (this.analyzeSettingModel == null)
{
MessageBox.Show(PdnResources.GetString("Menu.Settheexporteitemfirst.Text"));
return;
}
//获取项目工程内的文件夹路径
ProjectEngineering.NodeItem item = this.appWorkspace.GetInsertProjectPath(2, "Menu.GeneralAnalysis.CountStatistics.Text", this.analyzeSettingModel.savePath);
if (item != null)
{
//向文件夹内保存图片和报告
if (!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>();
for (int i = 0; i < this.dataGridView_results.Rows.Count; i++)
{
List content1 = new List();
if (i == 0)
{
content1.Add(this.dataGridView_results.Columns[0].HeaderText);
content1.Add(this.dataGridView_results.Columns[1].HeaderText);
content1.Add(this.dataGridView_results.Columns[2].HeaderText);
content1.Add(this.dataGridView_results.Columns[3].HeaderText);
content1.Add(this.dataGridView_results.Columns[4].HeaderText);
content1.Add(this.dataGridView_results.Columns[5].HeaderText);
analysisContent.Add(content1);
}
content1 = new List();
content1.Add(this.dataGridView_results.Rows[i].Cells[0].Value.ToString());
content1.Add(this.dataGridView_results.Rows[i].Cells[1].Value.ToString());
content1.Add(this.dataGridView_results.Rows[i].Cells[2].Value.ToString());
content1.Add(this.dataGridView_results.Rows[i].Cells[3].Value.ToString());
content1.Add(this.dataGridView_results.Rows[i].Cells[4].Value.ToString());
content1.Add(this.dataGridView_results.Rows[i].Cells[5].Value.ToString());
analysisContent.Add(content1);
}
bitList = new List();
if (this.allShow)
{
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 (DataGridViewRow itemRow in this.dataGridView_results.Rows)
{
foreach (ListViewItem itemL2 in this.listView2.SelectedItems)
{
if (bitDic.ContainsKey(itemL2.Tag.ToString() + "|" + itemRow.Cells[1].Value.ToString().Replace("相", string.Empty)) && itemRow.Tag.Equals(itemL2.Tag))
{
bitList.Add(bitDic[itemL2.Tag.ToString() + "|" + itemRow.Cells[1].Value.ToString().Replace("相", string.Empty)][0]);
bitList.Add(bitDic[itemL2.Tag.ToString() + "|" + itemRow.Cells[1].Value.ToString().Replace("相", string.Empty)][1]);
}
}
}
}
}
//中间数据
if (!this.allShow)
{
if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
{
List exportModel = new List();
foreach (ListViewItem rowItem in this.listView2.SelectedItems)
{
foreach (ExportProjectModel model in this.tempDataModel)
{
if (model.tagName.Equals(rowItem.Tag))
{
ExportProjectModel tempModel = new ExportProjectModel();
tempModel.tagName = model.tagName;
tempModel.picName = model.picName;
tempModel.dataList = model.dataList;
exportModel.Add(tempModel);
break;
}
}
}
this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, exportModel, bitList, tagInfos, item.path, item.code);
}
}
else
{
MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text") + "!");
return;
}
//保存项目信息到数据库
this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item);
}
}
}
catch (Exception)
{
}
}
///
/// ListView图片选择改变事件
///
///
///
private void ListViewSelectedIndexChanged(object sender, EventArgs e)
{
if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected)
{
Init();
if (!string.IsNullOrEmpty(this.selectedImg)) {
#region [保存参数]
var model = new GeneralAnalysisModel.CountNumberAnalysisModel();
if (rb_LeftCircle.Checked)
{
model.parameter1 = 1;
}
else if (rb_LeftSquare.Checked)
{
model.parameter1 = 2;
}
else
{
model.parameter1 = 3;
}
if (rb_leftFill.Checked)
{
model.parameter2 = 1;
}
else if (rb_leftNoFill.Checked)
{
model.parameter2 = 2;
}
else
{
model.parameter2 = 3;
}
if (rb_RightCircle.Checked)
{
model.parameter6 = 1;
}
else if (rb_RightSquare.Checked)
{
model.parameter6 = 2;
}
else
{
model.parameter6 = 3;
}
if (rb_RightFill.Checked)
{
model.parameter7 = 1;
}
else if (rb_RightNoFill.Checked)
{
model.parameter7 = 2;
}
else
{
model.parameter7 = 3;
}
model.parameter3 = (int)numericUpDown2.Value;
model.parameter4 = (int)numericUpDown3.Value;
model.parameter5 = panel1.BackColor.ToArgb();
model.parameter8 = (int)numericUpDown4.Value;
model.parameter9 = (int)numericUpDown5.Value;
model.parameter10 = panel2.BackColor.ToArgb();
model.parameter11 = (int)numericUpDown1.Value;
model.parameter12 = checkBox1.Checked;
if (everyImgData.ContainsKey(this.selectedImg))
{
everyImgData[this.selectedImg] = model;
}
else {
everyImgData.Add(this.selectedImg,model);
}
#endregion
}
this.imageMat = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreatedAliasedMat();
Document document = Document.FromImageMat(imageMat.Clone());
this.documentWorkspace.Document = document;
this.documentWorkspace.Visible = true;
//this.documentWorkspace.GraphicsList = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GraphicsList;
this.documentWorkspace.phaseModels = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].phaseModels;
mutuallyIndex = 1;
updateResults();
selectIndex = 0;
#region [设置参数]
this.selectedImg = this.listView1.FocusedItem.Name;
if (everyImgData.ContainsKey(this.selectedImg))
{
var thisModel = everyImgData[this.selectedImg];
rb_LeftCircle.Checked = thisModel.parameter1 == 1 ? true : false;
rb_LeftSquare.Checked = thisModel.parameter1 == 1 ? false : true;
rb_leftFill.Checked = thisModel.parameter2 == 1 ? true : false;
rb_leftNoFill.Checked = thisModel.parameter2 == 1 ? false : true;
if (thisModel.parameter3 <= numericUpDown2.Maximum && thisModel.parameter3 >= numericUpDown2.Minimum)
{
numericUpDown2.Value = thisModel.parameter3;
}
if (thisModel.parameter4 <= numericUpDown3.Maximum && thisModel.parameter4 >= numericUpDown3.Minimum)
{
numericUpDown3.Value = thisModel.parameter4;
}
panel1.BackColor = Color.FromArgb(thisModel.parameter5);
rb_RightCircle.Checked = thisModel.parameter6 == 1 ? true : false;
rb_RightSquare.Checked = thisModel.parameter6 == 1 ? false : true;
rb_RightFill.Checked = thisModel.parameter7 == 1 ? true : false;
rb_RightNoFill.Checked = thisModel.parameter7 == 1 ? false : true;
if (thisModel.parameter8 <= numericUpDown4.Maximum && thisModel.parameter8 >= numericUpDown4.Minimum)
{
numericUpDown4.Value = thisModel.parameter8;
}
if (thisModel.parameter9 <= numericUpDown5.Maximum && thisModel.parameter9 >= numericUpDown5.Minimum)
{
numericUpDown5.Value = thisModel.parameter9;
}
panel2.BackColor = Color.FromArgb(thisModel.parameter10);
if (thisModel.parameter11 <= numericUpDown1.Maximum && thisModel.parameter11 >= numericUpDown1.Minimum)
{
numericUpDown1.Value = thisModel.parameter11;
}
checkBox1.Checked = thisModel.parameter12;
}
#endregion
}
}
#region InitializeComponent
private void InitializeLanguageText()
{
this.groupBox8.Text = PdnResources.GetString("Menu.0.5pointsetting.text");
this.label3.Text = PdnResources.GetString("Menu.style.text");
this.rb_RightNoFill.Text = PdnResources.GetString("Menu.Hollow.text");
this.rb_RightFill.Text = PdnResources.GetString("Menu.solid.text");
this.label7.Text = PdnResources.GetString("Menu.color.text");
this.label8.Text = PdnResources.GetString("Menu.Linewidth.text");
this.label9.Text = PdnResources.GetString("Menu.sizeed.text");
this.rb_RightSquare.Text = PdnResources.GetString("Menu.Square.text");
this.rb_RightCircle.Text = PdnResources.GetString("Menu.circular.Text");
this.label11.Text = PdnResources.GetString("Menu.shape.text");
this.Text = PdnResources.GetString("Menu.GeneralAnalysis.CountStatistics.Text");
this.button6.Text = PdnResources.GetString("Menu.Exportproject.text");
this.label1.Text = PdnResources.GetString("Menu.Decimal.text");
this.button4.Text = PdnResources.GetString("Menu.Exportresults.text");
this.button3.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text");
this.groupBox3.Text = PdnResources.GetString("Menu.Resultspreview.text");
this.But_DelPhase.Text = PdnResources.GetString("Menu.Deletephase.text");
this.but_AddPhase.Text = PdnResources.GetString("Menu.Addphase.text");
this.but_Clear.Text = PdnResources.GetString("Menu.Empty.text");
this.Column2.HeaderText = PdnResources.GetString("Menu.phase.text");
this.Column6.HeaderText = PdnResources.GetString("Menu.total.text");
this.Column7.HeaderText = PdnResources.GetString("Menu.percent.text");
this.groupBox5.Text = PdnResources.GetString("Menu.Analysisresult.text");
this.Column5.HeaderText = PdnResources.GetString("Menu.Generalanalysis.Countingstatistics.imagename.text");
this.Column1.HeaderText = PdnResources.GetString("Menu.phase.text");
this.Column10.HeaderText = PdnResources.GetString("Menu.total.text");
this.Column11.HeaderText = PdnResources.GetString("Menu.percent.text");
this.rb_leftFill.Text = PdnResources.GetString("Menu.solid.text");
this.label6.Text = PdnResources.GetString("Menu.color.text");
this.label5.Text = PdnResources.GetString("Menu.Linewidth.text");
this.label4.Text = PdnResources.GetString("Menu.sizeed.text");
this.rb_LeftCircle.Text = PdnResources.GetString("Menu.circular.Text");
this.label2.Text = PdnResources.GetString("Menu.shape.text");
this.groupBox_review.Text = PdnResources.GetString("Menu.Preview.text");
this.rb_LeftSquare.Text = PdnResources.GetString("Menu.Square.text");
this.groupBox4.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text");
this.groupBox1.Text = PdnResources.GetString("Menu.operation.text");
this.button5.Text = PdnResources.GetString("Menu.File.Close.Text");
this.button2.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.1SpotSet.text");
this.label10.Text = PdnResources.GetString("Menu.style.text");
this.rb_leftNoFill.Text = PdnResources.GetString("Menu.Hollow.text");
this.button16.Text = PdnResources.GetString("Menu.Cancelshowall.text");
this.button12.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
this.button11.Text = PdnResources.GetString("Menu.Showall.text");
}
///
/// 切换分析结果
///
///
///
private void listView2_SelectedIndexChanged(object sender, EventArgs e)
{
if (!this.allShow)
{
if (this.listView2.SelectedItems.Count > 0)
{
List dataTableIndex = new List();
if (this.pictureDataTables.Count == 0)
return;
for (int i = 0; i < this.pictureDataTables.Count; i++)
{
foreach (ListViewItem item in this.listView2.SelectedItems)
{
if (this.pictureDataTables[i].TableName.Equals(item.Tag))
dataTableIndex.Add(i);
}
}
this.dataGridView_results.Rows.Clear();
foreach (var item in dataTableIndex)
{
if (this.pictureDataTables[item].Rows.Count > 0)
{
for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
{
DataGridViewRow dgvr = new DataGridViewRow();
dgvr.Tag = this.pictureDataTables[item].TableName;
foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
{
dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
}
for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
{
if (c == this.pictureDataTables[item].Columns.Count - 1 || c == this.pictureDataTables[item].Columns.Count - 2)
dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
else
dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
}
this.dataGridView_results.Rows.Add(dgvr);
}
}
}
}
}
}
///
/// 未选择分析结果
///
///
///
private void listView2_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
if (!this.allShow)
{
if (this.listView2.SelectedItems.Count == 0)
this.dataGridView_results.Rows.Clear();
}
}
///
/// 取消全部显示
///
///
///
private void button16_Click(object sender, EventArgs e)
{
this.allShow = false;
this.button11.Visible = true;
this.button16.Visible = false;
if (this.listView2.Items.Count > 0)
{
if (this.listView2.SelectedItems.Count > 0)
{
List dataTableIndex = new List();
if (this.pictureDataTables.Count == 0)
return;
for (int i = 0; i < this.pictureDataTables.Count; i++)
{
foreach (ListViewItem item in this.listView2.SelectedItems)
{
if (this.pictureDataTables[i].TableName.Equals(item.Tag))
dataTableIndex.Add(i);
}
}
this.dataGridView_results.Rows.Clear();
foreach (var item in dataTableIndex)
{
if (this.pictureDataTables[item].Rows.Count > 0)
{
for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
{
DataGridViewRow dgvr = new DataGridViewRow();
dgvr.Tag = this.pictureDataTables[item].TableName;
foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
{
dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
}
for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
{
if (c == this.pictureDataTables[item].Columns.Count - 1 || c == this.pictureDataTables[item].Columns.Count - 2)
dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
else
dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
}
this.dataGridView_results.Rows.Add(dgvr);
}
}
}
}
else
{
this.listView2.Items[0].Selected = true;
if (this.pictureDataTables.Count > 0
&& this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count > 0)
{
this.dataGridView_results.Rows.Clear();
for (int r = 0; r < this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count; r++)
{
DataGridViewRow dgvr = new DataGridViewRow();
dgvr.Tag = this.pictureDataTables[this.pictureDataTables.Count - 1].TableName;
foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
{
dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
}
for (int c = 0; c < this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count; c++)
{
if (c == this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count - 1 || c == this.pictureDataTables[this.pictureDataTables.Count - 1].Columns.Count - 2)
dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
else
dgvr.Cells[c].Value = this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c].ToString();
}
this.dataGridView_results.Rows.Add(dgvr);
}
}
}
}
}
///
/// 全部显示
///
///
///
private void button11_Click(object sender, EventArgs e)
{
this.allShow = true;
this.button11.Visible = false;
this.button16.Visible = true;
this.button16.Focus();
AllShow();
}
private void AllShow()
{
this.dataGridView_results.Rows.Clear();
DataTable dataTable = new DataTable();
for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
{
dataTable = this.pictureDataTables[i];
for (int r = 0; r < dataTable.Rows.Count; r++)
{
DataGridViewRow dgvr = new DataGridViewRow();
dgvr.Tag = dataTable.TableName;
foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
{
dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
}
for (int c = 0; c < dataTable.Columns.Count; c++)
{
if (c == dataTable.Columns.Count - 1 || c == dataTable.Columns.Count - 2)
dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
else
dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
}
this.dataGridView_results.Rows.Add(dgvr);
}
}
}
///
/// 分析结果删除
///
///
///
private void button12_Click(object sender, EventArgs e)
{
if (this.listView2.Items.Count > 0)
{
if (this.listView2.SelectedItems.Count > 0)
{
DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethisanalysisresult.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dr == DialogResult.OK)
{
List detaleName = new List();
int selectIndex = this.listView2.SelectedItems[0].Index;
foreach (ListViewItem item in this.listView2.SelectedItems)
{
detaleName.Add(item.Tag.ToString());
this.listView2.Items.Remove(item);
}
foreach (string tag in detaleName)
{
foreach (DataTable dataTable in this.pictureDataTables)
{
if (dataTable.TableName.Equals(tag))
{
this.pictureDataTables.Remove(dataTable);
break;
}
}
for (int i = 0; i < bitDic.Count; i++)
{
foreach (var item in bitDic)
{
string keyDe = item.Key.Substring(0, item.Key.IndexOf("|"));
if (tag.Equals(keyDe))
{
bitDic.Remove(item.Key);
break;
}
}
}
foreach (ExportProjectModel model in this.tempDataModel)
{
if (model.tagName.Equals(tag))
{
this.tempDataModel.Remove(model);
break;
}
}
}
if (this.listView2.Items.Count > 0)
{
if (selectIndex == 0)
this.listView2.Items[0].Selected = true;
else
this.listView2.Items[selectIndex - 1].Selected = true;
RefreshDataGridView4();
}
else
{
this.dataGridView_results.Rows.Clear();
}
}
}
else
{
MessageBox.Show(PdnResources.GetString("Menu.Pleaseselecttheanalysisresulttodelete.text")+"!");
}
}
else
{
MessageBox.Show(PdnResources.GetString("Menu.Nodataintheanalysisresults.text")+"!");
}
}
///
/// 刷新分析结果数据
///
private void RefreshDataGridView4()
{
if (!this.allShow)
{
if (this.listView2.SelectedItems.Count > 0)
{
List dataTableIndex = new List();
for (int i = 0; i < this.pictureDataTables.Count; i++)
{
foreach (ListViewItem item in this.listView2.SelectedItems)
{
if (this.pictureDataTables[i].TableName.Equals(item.Tag))
dataTableIndex.Add(i);
}
}
if (this.pictureDataTables.Count == 0)
return;
this.dataGridView_results.Rows.Clear();
foreach (var item in dataTableIndex)
{
if (this.pictureDataTables[item].Rows.Count > 0)
{
for (int r = 0; r < this.pictureDataTables[item].Rows.Count; r++)
{
DataGridViewRow dgvr = new DataGridViewRow();
dgvr.Tag = this.pictureDataTables[item].TableName;
foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
{
dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
}
for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++)
{
if (c != this.pictureDataTables[item].Columns.Count - 1 && c != this.pictureDataTables[item].Columns.Count - 2)
dgvr.Cells[c].Value = this.pictureDataTables[item].Rows[r][c].ToString();
else
dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pictureDataTables[item].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
}
this.dataGridView_results.Rows.Add(dgvr);
}
}
}
}
}
else
{
this.dataGridView_results.Rows.Clear();
DataTable dataTable = new DataTable();
for (int i = this.pictureDataTables.Count - 1; i >= 0; i--)
{
dataTable = this.pictureDataTables[i];
for (int r = 0; r < dataTable.Rows.Count; r++)
{
DataGridViewRow dgvr = new DataGridViewRow();
dgvr.Tag = dataTable.TableName;
foreach (DataGridViewColumn Column in this.dataGridView_results.Columns)
{
dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell);
}
for (int c = 0; c < dataTable.Columns.Count; c++)
{
if (c != dataTable.Columns.Count - 1 && c != dataTable.Columns.Count - 2)
dgvr.Cells[c].Value = dataTable.Rows[r][c].ToString();
else
dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString();
}
this.dataGridView_results.Rows.Add(dgvr);
}
}
}
}
private void numericUpDown2_ValueChanged(object sender, EventArgs e)
{
txt_LeftSize.Text = numericUpDown2.Value.ToString();
}
private void numericUpDown3_ValueChanged(object sender, EventArgs e)
{
txt_LeftLineWeight.Text = numericUpDown3.Value.ToString();
}
private void numericUpDown4_ValueChanged(object sender, EventArgs e)
{
txt_RightSize.Text = numericUpDown4.Value.ToString();
}
private void numericUpDown5_ValueChanged(object sender, EventArgs e)
{
txt_RightLineWeight.Text = numericUpDown5.Value.ToString();
}
///
/// 不可点击空白区域
///
///
///
private void listView1_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
if (listView1.SelectedItems.Count > 0)
{
}
else if (listView1.SelectedItems.Count <= 0)//点击空白区
{
if (this.listView1.FocusedItem != null)
{
ListViewItem item = this.listView1.GetItemAt(e.X, e.Y);
if (item == null)
{
this.listView1.FocusedItem.Selected = true;
}
}
}
}
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.listView1 = new System.Windows.Forms.ListView();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button5 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.button1 = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.groupBox10 = new System.Windows.Forms.GroupBox();
this.label10 = new System.Windows.Forms.Label();
this.rb_leftNoFill = new System.Windows.Forms.RadioButton();
this.rb_leftFill = new System.Windows.Forms.RadioButton();
this.panel1 = new System.Windows.Forms.Panel();
this.label6 = new System.Windows.Forms.Label();
this.txt_LeftLineWeight = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.txt_LeftSize = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.rb_LeftSquare = new System.Windows.Forms.RadioButton();
this.rb_LeftCircle = new System.Windows.Forms.RadioButton();
this.label2 = new System.Windows.Forms.Label();
this.groupBox_review = new System.Windows.Forms.GroupBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.button12 = new System.Windows.Forms.Button();
this.button16 = new System.Windows.Forms.Button();
this.button11 = new System.Windows.Forms.Button();
this.listView2 = new System.Windows.Forms.ListView();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.dataGridView_results = new System.Windows.Forms.DataGridView();
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column1 = 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.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.button6 = new System.Windows.Forms.Button();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.But_DelPhase = new System.Windows.Forms.Button();
this.but_AddPhase = new System.Windows.Forms.Button();
this.but_Clear = new System.Windows.Forms.Button();
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.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.groupBox8 = new System.Windows.Forms.GroupBox();
this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown4 = new System.Windows.Forms.NumericUpDown();
this.panel2 = new System.Windows.Forms.Panel();
this.groupBox9 = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.rb_RightNoFill = new System.Windows.Forms.RadioButton();
this.rb_RightFill = new System.Windows.Forms.RadioButton();
this.label7 = new System.Windows.Forms.Label();
this.txt_RightLineWeight = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.txt_RightSize = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.rb_RightSquare = new System.Windows.Forms.RadioButton();
this.rb_RightCircle = new System.Windows.Forms.RadioButton();
this.label11 = new System.Windows.Forms.Label();
this.groupBox4.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.groupBox10.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView_results)).BeginInit();
this.groupBox7.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.groupBox8.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).BeginInit();
this.groupBox9.SuspendLayout();
this.SuspendLayout();
//
// groupBox4
//
this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox4.Controls.Add(this.listView1);
this.groupBox4.Location = new System.Drawing.Point(13, 72);
this.groupBox4.Margin = new System.Windows.Forms.Padding(4);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Padding = new System.Windows.Forms.Padding(4);
this.groupBox4.Size = new System.Drawing.Size(158, 445);
this.groupBox4.TabIndex = 9;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "图像索引";
//
// 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(8, 26);
this.listView1.Margin = new System.Windows.Forms.Padding(4);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(140, 411);
this.listView1.TabIndex = 0;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseUp);
//
// 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;
//
// 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.button5);
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Controls.Add(this.checkBox1);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Location = new System.Drawing.Point(20, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(1145, 53);
this.groupBox1.TabIndex = 10;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "操作";
//
// button5
//
this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button5.Location = new System.Drawing.Point(956, 21);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(75, 23);
this.button5.TabIndex = 3;
this.button5.Text = "关闭";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button2
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button2.Location = new System.Drawing.Point(1053, 21);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 2;
this.button2.Text = "保存结果";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(110, 28);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(132, 16);
this.checkBox1.TabIndex = 1;
this.checkBox1.Text = "生成报告时打开设置";
this.checkBox1.UseVisualStyleBackColor = true;
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// button1
//
this.button1.Location = new System.Drawing.Point(6, 24);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "设置";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.numericUpDown3);
this.groupBox2.Controls.Add(this.numericUpDown2);
this.groupBox2.Controls.Add(this.groupBox10);
this.groupBox2.Controls.Add(this.panel1);
this.groupBox2.Controls.Add(this.label6);
this.groupBox2.Controls.Add(this.txt_LeftLineWeight);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.txt_LeftSize);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.rb_LeftSquare);
this.groupBox2.Controls.Add(this.rb_LeftCircle);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Location = new System.Drawing.Point(178, 72);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(406, 93);
this.groupBox2.TabIndex = 11;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "1点设置";
//
// numericUpDown3
//
this.numericUpDown3.Location = new System.Drawing.Point(166, 54);
this.numericUpDown3.Maximum = new decimal(new int[] {
9999,
0,
0,
0});
this.numericUpDown3.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown3.Name = "numericUpDown3";
this.numericUpDown3.Size = new System.Drawing.Size(63, 21);
this.numericUpDown3.TabIndex = 27;
this.numericUpDown3.Value = new decimal(new int[] {
2,
0,
0,
0});
this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown3_ValueChanged);
//
// numericUpDown2
//
this.numericUpDown2.Location = new System.Drawing.Point(62, 54);
this.numericUpDown2.Maximum = new decimal(new int[] {
9999,
0,
0,
0});
this.numericUpDown2.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(63, 21);
this.numericUpDown2.TabIndex = 26;
this.numericUpDown2.Value = new decimal(new int[] {
30,
0,
0,
0});
this.numericUpDown2.ValueChanged += new System.EventHandler(this.numericUpDown2_ValueChanged);
//
// groupBox10
//
this.groupBox10.Controls.Add(this.label10);
this.groupBox10.Controls.Add(this.rb_leftNoFill);
this.groupBox10.Controls.Add(this.rb_leftFill);
this.groupBox10.Location = new System.Drawing.Point(227, 10);
this.groupBox10.Name = "groupBox10";
this.groupBox10.Size = new System.Drawing.Size(173, 38);
this.groupBox10.TabIndex = 25;
this.groupBox10.TabStop = false;
this.groupBox10.Paint += new System.Windows.Forms.PaintEventHandler(this.groupBox10_Paint);
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(12, 16);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(41, 12);
this.label10.TabIndex = 22;
this.label10.Text = "样式:";
//
// rb_leftNoFill
//
this.rb_leftNoFill.AutoSize = true;
this.rb_leftNoFill.Checked = true;
this.rb_leftNoFill.Location = new System.Drawing.Point(108, 14);
this.rb_leftNoFill.Name = "rb_leftNoFill";
this.rb_leftNoFill.Size = new System.Drawing.Size(47, 16);
this.rb_leftNoFill.TabIndex = 20;
this.rb_leftNoFill.TabStop = true;
this.rb_leftNoFill.Text = "空心";
this.rb_leftNoFill.UseVisualStyleBackColor = true;
this.rb_leftNoFill.CheckedChanged += new System.EventHandler(this.rb_leftNoFill_CheckedChanged);
//
// rb_leftFill
//
this.rb_leftFill.AutoSize = true;
this.rb_leftFill.Location = new System.Drawing.Point(53, 14);
this.rb_leftFill.Name = "rb_leftFill";
this.rb_leftFill.Size = new System.Drawing.Size(47, 16);
this.rb_leftFill.TabIndex = 19;
this.rb_leftFill.Text = "实心";
this.rb_leftFill.UseVisualStyleBackColor = true;
this.rb_leftFill.CheckedChanged += new System.EventHandler(this.rb_leftFill_CheckedChanged);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Blue;
this.panel1.Location = new System.Drawing.Point(274, 57);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(98, 17);
this.panel1.TabIndex = 25;
this.panel1.Click += new System.EventHandler(this.panel1_Click);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(239, 57);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(41, 12);
this.label6.TabIndex = 10;
this.label6.Text = "颜色:";
//
// txt_LeftLineWeight
//
this.txt_LeftLineWeight.Location = new System.Drawing.Point(166, 54);
this.txt_LeftLineWeight.Name = "txt_LeftLineWeight";
this.txt_LeftLineWeight.Size = new System.Drawing.Size(45, 21);
this.txt_LeftLineWeight.TabIndex = 9;
this.txt_LeftLineWeight.Text = "2";
this.txt_LeftLineWeight.TextChanged += new System.EventHandler(this.txt_LeftLineWeight_TextChanged);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(131, 57);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(29, 12);
this.label5.TabIndex = 8;
this.label5.Text = "线宽";
//
// txt_LeftSize
//
this.txt_LeftSize.Location = new System.Drawing.Point(62, 54);
this.txt_LeftSize.Name = "txt_LeftSize";
this.txt_LeftSize.Size = new System.Drawing.Size(45, 21);
this.txt_LeftSize.TabIndex = 7;
this.txt_LeftSize.Text = "30";
this.txt_LeftSize.TextChanged += new System.EventHandler(this.txt_LeftSize_TextChanged);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(27, 57);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 12);
this.label4.TabIndex = 6;
this.label4.Text = "尺寸:";
//
// rb_LeftSquare
//
this.rb_LeftSquare.AutoSize = true;
this.rb_LeftSquare.Location = new System.Drawing.Point(115, 25);
this.rb_LeftSquare.Name = "rb_LeftSquare";
this.rb_LeftSquare.Size = new System.Drawing.Size(47, 16);
this.rb_LeftSquare.TabIndex = 2;
this.rb_LeftSquare.Text = "方形";
this.rb_LeftSquare.UseVisualStyleBackColor = true;
this.rb_LeftSquare.CheckedChanged += new System.EventHandler(this.rb_LeftSquare_CheckedChanged);
//
// rb_LeftCircle
//
this.rb_LeftCircle.AutoSize = true;
this.rb_LeftCircle.Checked = true;
this.rb_LeftCircle.Location = new System.Drawing.Point(62, 25);
this.rb_LeftCircle.Name = "rb_LeftCircle";
this.rb_LeftCircle.Size = new System.Drawing.Size(47, 16);
this.rb_LeftCircle.TabIndex = 1;
this.rb_LeftCircle.TabStop = true;
this.rb_LeftCircle.Text = "圆形";
this.rb_LeftCircle.UseVisualStyleBackColor = true;
this.rb_LeftCircle.CheckedChanged += new System.EventHandler(this.rb_LeftCircle_CheckedChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(25, 27);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 12);
this.label2.TabIndex = 0;
this.label2.Text = "形状:";
//
// groupBox_review
//
this.groupBox_review.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.groupBox_review.Location = new System.Drawing.Point(590, 72);
this.groupBox_review.Name = "groupBox_review";
this.groupBox_review.Size = new System.Drawing.Size(575, 445);
this.groupBox_review.TabIndex = 12;
this.groupBox_review.TabStop = false;
this.groupBox_review.Text = "预览";
//
// groupBox5
//
this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.groupBox5.Controls.Add(this.button12);
this.groupBox5.Controls.Add(this.button16);
this.groupBox5.Controls.Add(this.button11);
this.groupBox5.Controls.Add(this.listView2);
this.groupBox5.Location = new System.Drawing.Point(12, 524);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(224, 203);
this.groupBox5.TabIndex = 13;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "分析结果";
//
// button12
//
this.button12.BackColor = System.Drawing.SystemColors.Control;
this.button12.Location = new System.Drawing.Point(153, 20);
this.button12.Name = "button12";
this.button12.Size = new System.Drawing.Size(52, 26);
this.button12.TabIndex = 26;
this.button12.Text = "删除";
this.button12.UseVisualStyleBackColor = false;
this.button12.Click += new System.EventHandler(this.button12_Click);
//
// button16
//
this.button16.BackColor = System.Drawing.SystemColors.Control;
this.button16.Location = new System.Drawing.Point(14, 20);
this.button16.Name = "button16";
this.button16.Size = new System.Drawing.Size(93, 26);
this.button16.TabIndex = 25;
this.button16.Text = "取消全部显示";
this.button16.UseVisualStyleBackColor = false;
this.button16.Click += new System.EventHandler(this.button16_Click);
//
// button11
//
this.button11.BackColor = System.Drawing.SystemColors.Control;
this.button11.Location = new System.Drawing.Point(14, 20);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(63, 26);
this.button11.TabIndex = 24;
this.button11.Text = "全部显示";
this.button11.UseVisualStyleBackColor = false;
this.button11.Click += new System.EventHandler(this.button11_Click);
//
// listView2
//
this.listView2.FullRowSelect = true;
this.listView2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.listView2.HideSelection = false;
this.listView2.Location = new System.Drawing.Point(14, 53);
this.listView2.Name = "listView2";
this.listView2.Size = new System.Drawing.Size(191, 144);
this.listView2.TabIndex = 23;
this.listView2.UseCompatibleStateImageBehavior = false;
this.listView2.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView2_ItemSelectionChanged);
this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView2_SelectedIndexChanged);
//
// groupBox6
//
this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox6.Controls.Add(this.dataGridView_results);
this.groupBox6.Location = new System.Drawing.Point(257, 524);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(678, 203);
this.groupBox6.TabIndex = 14;
this.groupBox6.TabStop = false;
//
// dataGridView_results
//
this.dataGridView_results.AllowUserToAddRows = false;
this.dataGridView_results.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.dataGridView_results.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dataGridView_results.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.dataGridView_results.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView_results.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column5,
this.Column1,
this.Column8,
this.Column9,
this.Column10,
this.Column11});
this.dataGridView_results.Location = new System.Drawing.Point(16, 29);
this.dataGridView_results.Name = "dataGridView_results";
this.dataGridView_results.RowHeadersVisible = false;
this.dataGridView_results.RowHeadersWidth = 51;
this.dataGridView_results.RowTemplate.Height = 27;
this.dataGridView_results.Size = new System.Drawing.Size(645, 168);
this.dataGridView_results.TabIndex = 1;
//
// Column5
//
this.Column5.Name = "Column5";
//
// Column1
//
this.Column1.Name = "Column1";
//
// Column8
//
this.Column8.HeaderText = "1";
this.Column8.Name = "Column8";
//
// Column9
//
this.Column9.HeaderText = ".5";
this.Column9.Name = "Column9";
//
// Column10
//
this.Column10.Name = "Column10";
//
// Column11
//
this.Column11.Name = "Column11";
//
// groupBox7
//
this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox7.Controls.Add(this.button6);
this.groupBox7.Controls.Add(this.numericUpDown1);
this.groupBox7.Controls.Add(this.label1);
this.groupBox7.Controls.Add(this.button4);
this.groupBox7.Controls.Add(this.button3);
this.groupBox7.Location = new System.Drawing.Point(941, 524);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(224, 203);
this.groupBox7.TabIndex = 15;
this.groupBox7.TabStop = false;
//
// button6
//
this.button6.Location = new System.Drawing.Point(48, 123);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(123, 23);
this.button6.TabIndex = 5;
this.button6.Text = "导出项目";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(81, 170);
this.numericUpDown1.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(90, 21);
this.numericUpDown1.TabIndex = 4;
this.numericUpDown1.Value = new decimal(new int[] {
2,
0,
0,
0});
this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(46, 173);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 3;
this.label1.Text = "小数:";
//
// button4
//
this.button4.Location = new System.Drawing.Point(48, 94);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(123, 23);
this.button4.TabIndex = 1;
this.button4.Text = "导出结果";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(48, 65);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(123, 23);
this.button3.TabIndex = 0;
this.button3.Text = "生成报告";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.But_DelPhase);
this.groupBox3.Controls.Add(this.but_AddPhase);
this.groupBox3.Controls.Add(this.but_Clear);
this.groupBox3.Controls.Add(this.dataGridView1);
this.groupBox3.Location = new System.Drawing.Point(178, 271);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(406, 246);
this.groupBox3.TabIndex = 16;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "结果预览";
//
// But_DelPhase
//
this.But_DelPhase.Location = new System.Drawing.Point(335, 20);
this.But_DelPhase.Name = "But_DelPhase";
this.But_DelPhase.Size = new System.Drawing.Size(63, 23);
this.But_DelPhase.TabIndex = 3;
this.But_DelPhase.Text = "删除相";
this.But_DelPhase.UseVisualStyleBackColor = true;
this.But_DelPhase.Click += new System.EventHandler(this.But_DelPhase_Click);
//
// but_AddPhase
//
this.but_AddPhase.Location = new System.Drawing.Point(252, 20);
this.but_AddPhase.Name = "but_AddPhase";
this.but_AddPhase.Size = new System.Drawing.Size(61, 23);
this.but_AddPhase.TabIndex = 2;
this.but_AddPhase.Text = "添加相";
this.but_AddPhase.UseVisualStyleBackColor = true;
this.but_AddPhase.Click += new System.EventHandler(this.but_AddPhase_Click);
//
// but_Clear
//
this.but_Clear.Location = new System.Drawing.Point(168, 20);
this.but_Clear.Name = "but_Clear";
this.but_Clear.Size = new System.Drawing.Size(61, 23);
this.but_Clear.TabIndex = 1;
this.but_Clear.Text = "清空";
this.but_Clear.UseVisualStyleBackColor = true;
this.but_Clear.Click += new System.EventHandler(this.but_Clear_Click);
//
// dataGridView1
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column2,
this.Column3,
this.Column4,
this.Column6,
this.Column7});
this.dataGridView1.Location = new System.Drawing.Point(6, 54);
this.dataGridView1.MultiSelect = false;
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.RowHeadersVisible = false;
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView1.Size = new System.Drawing.Size(394, 186);
this.dataGridView1.TabIndex = 0;
//
// Column2
//
this.Column2.HeaderText = "Column2";
this.Column2.Name = "Column2";
this.Column2.ReadOnly = true;
//
// Column3
//
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.Column3.DefaultCellStyle = dataGridViewCellStyle1;
this.Column3.HeaderText = "1";
this.Column3.Name = "Column3";
this.Column3.ReadOnly = true;
//
// Column4
//
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.Column4.DefaultCellStyle = dataGridViewCellStyle2;
this.Column4.HeaderText = ".5";
this.Column4.Name = "Column4";
this.Column4.ReadOnly = true;
//
// Column6
//
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.Column6.DefaultCellStyle = dataGridViewCellStyle3;
this.Column6.HeaderText = "Column6";
this.Column6.Name = "Column6";
this.Column6.ReadOnly = true;
//
// Column7
//
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.Column7.DefaultCellStyle = dataGridViewCellStyle4;
this.Column7.HeaderText = "Column7";
this.Column7.Name = "Column7";
this.Column7.ReadOnly = true;
//
// groupBox8
//
this.groupBox8.Controls.Add(this.numericUpDown5);
this.groupBox8.Controls.Add(this.numericUpDown4);
this.groupBox8.Controls.Add(this.panel2);
this.groupBox8.Controls.Add(this.groupBox9);
this.groupBox8.Controls.Add(this.label7);
this.groupBox8.Controls.Add(this.txt_RightLineWeight);
this.groupBox8.Controls.Add(this.label8);
this.groupBox8.Controls.Add(this.txt_RightSize);
this.groupBox8.Controls.Add(this.label9);
this.groupBox8.Controls.Add(this.rb_RightSquare);
this.groupBox8.Controls.Add(this.rb_RightCircle);
this.groupBox8.Controls.Add(this.label11);
this.groupBox8.Location = new System.Drawing.Point(178, 171);
this.groupBox8.Name = "groupBox8";
this.groupBox8.Size = new System.Drawing.Size(406, 94);
this.groupBox8.TabIndex = 17;
this.groupBox8.TabStop = false;
this.groupBox8.Text = "0.5点设置";
//
// numericUpDown5
//
this.numericUpDown5.Location = new System.Drawing.Point(162, 59);
this.numericUpDown5.Maximum = new decimal(new int[] {
9999,
0,
0,
0});
this.numericUpDown5.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown5.Name = "numericUpDown5";
this.numericUpDown5.Size = new System.Drawing.Size(63, 21);
this.numericUpDown5.TabIndex = 28;
this.numericUpDown5.Value = new decimal(new int[] {
5,
0,
0,
0});
this.numericUpDown5.ValueChanged += new System.EventHandler(this.numericUpDown5_ValueChanged);
//
// numericUpDown4
//
this.numericUpDown4.Location = new System.Drawing.Point(56, 59);
this.numericUpDown4.Maximum = new decimal(new int[] {
9999,
0,
0,
0});
this.numericUpDown4.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown4.Name = "numericUpDown4";
this.numericUpDown4.Size = new System.Drawing.Size(63, 21);
this.numericUpDown4.TabIndex = 27;
this.numericUpDown4.Value = new decimal(new int[] {
30,
0,
0,
0});
this.numericUpDown4.ValueChanged += new System.EventHandler(this.numericUpDown4_ValueChanged);
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Yellow;
this.panel2.Location = new System.Drawing.Point(268, 62);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(98, 17);
this.panel2.TabIndex = 26;
this.panel2.Click += new System.EventHandler(this.panel2_Click);
//
// groupBox9
//
this.groupBox9.Controls.Add(this.label3);
this.groupBox9.Controls.Add(this.rb_RightNoFill);
this.groupBox9.Controls.Add(this.rb_RightFill);
this.groupBox9.Location = new System.Drawing.Point(221, 14);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(173, 42);
this.groupBox9.TabIndex = 24;
this.groupBox9.TabStop = false;
this.groupBox9.Paint += new System.Windows.Forms.PaintEventHandler(this.groupBox9_Paint);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 18);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(41, 12);
this.label3.TabIndex = 21;
this.label3.Text = "样式:";
//
// rb_RightNoFill
//
this.rb_RightNoFill.AutoSize = true;
this.rb_RightNoFill.Checked = true;
this.rb_RightNoFill.Location = new System.Drawing.Point(108, 16);
this.rb_RightNoFill.Name = "rb_RightNoFill";
this.rb_RightNoFill.Size = new System.Drawing.Size(47, 16);
this.rb_RightNoFill.TabIndex = 20;
this.rb_RightNoFill.TabStop = true;
this.rb_RightNoFill.Text = "空心";
this.rb_RightNoFill.UseVisualStyleBackColor = true;
this.rb_RightNoFill.CheckedChanged += new System.EventHandler(this.rb_RightNoFill_CheckedChanged);
//
// rb_RightFill
//
this.rb_RightFill.AutoSize = true;
this.rb_RightFill.Location = new System.Drawing.Point(53, 16);
this.rb_RightFill.Name = "rb_RightFill";
this.rb_RightFill.Size = new System.Drawing.Size(47, 16);
this.rb_RightFill.TabIndex = 19;
this.rb_RightFill.Text = "实心";
this.rb_RightFill.UseVisualStyleBackColor = true;
this.rb_RightFill.CheckedChanged += new System.EventHandler(this.rb_RightFill_CheckedChanged);
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(233, 62);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(41, 12);
this.label7.TabIndex = 22;
this.label7.Text = "颜色:";
//
// txt_RightLineWeight
//
this.txt_RightLineWeight.Location = new System.Drawing.Point(162, 59);
this.txt_RightLineWeight.Name = "txt_RightLineWeight";
this.txt_RightLineWeight.Size = new System.Drawing.Size(45, 21);
this.txt_RightLineWeight.TabIndex = 21;
this.txt_RightLineWeight.Text = "5";
this.txt_RightLineWeight.TextChanged += new System.EventHandler(this.txt_RightLineWeight_TextChanged);
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(127, 62);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(29, 12);
this.label8.TabIndex = 20;
this.label8.Text = "线宽";
//
// txt_RightSize
//
this.txt_RightSize.Location = new System.Drawing.Point(58, 59);
this.txt_RightSize.Name = "txt_RightSize";
this.txt_RightSize.Size = new System.Drawing.Size(45, 21);
this.txt_RightSize.TabIndex = 19;
this.txt_RightSize.Text = "30";
this.txt_RightSize.TextChanged += new System.EventHandler(this.txt_RightSize_TextChanged);
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(23, 62);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(41, 12);
this.label9.TabIndex = 18;
this.label9.Text = "尺寸:";
//
// rb_RightSquare
//
this.rb_RightSquare.AutoSize = true;
this.rb_RightSquare.Location = new System.Drawing.Point(109, 30);
this.rb_RightSquare.Name = "rb_RightSquare";
this.rb_RightSquare.Size = new System.Drawing.Size(47, 16);
this.rb_RightSquare.TabIndex = 14;
this.rb_RightSquare.TabStop = true;
this.rb_RightSquare.Text = "方形";
this.rb_RightSquare.UseVisualStyleBackColor = true;
this.rb_RightSquare.CheckedChanged += new System.EventHandler(this.rb_RightSquare_CheckedChanged);
//
// rb_RightCircle
//
this.rb_RightCircle.AutoSize = true;
this.rb_RightCircle.Checked = true;
this.rb_RightCircle.Location = new System.Drawing.Point(56, 30);
this.rb_RightCircle.Name = "rb_RightCircle";
this.rb_RightCircle.Size = new System.Drawing.Size(47, 16);
this.rb_RightCircle.TabIndex = 13;
this.rb_RightCircle.TabStop = true;
this.rb_RightCircle.Text = "圆形";
this.rb_RightCircle.UseVisualStyleBackColor = true;
this.rb_RightCircle.CheckedChanged += new System.EventHandler(this.rb_RightCircle_CheckedChanged);
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(21, 32);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(41, 12);
this.label11.TabIndex = 12;
this.label11.Text = "形状:";
//
// CountNumberAnalysisDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1177, 744);
this.Controls.Add(this.groupBox8);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox7);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox_review);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBox4);
this.Name = "CountNumberAnalysisDialog";
this.Text = "计数统计";
this.Controls.SetChildIndex(this.groupBox4, 0);
this.Controls.SetChildIndex(this.groupBox1, 0);
this.Controls.SetChildIndex(this.groupBox2, 0);
this.Controls.SetChildIndex(this.groupBox_review, 0);
this.Controls.SetChildIndex(this.groupBox5, 0);
this.Controls.SetChildIndex(this.groupBox6, 0);
this.Controls.SetChildIndex(this.groupBox7, 0);
this.Controls.SetChildIndex(this.groupBox3, 0);
this.Controls.SetChildIndex(this.groupBox8, 0);
this.groupBox4.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.groupBox10.ResumeLayout(false);
this.groupBox10.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox6.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView_results)).EndInit();
this.groupBox7.ResumeLayout(false);
this.groupBox7.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.groupBox8.ResumeLayout(false);
this.groupBox8.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown4)).EndInit();
this.groupBox9.ResumeLayout(false);
this.groupBox9.PerformLayout();
this.ResumeLayout(false);
}
#endregion
///
/// 画布绘制
///
///
///
private void Panel_Paint(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);
if (this.dataGridView1.SelectedRows.Count == 0)
return;
string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString().Replace("相", string.Empty);
//保存处理后的图片
double pantographRatio = 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);
Graphics graphics;
Bitmap newBit;
Bitmap processedBit;
if (this.documentItems[this.listView1.FocusedItem.Index].phaseModels.Count != 0
&& this.documentItems[this.listView1.FocusedItem.Index].phaseModels[0].mat != null)
{
processedBit = BitmapConverter.ToBitmap(this.documentWorkspace.PhaseModels[0].mat);
newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
graphics = Graphics.FromImage(newBit);
graphics.DrawImage(processedBit, new PointF(0, 0));
Draw(graphics);
newBit.Tag = pantographRatio;
tempBit.Add(newBit);
}
else
{
newBit = originalBit.Clone(new Rectangle(0, 0, originalBit.Width, originalBit.Height), originalBit.PixelFormat);
graphics = Graphics.FromImage(newBit);
Draw(graphics);
newBit.Tag = pantographRatio;
tempBit.Add(newBit);
}
if (bitDic1.ContainsKey(tag))
bitDic1[tag] = tempBit;
e.Graphics.ScaleTransform(1 / (float)this.documentWorkspace.ScaleFactor.Ratio, 1 / (float)this.documentWorkspace.ScaleFactor.Ratio);
e.Graphics.TranslateTransform(-x, -y);
}
}
private void getValue(string key, Object value)
{
switch (key)
{
case "parameter1":
rb_LeftCircle.Checked = (int)value == 1 ? true : false;
rb_LeftSquare.Checked = (int)value == 1 ? false : true;
break;
case "parameter2":
rb_leftFill.Checked = (int)value == 1 ? true : false;
rb_leftNoFill.Checked = (int)value == 1 ? false : true;
break;
case "parameter3":
numericUpDown2.Value = Convert.ToDecimal(value);
break;
case "parameter4":
numericUpDown3.Value = Convert.ToDecimal(value);
break;
case "parameter5":
panel1.BackColor = Color.FromArgb((int)value);
break;
case "parameter6":
numericUpDown4.Value = Convert.ToDecimal(value);
break;
case "parameter7":
numericUpDown5.Value = Convert.ToDecimal(value);
break;
case "parameter8":
panel2.BackColor = Color.FromArgb((int)value);
break;
case "parameter10":
rb_RightCircle.Checked = (int)value == 1 ? true : false;
rb_RightSquare.Checked = (int)value == 1 ? false : true;
break;
case "parameter11":
rb_RightFill.Checked = (int)value == 1 ? true : false;
rb_RightNoFill.Checked = (int)value == 1 ? false : true;
break;
case "OpenWhileExportReport":
checkBox1.Checked = Convert.ToBoolean(value);
break;
case "CalculatorDecimalDigits":
numericUpDown1.Value = Convert.ToDecimal(value);
break;
}
}
#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);
}
appWorkspace.SetScriptStartRecording(this.menuId, menuName, args);
}
private object setScriptRecording(string key)
{
object value = null;
switch (key)
{
case "parameter1":
value = rb_LeftCircle.Checked ? 1 : 2;
break;
case "parameter2":
value = rb_leftFill.Checked ? 1 : 2;
break;
case "parameter3":
value = numericUpDown2.Value;
break;
case "parameter4":
value = numericUpDown3.Value;
break;
case "parameter5":
value = panel1.BackColor.ToArgb();
break;
case "parameter6":
value = numericUpDown4.Value;
break;
case "parameter7":
value = numericUpDown5.Value;
break;
case "parameter8":
value = panel2.BackColor.ToArgb();
break;
case "parameter10":
value = rb_RightCircle.Checked ? 1 : 2;
break;
case "parameter11":
value = rb_RightFill.Checked ? 1 : 2;
break;
case "OpenWhileExportReport":
value = checkBox1.Checked;
break;
case "CalculatorDecimalDigits":
value = numericUpDown1.Value;
break;
}
return value;
}
#endregion
}
}