using PaintDotNet.Base.CommTool; using PaintDotNet.Base.SettingModel; using PaintDotNet.DedicatedAnalysis; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Drawing2D; using System.IO; using System.Windows.Forms; using PaintDotNet.CustomControl; using PaintDotNet.DbOpreate.DbBll; using PaintDotNet.DbOpreate.DbModel; using PaintDotNet.Annotation; using PaintDotNet.Base.Functionodel; using static PaintDotNet.Base.DedicatedAnalysis.Inclusions.MethodOfAssessment; using PaintDotNet.Annotation.Enum; using OpenCvSharp; using Point = System.Drawing.Point; using PaintDotNet.Instrument; using OpenCvSharp.Extensions; using System.Linq; using Metis.ParameterSet; using PaintDotNet.Data.Param; using PaintDotNet.Base; namespace PaintDotNet { /// /// 复合率 /// internal class RecombinationRateDialog : PdnBaseForm { #region 控件 private GroupBox groupBox1; private Button button2; private CheckBox checkBox2; private CheckBox checkBox1; private GroupBox groupBox2; private GroupBox groupBox3; private Button button4; private Button button3; private ComboBox comboBox1; private GroupBox groupBox4; private Button button5; private TextBox textBox2; private TextBox textBox1; private Label label2; private Label label1; private DataGridView dataGridView1; private GroupBox groupBox5; private DataGridView dataGridView2; private Button button8; private Button button7; private Button button6; private GroupBox groupBox6; private Button button10; private Button button9; private GroupBox groupBox7; private GroupBox groupBox8; private Label label5; private Button button14; private Button button13; private DataGridView dataGridView4; private Button button12; private Button button11; private ListView listView1; private Button button1; #endregion #region 辅助线样式 /// /// 线条数 /// private int linesNumber; /// /// 线颜色 /// private int lineColor; /// /// 线宽 /// private int lineWidth; /// /// 间距 /// private float lineSpacing; /// /// 文字字体 /// private string lineFont; /// /// 文字字号 /// private int lineFontSize; #endregion #region 测量点样式 /// /// 点颜色 /// private int pointColor; /// /// 点样式 0:空心 1:实心 /// private int pointStyle; /// /// 点宽度 /// private int pointWidth; /// /// 直径 /// private float pointDiameter; /// /// 文字字体 /// private string pointFont; /// /// 文字字号 /// private int pointFontSize; /// /// 显示点标记符号 true:显示 false:不显示 /// private bool pointMarkerSymbol; /// /// 小数 /// private int decimalCls; /// /// 是否全部显示 /// private bool allShow = false; #endregion #region 控制测量点个数 /// /// 控制测量点个数 /// private List pointCountA1 = new List(); private List pointCountA2 = new List(); private List pointCountA3 = new List(); private List pointCountB1 = new List(); private List pointCountB2 = new List(); private List pointCountB3 = new List(); private List pointCountB4 = new List(); private List pointCountC1 = new List(); private List pointCountC2 = new List(); private List pointCountC3 = new List(); private List pointCountC4 = new List(); private List pointCountC5 = new List(); #endregion private PointF m_StartPoint = Point.Empty; private bool m_canMove; /// /// 辅助线上可绘制的点数 /// private int pointDrawCount; /// /// 辅助线线条数是否可改变 /// private bool lineChange = true; /// /// 样品测量点记录 /// private List pointDataTables = new List(); /// /// 图片测量记录 /// private List pictureDataTables = new List(); /// /// 测量点 /// public List> pointRectangleFs = new List>(); /// /// 0:添加 1:选择 2:删除 /// private int operationK = -1; /// /// 被选择的点 /// private int selected = -1; /// /// 获取鼠标位置 /// private int mouseX = 0; private int mouseY = 0; /// /// 数据变化 /// private bool saveSuccess = false; /// /// 是否开始绘制测量点 /// private bool pointDrawkb = false; /// /// 是否选择了图片 /// private bool selectPicture = false; /// /// 工件类型 /// private string type; private string oldValue; public string selectItemValue; /// /// 主控件 /// private AppWorkspace appWorkspace; private ImageList imageList1; private IContainer components; /// /// 图像面板 /// private DocumentWorkspaceWindow documentWorkspace; private Dictionary documentItems; /// /// 公共按钮 /// private CommonControlButtons commonControlButtons; private Button button15; /// /// 保存用于生成报告的图片 /// private List bitList; /// /// 储存点击保存结果后的所有原图与分析图 /// private Dictionary> bitDic = new Dictionary>(); private Dictionary> bitDic1 = new Dictionary>(); private int changeCount; /// /// 工件类型 /// private const string constTypeA = "a"; private const string constTypeB = "b"; private const string constTypeC = "c"; private const string constTypeD = "d"; private const string constTypeE = "e"; /// /// 单位 /// private double unitLength; /// /// 中间数据 /// private List tempDataModel = new List(); /// /// 第一条线的各点截距 /// private List> lengthL1 = new List>(); /// /// 第二条线的各点截距 /// private List> lengthL2 = new List>(); /// /// 第三条线的各点截距 /// private List> lengthL3 = new List>(); /// /// 第四条线的各点截距 /// private List> lengthL4 = new List>(); /// /// 第五条线的各点截距 /// private List> lengthL5 = new List>(); private Button button16; private NumericUpDown numericUpDown1; private ListView listView2; private DataGridView dataGridView3; private Button button17; private DataGridViewTextBoxColumn Column1; private DataGridViewTextBoxColumn Column2; private DataGridViewTextBoxColumn Column3; private DataGridViewTextBoxColumn Column4; private DataGridViewTextBoxColumn Column5; private DataGridViewTextBoxColumn Column6; private DataGridViewTextBoxColumn Column7; private DataGridViewTextBoxColumn Column8; private DataGridViewTextBoxColumn Column9; private DataGridViewTextBoxColumn Column10; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn2; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn3; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn4; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn5; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn6; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7; private DataGridViewTextBoxColumn dataGridViewTextBoxColumn8; private DataGridViewTextBoxColumn pointName; private DataGridViewTextBoxColumn pointDeviation; private DataGridViewTextBoxColumn pointL1; private DataGridViewTextBoxColumn pointL2; private DataGridViewTextBoxColumn pointL3; private DataGridViewTextBoxColumn pointL4; private DataGridViewTextBoxColumn pointL5; private DataGridViewTextBoxColumn pointAverage; private DataGridViewTextBoxColumn nname; private DataGridViewTextBoxColumn explain; private DataGridViewTextBoxColumn operation; private DataGridViewTextBoxColumn Column11; private WorkpieceMaintenanceModel workpieceMaintenanceModel = new WorkpieceMaintenanceModel(); private int defaultIndex = -1; private int menuId; private string menuName; /// /// 是否脚本运行 /// private Boolean initScriptValues = false; // /// 保存窗口参数 /// private GrainSizeAnalysisModel analysisModel; private const string ParamKey_ShowData = "showData";//显示数据 private const string ParamKey_Report = "report";//报告设置 private const string ParamKey_DecimalPlace = "decimalPlace";//保留小数位数 public RecombinationRateDialog(AppWorkspace appWorkspace, PdnMenuItem menuItem) { this.menuId = menuItem.MenuId; this.menuName = menuItem.Text; string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml"; GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open)); this.analysisModel = analysisModelXml.cloneListParamModel(this.menuId); foreach (var item in this.analysisModel.ListParam) item.setValue(); InitializeComponent(); InitializeLanguageText(); this.button3.Visible = true; this.button15.Visible = false; this.button11.Visible = true; this.button16.Visible = false; this.appWorkspace = appWorkspace; //this.appWorkspace.getMeasureInfo().TryGetValue(MeasurementUnit.Micron, out unitLength); // //初始化图像控件 // this.documentWorkspace = new DocumentWorkspaceWindow(this.appWorkspace); this.documentWorkspace.Dock = DockStyle.Fill; this.documentWorkspace.HookMouseEvents(); this.documentWorkspace.AuxiliaryLineEnabled = false; this.documentWorkspace.Visible = false; this.groupBox7.Controls.Add(documentWorkspace); // //初始化操作按钮 // this.commonControlButtons = new CommonControlButtons(); this.commonControlButtons.Dock = DockStyle.Top; this.commonControlButtons.Height = 30; this.commonControlButtons.HideZoomToWindowAndActualSize(); this.commonControlButtons.Visible = false; this.groupBox7.Controls.Add(commonControlButtons); /// 测量点操作限制 this.button6.Enabled = this.pointDrawkb; this.button7.Enabled = this.pointDrawkb; this.button8.Enabled = this.pointDrawkb; //初始化头 this.listView2.View = View.Details; ColumnHeader header0 = new ColumnHeader(); header0.Text = ""; header0.Width = 180; this.listView2.Columns.Add(header0); documentWorkspace.panel.MouseDown += OnMouseDown; documentWorkspace.panel.Paint += Panel_Paint; documentWorkspace.panel.MouseMove += onMouseMove; documentWorkspace.panel.MouseUp += onMouseUp; //如果是脚本执行,将参数带入 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 {//读取上次关闭窗口时保存的参数 GetListParamModel(); } InitPicList(); RefreshCombobox(); RefreshPanel(); InitCommonButtonEvent(); //SetStyle(ControlStyles.UserPaint, true); //SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景. //SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲 SetAnalyzeModelFromXml("Template.Manager.item3.RecombinationRate"); foreach (DataGridViewColumn item in this.dataGridView1.Columns) { item.SortMode = DataGridViewColumnSortMode.NotSortable; } for (int i = 0; i < this.dataGridView1.Columns.Count; i++) { this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } for (int i = 0; i < this.dataGridView2.Columns.Count; i++) { this.dataGridView2.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } for (int i = 0; i < this.dataGridView3.Columns.Count; i++) { this.dataGridView3.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } for (int i = 0; i < this.dataGridView4.Columns.Count; i++) { this.dataGridView4.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } } 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) { this.documentWorkspace.ZoomIn(); } private void zoomOutButton_Click(object sender, EventArgs e) { 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; } 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; } } /// /// 初始化图片列表数据 /// public void InitPicList() { this.documentItems = new Dictionary(); // 构造工作结构 for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++) { //Bitmap bitmap = this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.CreateAliasedBitmap(); 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(this.appWorkspace.DocumentWorkspaces[i].CompositionSurface.CreatedAliasedMat().Clone(), 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 Mat imageMat; public GraphicsList graphicsList; public List phaseModels; public AnalysisResult analysisResult; public DocumentItem(Mat imageMat, GraphicsList graphicsList, List phaseModels) { this.imageMat = imageMat; this.graphicsList = graphicsList; this.phaseModels = phaseModels; } } #region 初始化 private void InitializeLanguageText() { this.button1.Text = PdnResources.GetString("Menu.Setting.Text"); this.groupBox1.Text = PdnResources.GetString("Menu.operation.text"); this.button2.Text = PdnResources.GetString("Menu.Saveresult.text"); this.checkBox2.Text = PdnResources.GetString("Menu.Opensettingsatingreport.text"); this.checkBox1.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.Displaydataontheimage.text"); this.groupBox2.Text = PdnResources.GetString("Menu.Tools.ImageIndex.Text"); this.groupBox3.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Non-ferrousmetals.artifactselect.text"); this.button15.Text = PdnResources.GetString("Menu.Stopmeasure.text"); this.button4.Text = PdnResources.GetString("Menu.Setting.Text"); this.button3.Text = PdnResources.GetString("Menu.Startmeasuring.text"); this.groupBox4.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Samplemaintenance.text"); this.nname.HeaderText = PdnResources.GetString("Menu.name.text"); this.operation.HeaderText = PdnResources.GetString("Menu.operation.text"); this.Column11.HeaderText = PdnResources.GetString("Menu.operation.text"); this.button5.Text = PdnResources.GetString("CommonAction.Save"); this.label2.Text = PdnResources.GetString("Menu.instruction.text") + ":"; this.label1.Text = PdnResources.GetString("Menu.samplename.text") + ":"; this.groupBox5.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Measuringpointrecord.text"); this.dataGridViewTextBoxColumn1.HeaderText = PdnResources.GetString("Menu.name.text"); this.dataGridViewTextBoxColumn2.HeaderText = PdnResources.GetString("Menu.Targetvalue/deviation.text"); this.dataGridViewTextBoxColumn8.HeaderText = PdnResources.GetString("Menu.Image.Average.Text") + "%"; this.pointName.HeaderText = PdnResources.GetString("Menu.name.text"); this.pointDeviation.HeaderText = PdnResources.GetString("Menu.Targetvalue/deviation.text"); this.pointAverage.HeaderText = PdnResources.GetString("Menu.Image.Average.Text") + "%"; this.button8.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Selectcompoundnode.text"); this.button7.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Deletecompoundnode.text"); this.button6.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Addcompoundnode.text"); this.groupBox6.Text = PdnResources.GetString("Menu.othersettings.text"); this.button10.Text = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.Measurinsetting.text"); this.button9.Text = PdnResources.GetString("Menu.Auxiliarylinesettings.text"); this.groupBox7.Text = PdnResources.GetString("Menu.Preview.text"); this.groupBox8.Text = PdnResources.GetString("Menu.Analysisresult.text"); this.button17.Text = PdnResources.GetString("Menu.Exportproject.text"); this.button16.Text = PdnResources.GetString("Menu.Cancelshowall.text"); this.label5.Text = PdnResources.GetString("Menu.Decimal.text") + ":"; this.button14.Text = PdnResources.GetString("Menu.Exportresults.text"); this.button13.Text = PdnResources.GetString("Menu.Tools.CreateReport.Text"); this.Column1.HeaderText = PdnResources.GetString("Menu.picture.Text"); this.Column2.HeaderText = PdnResources.GetString("Menu.Dedicatedanalysis.Nmetals.sample.text"); this.Column3.HeaderText = PdnResources.GetString("Menu.name.text"); this.Column4.HeaderText = PdnResources.GetString("Menu.Targetvalue/deviation.text"); this.Column10.HeaderText = PdnResources.GetString("Menu.Image.Average.Text") + "%"; this.button12.Text = PdnResources.GetString("Menu.Edit.Delete.Text"); this.button11.Text = PdnResources.GetString("Menu.Showall.text"); this.Text = PdnResources.GetString("Menu.DedicatedAnalysis.NonferrousMetal.RecombinationRate.Text"); this.explain.HeaderText = PdnResources.GetString("Menu.instruction.text"); } 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(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle(); this.button1 = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.button2 = new System.Windows.Forms.Button(); this.checkBox2 = new System.Windows.Forms.CheckBox(); this.checkBox1 = new System.Windows.Forms.CheckBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.listView1 = new System.Windows.Forms.ListView(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.button15 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.nname = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.explain = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.operation = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column11 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.button5 = new System.Windows.Forms.Button(); this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.dataGridView3 = new System.Windows.Forms.DataGridView(); this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridView2 = new System.Windows.Forms.DataGridView(); this.pointName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pointDeviation = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pointL1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pointL2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pointL3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pointL4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pointL5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.pointAverage = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.button8 = new System.Windows.Forms.Button(); this.button7 = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button(); this.groupBox6 = new System.Windows.Forms.GroupBox(); this.button10 = new System.Windows.Forms.Button(); this.button9 = new System.Windows.Forms.Button(); this.groupBox7 = new System.Windows.Forms.GroupBox(); this.groupBox8 = new System.Windows.Forms.GroupBox(); this.button17 = new System.Windows.Forms.Button(); this.listView2 = new System.Windows.Forms.ListView(); this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); this.button16 = new System.Windows.Forms.Button(); this.label5 = new System.Windows.Forms.Label(); this.button14 = new System.Windows.Forms.Button(); this.button13 = new System.Windows.Forms.Button(); this.dataGridView4 = new System.Windows.Forms.DataGridView(); this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.button12 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox4.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.groupBox5.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); this.groupBox6.SuspendLayout(); this.groupBox8.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).BeginInit(); this.SuspendLayout(); // // button1 // this.button1.BackColor = System.Drawing.SystemColors.Control; this.button1.Location = new System.Drawing.Point(15, 14); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(84, 30); this.button1.TabIndex = 0; this.button1.UseVisualStyleBackColor = false; this.button1.Click += new System.EventHandler(this.button1_Click); // // 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.button2); this.groupBox1.Controls.Add(this.checkBox2); this.groupBox1.Controls.Add(this.checkBox1); this.groupBox1.Controls.Add(this.button1); this.groupBox1.Location = new System.Drawing.Point(14, 3); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(1081, 50); this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; // // button2 // this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.button2.BackColor = System.Drawing.SystemColors.Control; this.button2.Location = new System.Drawing.Point(985, 14); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(84, 30); this.button2.TabIndex = 3; this.button2.UseVisualStyleBackColor = false; this.button2.Click += new System.EventHandler(this.button2_Click); // // checkBox2 // this.checkBox2.AutoSize = true; this.checkBox2.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; this.checkBox2.Location = new System.Drawing.Point(288, 25); this.checkBox2.Name = "checkBox2"; this.checkBox2.Size = new System.Drawing.Size(15, 14); this.checkBox2.TabIndex = 2; this.checkBox2.UseVisualStyleBackColor = true; // // checkBox1 // this.checkBox1.AutoSize = true; this.checkBox1.Location = new System.Drawing.Point(114, 25); this.checkBox1.MaximumSize = new System.Drawing.Size(200, 200); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing.Size(15, 14); this.checkBox1.TabIndex = 1; this.checkBox1.UseVisualStyleBackColor = true; this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); // // groupBox2 // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox2.Controls.Add(this.listView1); this.groupBox2.Location = new System.Drawing.Point(14, 59); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(135, 497); this.groupBox2.TabIndex = 2; this.groupBox2.TabStop = false; // // listView1 // this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.listView1.HideSelection = false; this.listView1.LargeImageList = this.imageList1; this.listView1.Location = new System.Drawing.Point(5, 17); this.listView1.MultiSelect = false; this.listView1.Name = "listView1"; this.listView1.Size = new System.Drawing.Size(124, 474); this.listView1.TabIndex = 0; this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView1_ItemSelectionChanged); this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged); this.listView1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDown); 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; // // groupBox3 // this.groupBox3.Controls.Add(this.button15); this.groupBox3.Controls.Add(this.button4); this.groupBox3.Controls.Add(this.button3); this.groupBox3.Controls.Add(this.comboBox1); this.groupBox3.Location = new System.Drawing.Point(153, 59); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(356, 51); this.groupBox3.TabIndex = 4; this.groupBox3.TabStop = false; // // button15 // this.button15.BackColor = System.Drawing.SystemColors.Control; this.button15.Location = new System.Drawing.Point(195, 15); this.button15.Name = "button15"; this.button15.Size = new System.Drawing.Size(106, 26); this.button15.TabIndex = 6; this.button15.UseVisualStyleBackColor = false; this.button15.Click += new System.EventHandler(this.button15_Click); // // button4 // this.button4.BackColor = System.Drawing.SystemColors.Control; this.button4.Location = new System.Drawing.Point(302, 15); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(53, 26); this.button4.TabIndex = 5; this.button4.UseVisualStyleBackColor = false; this.button4.Click += new System.EventHandler(this.button4_Click); // // button3 // this.button3.BackColor = System.Drawing.SystemColors.Control; this.button3.Location = new System.Drawing.Point(195, 15); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(106, 26); this.button3.TabIndex = 4; this.button3.UseVisualStyleBackColor = false; this.button3.Click += new System.EventHandler(this.button3_Click); // // comboBox1 // this.comboBox1.FormattingEnabled = true; this.comboBox1.Location = new System.Drawing.Point(16, 17); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(173, 20); this.comboBox1.TabIndex = 0; // // 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.dataGridView1); this.groupBox4.Controls.Add(this.button5); this.groupBox4.Controls.Add(this.textBox2); this.groupBox4.Controls.Add(this.textBox1); this.groupBox4.Controls.Add(this.label2); this.groupBox4.Controls.Add(this.label1); this.groupBox4.Location = new System.Drawing.Point(153, 116); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(356, 168); this.groupBox4.TabIndex = 5; this.groupBox4.TabStop = false; // // dataGridView1 // this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.AllowUserToResizeColumns = false; this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F); dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.nname, this.explain, this.operation, this.Column11}); this.dataGridView1.Location = new System.Drawing.Point(6, 46); this.dataGridView1.MultiSelect = false; this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; this.dataGridView1.RowHeadersVisible = false; this.dataGridView1.RowTemplate.Height = 23; this.dataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.dataGridView1.Size = new System.Drawing.Size(340, 116); this.dataGridView1.TabIndex = 7; this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick); this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvData_CellContentClick); this.dataGridView1.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgvData_CellMouseClick); this.dataGridView1.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridView1_CellValidating); this.dataGridView1.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellValueChanged); this.dataGridView1.RowLeave += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_RowLeave); this.dataGridView1.SelectionChanged += new System.EventHandler(this.dataGridView1_SelectionChanged); // // nname // dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.nname.DefaultCellStyle = dataGridViewCellStyle2; this.nname.FillWeight = 103.5533F; this.nname.HeaderText = "nname"; this.nname.Name = "nname"; this.nname.Width = 80; // // explain // dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; this.explain.DefaultCellStyle = dataGridViewCellStyle3; this.explain.FillWeight = 109.3963F; this.explain.HeaderText = "explain"; this.explain.Name = "explain"; this.explain.Width = 157; // // operation // dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.operation.DefaultCellStyle = dataGridViewCellStyle4; this.operation.FillWeight = 87.05037F; this.operation.HeaderText = "operation"; this.operation.Name = "operation"; this.operation.Width = 50; // // Column11 // dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column11.DefaultCellStyle = dataGridViewCellStyle5; this.Column11.HeaderText = "Column11"; this.Column11.Name = "Column11"; this.Column11.Width = 50; // // button5 // this.button5.BackColor = System.Drawing.SystemColors.Control; this.button5.Location = new System.Drawing.Point(304, 19); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(42, 22); this.button5.TabIndex = 6; this.button5.UseVisualStyleBackColor = false; this.button5.Click += new System.EventHandler(this.button5_Click); // // textBox2 // this.textBox2.Location = new System.Drawing.Point(166, 19); this.textBox2.Name = "textBox2"; this.textBox2.Size = new System.Drawing.Size(135, 21); this.textBox2.TabIndex = 3; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(65, 19); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(60, 21); this.textBox1.TabIndex = 2; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(127, 24); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(0, 12); this.label2.TabIndex = 1; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(4, 24); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(0, 12); this.label1.TabIndex = 0; // // groupBox5 // this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.groupBox5.Controls.Add(this.dataGridView3); this.groupBox5.Controls.Add(this.dataGridView2); this.groupBox5.Controls.Add(this.button8); this.groupBox5.Controls.Add(this.button7); this.groupBox5.Controls.Add(this.button6); this.groupBox5.Location = new System.Drawing.Point(153, 290); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new System.Drawing.Size(356, 201); this.groupBox5.TabIndex = 6; this.groupBox5.TabStop = false; // // dataGridView3 // this.dataGridView3.AllowUserToAddRows = false; this.dataGridView3.AllowUserToResizeColumns = false; this.dataGridView3.BackgroundColor = System.Drawing.SystemColors.ControlLightLight; dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 9F); dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridView3.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6; this.dataGridView3.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView3.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridViewTextBoxColumn1, this.dataGridViewTextBoxColumn2, this.dataGridViewTextBoxColumn3, this.dataGridViewTextBoxColumn4, this.dataGridViewTextBoxColumn5, this.dataGridViewTextBoxColumn6, this.dataGridViewTextBoxColumn7, this.dataGridViewTextBoxColumn8}); this.dataGridView3.Location = new System.Drawing.Point(6, 52); this.dataGridView3.Name = "dataGridView3"; this.dataGridView3.ReadOnly = true; this.dataGridView3.RowHeadersVisible = false; this.dataGridView3.RowTemplate.Height = 23; this.dataGridView3.Size = new System.Drawing.Size(340, 143); this.dataGridView3.TabIndex = 10; this.dataGridView3.Visible = false; this.dataGridView3.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView3_CellValueChanged); // // dataGridViewTextBoxColumn1 // dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle7; this.dataGridViewTextBoxColumn1.FillWeight = 199.6873F; this.dataGridViewTextBoxColumn1.HeaderText = "dataGridViewTextBoxColumn1"; this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; this.dataGridViewTextBoxColumn1.ReadOnly = true; this.dataGridViewTextBoxColumn1.Width = 84; // // dataGridViewTextBoxColumn2 // dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle8; this.dataGridViewTextBoxColumn2.FillWeight = 154.1869F; this.dataGridViewTextBoxColumn2.HeaderText = "dataGridViewTextBoxColumn2"; this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; this.dataGridViewTextBoxColumn2.ReadOnly = true; this.dataGridViewTextBoxColumn2.Width = 150; // // dataGridViewTextBoxColumn3 // dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle9; this.dataGridViewTextBoxColumn3.FillWeight = 68.40062F; this.dataGridViewTextBoxColumn3.HeaderText = "L1%"; this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; this.dataGridViewTextBoxColumn3.ReadOnly = true; this.dataGridViewTextBoxColumn3.Width = 29; // // dataGridViewTextBoxColumn4 // dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle10; this.dataGridViewTextBoxColumn4.FillWeight = 70.44655F; this.dataGridViewTextBoxColumn4.HeaderText = "L2%"; this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; this.dataGridViewTextBoxColumn4.ReadOnly = true; this.dataGridViewTextBoxColumn4.Width = 30; // // dataGridViewTextBoxColumn5 // dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle11; this.dataGridViewTextBoxColumn5.FillWeight = 72.72363F; this.dataGridViewTextBoxColumn5.HeaderText = "L3%"; this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5"; this.dataGridViewTextBoxColumn5.ReadOnly = true; this.dataGridViewTextBoxColumn5.Width = 30; // // dataGridViewTextBoxColumn6 // dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.dataGridViewTextBoxColumn6.DefaultCellStyle = dataGridViewCellStyle12; this.dataGridViewTextBoxColumn6.FillWeight = 75.25803F; this.dataGridViewTextBoxColumn6.HeaderText = "L4%"; this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6"; this.dataGridViewTextBoxColumn6.ReadOnly = true; this.dataGridViewTextBoxColumn6.Width = 32; // // dataGridViewTextBoxColumn7 // dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.dataGridViewTextBoxColumn7.DefaultCellStyle = dataGridViewCellStyle13; this.dataGridViewTextBoxColumn7.FillWeight = 78.07879F; this.dataGridViewTextBoxColumn7.HeaderText = "L5%"; this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7"; this.dataGridViewTextBoxColumn7.ReadOnly = true; this.dataGridViewTextBoxColumn7.Width = 33; // // dataGridViewTextBoxColumn8 // dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.dataGridViewTextBoxColumn8.DefaultCellStyle = dataGridViewCellStyle14; this.dataGridViewTextBoxColumn8.FillWeight = 81.21828F; this.dataGridViewTextBoxColumn8.HeaderText = "dataGridViewTextBoxColumn8"; this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8"; this.dataGridViewTextBoxColumn8.ReadOnly = true; this.dataGridViewTextBoxColumn8.Width = 150; // // dataGridView2 // this.dataGridView2.AllowUserToAddRows = false; this.dataGridView2.BackgroundColor = System.Drawing.SystemColors.ControlLightLight; dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle15.Font = new System.Drawing.Font("宋体", 9F); dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle15; this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.pointName, this.pointDeviation, this.pointL1, this.pointL2, this.pointL3, this.pointL4, this.pointL5, this.pointAverage}); this.dataGridView2.Location = new System.Drawing.Point(6, 52); this.dataGridView2.Name = "dataGridView2"; this.dataGridView2.ReadOnly = true; this.dataGridView2.RowHeadersVisible = false; this.dataGridView2.RowTemplate.Height = 23; this.dataGridView2.Size = new System.Drawing.Size(340, 143); this.dataGridView2.TabIndex = 9; // // pointName // dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.pointName.DefaultCellStyle = dataGridViewCellStyle16; this.pointName.HeaderText = "pointName"; this.pointName.Name = "pointName"; this.pointName.ReadOnly = true; this.pointName.Width = 42; // // pointDeviation // dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.pointDeviation.DefaultCellStyle = dataGridViewCellStyle17; this.pointDeviation.HeaderText = "pointDeviation"; this.pointDeviation.Name = "pointDeviation"; this.pointDeviation.ReadOnly = true; this.pointDeviation.Width = 150; // // pointL1 // dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.pointL1.DefaultCellStyle = dataGridViewCellStyle18; this.pointL1.HeaderText = "L1%"; this.pointL1.Name = "pointL1"; this.pointL1.ReadOnly = true; this.pointL1.Width = 42; // // pointL2 // dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.pointL2.DefaultCellStyle = dataGridViewCellStyle19; this.pointL2.HeaderText = "L2%"; this.pointL2.Name = "pointL2"; this.pointL2.ReadOnly = true; this.pointL2.Width = 43; // // pointL3 // dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.pointL3.DefaultCellStyle = dataGridViewCellStyle20; this.pointL3.HeaderText = "L3%"; this.pointL3.Name = "pointL3"; this.pointL3.ReadOnly = true; this.pointL3.Width = 42; // // pointL4 // dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.pointL4.DefaultCellStyle = dataGridViewCellStyle21; this.pointL4.HeaderText = "L4%"; this.pointL4.Name = "pointL4"; this.pointL4.ReadOnly = true; this.pointL4.Width = 42; // // pointL5 // dataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.pointL5.DefaultCellStyle = dataGridViewCellStyle22; this.pointL5.HeaderText = "L5%"; this.pointL5.Name = "pointL5"; this.pointL5.ReadOnly = true; this.pointL5.Width = 42; // // pointAverage // dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.pointAverage.DefaultCellStyle = dataGridViewCellStyle23; this.pointAverage.HeaderText = "pointAverage"; this.pointAverage.Name = "pointAverage"; this.pointAverage.ReadOnly = true; this.pointAverage.Width = 70; // // button8 // this.button8.BackColor = System.Drawing.SystemColors.Control; this.button8.Location = new System.Drawing.Point(246, 20); this.button8.Name = "button8"; this.button8.Size = new System.Drawing.Size(99, 26); this.button8.TabIndex = 8; this.button8.UseVisualStyleBackColor = false; this.button8.Click += new System.EventHandler(this.button8_Click); this.button8.LostFocus += new System.EventHandler(this.button8_LostFocus); // // button7 // this.button7.BackColor = System.Drawing.SystemColors.Control; this.button7.Location = new System.Drawing.Point(127, 20); this.button7.Name = "button7"; this.button7.Size = new System.Drawing.Size(113, 26); this.button7.TabIndex = 7; this.button7.UseVisualStyleBackColor = false; this.button7.Click += new System.EventHandler(this.button7_Click); this.button7.LostFocus += new System.EventHandler(this.button7_LostFocus); // // button6 // this.button6.BackColor = System.Drawing.SystemColors.Control; this.button6.Location = new System.Drawing.Point(9, 20); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(112, 26); this.button6.TabIndex = 6; this.button6.UseVisualStyleBackColor = false; this.button6.Click += new System.EventHandler(this.button6_Click); this.button6.LostFocus += new System.EventHandler(this.button6_LostFocus); // // groupBox6 // this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.groupBox6.Controls.Add(this.button10); this.groupBox6.Controls.Add(this.button9); this.groupBox6.Location = new System.Drawing.Point(153, 497); this.groupBox6.Name = "groupBox6"; this.groupBox6.Size = new System.Drawing.Size(356, 59); this.groupBox6.TabIndex = 7; this.groupBox6.TabStop = false; // // button10 // this.button10.BackColor = System.Drawing.SystemColors.Control; this.button10.Location = new System.Drawing.Point(182, 24); this.button10.Name = "button10"; this.button10.Size = new System.Drawing.Size(138, 26); this.button10.TabIndex = 11; this.button10.UseVisualStyleBackColor = false; this.button10.Click += new System.EventHandler(this.button10_Click); // // button9 // this.button9.BackColor = System.Drawing.SystemColors.Control; this.button9.Location = new System.Drawing.Point(16, 23); this.button9.Name = "button9"; this.button9.Size = new System.Drawing.Size(148, 26); this.button9.TabIndex = 10; this.button9.UseVisualStyleBackColor = false; this.button9.Click += new System.EventHandler(this.button9_Click); // // groupBox7 // this.groupBox7.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.groupBox7.Location = new System.Drawing.Point(515, 60); this.groupBox7.Name = "groupBox7"; this.groupBox7.Size = new System.Drawing.Size(580, 496); this.groupBox7.TabIndex = 8; this.groupBox7.TabStop = false; // // groupBox8 // this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox8.Controls.Add(this.button17); this.groupBox8.Controls.Add(this.listView2); this.groupBox8.Controls.Add(this.numericUpDown1); this.groupBox8.Controls.Add(this.button16); this.groupBox8.Controls.Add(this.label5); this.groupBox8.Controls.Add(this.button14); this.groupBox8.Controls.Add(this.button13); this.groupBox8.Controls.Add(this.dataGridView4); this.groupBox8.Controls.Add(this.button12); this.groupBox8.Controls.Add(this.button11); this.groupBox8.Location = new System.Drawing.Point(14, 562); this.groupBox8.Name = "groupBox8"; this.groupBox8.Size = new System.Drawing.Size(1081, 204); this.groupBox8.TabIndex = 9; this.groupBox8.TabStop = false; // // button17 // this.button17.Anchor = System.Windows.Forms.AnchorStyles.Right; this.button17.BackColor = System.Drawing.SystemColors.Control; this.button17.Location = new System.Drawing.Point(941, 102); this.button17.Name = "button17"; this.button17.Size = new System.Drawing.Size(128, 26); this.button17.TabIndex = 23; this.button17.UseVisualStyleBackColor = false; this.button17.Click += new System.EventHandler(this.button17_Click); // // listView2 // this.listView2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.listView2.FullRowSelect = true; this.listView2.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; this.listView2.HideSelection = false; this.listView2.Location = new System.Drawing.Point(16, 56); this.listView2.Name = "listView2"; this.listView2.Size = new System.Drawing.Size(181, 140); this.listView2.TabIndex = 22; this.listView2.UseCompatibleStateImageBehavior = false; this.listView2.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView2_ItemSelectionChanged); this.listView2.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged); // // numericUpDown1 // this.numericUpDown1.Anchor = System.Windows.Forms.AnchorStyles.Right; this.numericUpDown1.Location = new System.Drawing.Point(997, 163); this.numericUpDown1.Maximum = new decimal(new int[] { 10, 0, 0, 0}); this.numericUpDown1.Name = "numericUpDown1"; this.numericUpDown1.Size = new System.Drawing.Size(56, 21); this.numericUpDown1.TabIndex = 21; this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); // // button16 // this.button16.BackColor = System.Drawing.SystemColors.Control; this.button16.Location = new System.Drawing.Point(16, 20); this.button16.Name = "button16"; this.button16.Size = new System.Drawing.Size(93, 26); this.button16.TabIndex = 20; this.button16.UseVisualStyleBackColor = false; this.button16.Click += new System.EventHandler(this.button16_Click); // // label5 // this.label5.Anchor = System.Windows.Forms.AnchorStyles.Right; this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(958, 169); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(0, 12); this.label5.TabIndex = 18; // // button14 // this.button14.Anchor = System.Windows.Forms.AnchorStyles.Right; this.button14.BackColor = System.Drawing.SystemColors.Control; this.button14.Location = new System.Drawing.Point(941, 68); this.button14.Name = "button14"; this.button14.Size = new System.Drawing.Size(128, 26); this.button14.TabIndex = 16; this.button14.UseVisualStyleBackColor = false; this.button14.Click += new System.EventHandler(this.button14_Click); // // button13 // this.button13.Anchor = System.Windows.Forms.AnchorStyles.Right; this.button13.BackColor = System.Drawing.SystemColors.Control; this.button13.Location = new System.Drawing.Point(941, 34); this.button13.Name = "button13"; this.button13.Size = new System.Drawing.Size(128, 26); this.button13.TabIndex = 12; this.button13.UseVisualStyleBackColor = false; this.button13.Click += new System.EventHandler(this.button13_Click); // // dataGridView4 // this.dataGridView4.AllowUserToAddRows = false; this.dataGridView4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dataGridView4.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dataGridView4.BackgroundColor = System.Drawing.SystemColors.ControlLightLight; dataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; dataGridViewCellStyle24.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle24.Font = new System.Drawing.Font("宋体", 9F); dataGridViewCellStyle24.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle24.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle24.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle24.WrapMode = System.Windows.Forms.DataGridViewTriState.True; this.dataGridView4.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle24; this.dataGridView4.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView4.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Column1, this.Column2, this.Column3, this.Column4, this.Column5, this.Column6, this.Column7, this.Column8, this.Column9, this.Column10}); this.dataGridView4.Location = new System.Drawing.Point(228, 20); this.dataGridView4.Name = "dataGridView4"; this.dataGridView4.RowHeadersVisible = false; this.dataGridView4.RowTemplate.Height = 23; this.dataGridView4.Size = new System.Drawing.Size(693, 176); this.dataGridView4.TabIndex = 15; // // Column1 // dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column1.DefaultCellStyle = dataGridViewCellStyle25; this.Column1.FillWeight = 91.37055F; this.Column1.HeaderText = "Column1"; this.Column1.Name = "Column1"; // // Column2 // dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column2.DefaultCellStyle = dataGridViewCellStyle26; this.Column2.FillWeight = 91.37055F; this.Column2.HeaderText = "Column2"; this.Column2.Name = "Column2"; // // Column3 // dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column3.DefaultCellStyle = dataGridViewCellStyle27; this.Column3.FillWeight = 91.37055F; this.Column3.HeaderText = "Column3"; this.Column3.Name = "Column3"; // // Column4 // dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column4.DefaultCellStyle = dataGridViewCellStyle28; this.Column4.FillWeight = 177.665F; this.Column4.HeaderText = "Column4"; this.Column4.Name = "Column4"; // // Column5 // dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column5.DefaultCellStyle = dataGridViewCellStyle29; this.Column5.FillWeight = 91.37055F; this.Column5.HeaderText = "L1%"; this.Column5.Name = "Column5"; // // Column6 // dataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column6.DefaultCellStyle = dataGridViewCellStyle30; this.Column6.FillWeight = 91.37055F; this.Column6.HeaderText = "L2%"; this.Column6.Name = "Column6"; // // Column7 // dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column7.DefaultCellStyle = dataGridViewCellStyle31; this.Column7.FillWeight = 91.37055F; this.Column7.HeaderText = "L3%"; this.Column7.Name = "Column7"; // // Column8 // dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column8.DefaultCellStyle = dataGridViewCellStyle32; this.Column8.FillWeight = 91.37055F; this.Column8.HeaderText = "L4%"; this.Column8.Name = "Column8"; // // Column9 // dataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column9.DefaultCellStyle = dataGridViewCellStyle33; this.Column9.FillWeight = 91.37055F; this.Column9.HeaderText = "L5%"; this.Column9.Name = "Column9"; // // Column10 // dataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; this.Column10.DefaultCellStyle = dataGridViewCellStyle34; this.Column10.FillWeight = 91.37055F; this.Column10.HeaderText = "Column10"; this.Column10.Name = "Column10"; // // button12 // this.button12.BackColor = System.Drawing.SystemColors.Control; this.button12.Location = new System.Drawing.Point(145, 20); this.button12.Name = "button12"; this.button12.Size = new System.Drawing.Size(52, 26); this.button12.TabIndex = 13; this.button12.UseVisualStyleBackColor = false; this.button12.Click += new System.EventHandler(this.button12_Click); // // button11 // this.button11.BackColor = System.Drawing.SystemColors.Control; this.button11.Location = new System.Drawing.Point(15, 20); this.button11.Name = "button11"; this.button11.Size = new System.Drawing.Size(63, 26); this.button11.TabIndex = 12; this.button11.UseVisualStyleBackColor = false; this.button11.Click += new System.EventHandler(this.button11_Click); // // RecombinationRateDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.BackColor = System.Drawing.SystemColors.Control; this.ClientSize = new System.Drawing.Size(1107, 770); this.Controls.Add(this.groupBox8); this.Controls.Add(this.groupBox7); this.Controls.Add(this.groupBox6); this.Controls.Add(this.groupBox5); this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Font = new System.Drawing.Font("宋体", 9F); this.Name = "RecombinationRateDialog"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RecombinationRateDialog_FormClosing); this.Controls.SetChildIndex(this.groupBox1, 0); this.Controls.SetChildIndex(this.groupBox2, 0); this.Controls.SetChildIndex(this.groupBox3, 0); this.Controls.SetChildIndex(this.groupBox4, 0); this.Controls.SetChildIndex(this.groupBox5, 0); this.Controls.SetChildIndex(this.groupBox6, 0); this.Controls.SetChildIndex(this.groupBox7, 0); this.Controls.SetChildIndex(this.groupBox8, 0); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox3.ResumeLayout(false); this.groupBox4.ResumeLayout(false); this.groupBox4.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); this.groupBox5.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView3)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit(); this.groupBox6.ResumeLayout(false); this.groupBox8.ResumeLayout(false); this.groupBox8.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView4)).EndInit(); this.ResumeLayout(false); } #endregion /// /// 刷新工件下拉 /// public void RefreshCombobox() { WorkpieceMaintenanceModel workpieceMaintenanceModel = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkpieceMaintenanceModel.xml", FileMode.Open)); ArrayList arrayList = new ArrayList(); foreach (var item in workpieceMaintenanceModel.Workpieces) { arrayList.Add(item.Name); } this.comboBox1.DataSource = null; this.comboBox1.DataSource = arrayList; if(arrayList.Count > 0) { if (string.IsNullOrEmpty(this.selectItemValue)) this.comboBox1.SelectedIndex = 0; else this.comboBox1.SelectedItem = this.selectItemValue; } } private void listView1_MouseDown(object sender, MouseEventArgs e) { this.changeCount = 0; } private void listView1_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { bool change = false; if (this.changeCount == 0) { if (this.dataGridView2.Rows.Count > 0) { if(this.saveSuccess) { DialogResult dt = MessageBox.Show(PdnResources.GetString("Menu.Whethertosavetherrentpicture.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dt == DialogResult.Yes) { string imgName = this.appWorkspace.DocumentWorkspaces[e.ItemIndex].GetFriendlyName(); string tag = this.imageList1.Images.Keys[e.ItemIndex]; DataTable dataTable1 = new DataTable(); bool replace = false; int add = 0; foreach (ListViewItem item in this.listView2.Items) { if (item.Name.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; } } if (replace || this.listView2.Items.Count == 0 || add == 0) { this.dataGridView4.Rows.Clear(); if (this.linesNumber == 3) { this.dataGridView4.Columns[7].Visible = false; this.dataGridView4.Columns[8].Visible = false; } else if (this.linesNumber == 4) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = false; } else if (this.linesNumber == 5) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = true; } ListViewItem listViewItem = new ListViewItem(); listViewItem.Name = tag; listViewItem.SubItems[0].Text = imgName; listViewItem.Tag = "" + this.linesNumber; if (this.listView2.Items.Count == 0) this.listView2.Items.Add(listViewItem); else this.listView2.Items.Insert(0, listViewItem); dataTable1.TableName = tag; foreach (DataGridViewColumn c in this.dataGridView4.Columns) { dataTable1.Columns.Add(c.HeaderText); } foreach (DataTable dataTable in this.pointDataTables) { for (int r = 0; r < dataTable.Rows.Count; r++) { DataGridViewRow dgvr = new DataGridViewRow(); foreach (DataGridViewColumn Column in this.dataGridView4.Columns) { dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell); } for (int c = 0; c < dataTable.Columns.Count; c++) { dgvr.Cells[0].Value = imgName; dgvr.Cells[1].Value = dataTable.TableName; if (c > 1 && !dataTable.Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))) { if (this.linesNumber == 3) { if (c + 2 != 7 && c + 2 != 8) dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString(); else dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString(); } else if (this.linesNumber == 4) { if (c + 2 != 8) dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString(); else dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString(); } else if (this.linesNumber == 5) { dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString(); } } else dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString(); } this.dataGridView4.Rows.Add(dgvr); DataRow dataRow = dataTable1.NewRow(); for (int c = 0; c < dataTable.Columns.Count + 2; c++) { if (c == 0) dataRow[this.dataGridView4.Columns[c].HeaderText] = imgName; else if (c == 1) dataRow[this.dataGridView4.Columns[c].HeaderText] = dataTable.TableName; else dataRow[this.dataGridView4.Columns[c].HeaderText] = dataTable.Rows[r][c - 2].ToString(); } dataTable1.Rows.Add(dataRow); } } foreach (DataTable dataTable2 in pictureDataTables) { if (dataTable2.TableName.Equals(dataTable1.TableName)) { pictureDataTables.Remove(dataTable2); break; } } this.pictureDataTables.Add(dataTable1); if (this.allShow) AllShow(); this.bitDic.Clear(); foreach (var item in this.bitDic1) { this.bitDic.Add(item.Key, item.Value); } this.listView2.Items[0].Selected = true; } } } } } else { if (change) SelectedIndexChanged(); } this.changeCount++; } private void listView1_SelectedIndexChanged(object sender, EventArgs e) { SelectedIndexChanged(); } private void SelectedIndexChanged() { if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected) { this.unitLength = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRuler(MeasurementUnit.Micron); /// /// 选中图片的bitmap Mat 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; this.documentWorkspace.Document = Document.FromImageMat(this.documentItems[this.listView1.FocusedItem.Index].imageMat); this.documentWorkspace.Visible = true; this.documentWorkspace.ActiveTool = DrawToolType.InclusionNoEffect; this.documentWorkspace.PhaseModels.Clear(); this.documentWorkspace.PhaseModels.AddRange(this.documentItems[this.listView1.FocusedItem.Index].phaseModels); // 选择了图片 this.selectPicture = true; this.commonControlButtons.Visible = true; this.dataGridView1.Rows.Clear(); this.dataGridView2.Rows.Clear(); this.dataGridView3.Rows.Clear(); this.pointDataTables.Clear(); this.pointRectangleFs.Clear(); this.textBox1.Clear(); this.textBox2.Clear(); //this.checkBox1.Checked = false; //this.checkBox2.Checked = false; this.button11.Visible = true; this.button16.Visible = false; pointCountA1.Clear(); pointCountA2.Clear(); pointCountA3.Clear(); pointCountB1.Clear(); pointCountB2.Clear(); pointCountB3.Clear(); pointCountB4.Clear(); pointCountC1.Clear(); pointCountC2.Clear(); pointCountC3.Clear(); pointCountC4.Clear(); pointCountC5.Clear(); this.lengthL1.Clear(); this.lengthL2.Clear(); this.lengthL3.Clear(); this.lengthL4.Clear(); this.lengthL5.Clear(); this.pointDrawkb = false; RefreshPanel(); InitMeasurePoints(); this.documentWorkspace.Refresh(); //this.documentWorkspace.Refresh(); //this.applyButtonImpl(sender, e); } } /// /// 初始化测量数据 /// private bool InitMeasureData() { bool retu = true; this.pointDrawkb = false; if (this.listView2.Items.Count > 0) { DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Whethertoclearallanalysisresults.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { this.dataGridView1.Rows.Clear(); this.dataGridView2.Rows.Clear(); this.dataGridView3.Rows.Clear(); this.pointDataTables.Clear(); this.pointRectangleFs.Clear(); this.textBox1.Clear(); this.textBox2.Clear(); this.comboBox1.Enabled = true; //this.checkBox1.Checked = false; //this.checkBox2.Checked = false; this.button3.Visible = true; this.button15.Visible = false; this.button11.Visible = true; this.button16.Visible = false; pointCountA1.Clear(); pointCountA2.Clear(); pointCountA3.Clear(); pointCountB1.Clear(); pointCountB2.Clear(); pointCountB3.Clear(); pointCountB4.Clear(); pointCountC1.Clear(); pointCountC2.Clear(); pointCountC3.Clear(); pointCountC4.Clear(); pointCountC5.Clear(); this.dataGridView4.Rows.Clear(); this.pictureDataTables.Clear(); this.listView2.Items.Clear(); this.lengthL1.Clear(); this.lengthL2.Clear(); this.lengthL3.Clear(); this.lengthL4.Clear(); this.lengthL5.Clear(); } else { retu = false; } } else { this.dataGridView1.Rows.Clear(); this.dataGridView2.Rows.Clear(); this.dataGridView3.Rows.Clear(); this.pointDataTables.Clear(); this.pointRectangleFs.Clear(); this.textBox1.Clear(); this.textBox2.Clear(); this.comboBox1.Enabled = true; //this.checkBox1.Checked = false; //this.checkBox2.Checked = false; this.button3.Visible = true; this.button15.Visible = false; this.button11.Visible = true; this.button16.Visible = false; pointCountA1.Clear(); pointCountA2.Clear(); pointCountA3.Clear(); pointCountB1.Clear(); pointCountB2.Clear(); pointCountB3.Clear(); pointCountB4.Clear(); pointCountC1.Clear(); pointCountC2.Clear(); pointCountC3.Clear(); pointCountC4.Clear(); pointCountC5.Clear(); this.lengthL1.Clear(); this.lengthL2.Clear(); this.lengthL3.Clear(); this.lengthL4.Clear(); this.lengthL5.Clear(); } this.documentWorkspace.Refresh(); return retu; } /// /// 初始化测量点 /// public void InitMeasurePoints() { this.pointDrawkb = true; for (int i = 0; i < pointRectangleFs.Count; i++) { pointRectangleFs[i].Clear(); } for (int i = 0; i < pointCountA1.Count; i++) { pointCountA1[i] = 0; } for (int i = 0; i < pointCountA2.Count; i++) { pointCountA2[i] = 0; } for (int i = 0; i < pointCountA3.Count; i++) { pointCountA3[i] = 0; } for (int i = 0; i < pointCountB1.Count; i++) { pointCountB1[i] = 0; } for (int i = 0; i < pointCountB2.Count; i++) { pointCountB2[i] = 0; } for (int i = 0; i < pointCountB3.Count; i++) { pointCountB3[i] = 0; } for (int i = 0; i < pointCountB4.Count; i++) { pointCountB4[i] = 0; } for (int i = 0; i < pointCountC1.Count; i++) { pointCountC1[i] = 0; } for (int i = 0; i < pointCountC2.Count; i++) { pointCountC2[i] = 0; } for (int i = 0; i < pointCountC3.Count; i++) { pointCountC3[i] = 0; } for (int i = 0; i < pointCountC4.Count; i++) { pointCountC4[i] = 0; } for (int i = 0; i < pointCountC5.Count; i++) { pointCountC5[i] = 0; } this.documentWorkspace.Refresh(); } /// /// 设置按钮 /// /// /// private void button1_Click(object sender, EventArgs e) { AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.RecombinationRate"); if (recombinationRateSetDialog.hasModule) { recombinationRateSetDialog.StartPosition = FormStartPosition.CenterScreen; recombinationRateSetDialog.ShowDialog(); } else { recombinationRateSetDialog = null; } } /// /// 工件维护设置按钮 /// /// /// private void button4_Click(object sender, EventArgs e) { WorkpieceMaintenance workpieceMaintenance = new WorkpieceMaintenance(); workpieceMaintenance.StartPosition = FormStartPosition.CenterScreen; workpieceMaintenance.ShowDialog(this); } /// /// 开始测量按钮 /// /// /// private void button3_Click(object sender, EventArgs e) { if (this.selectPicture) { bool retu = InitMeasureData(); if (this.comboBox1.SelectedIndex >= 0) { if(retu) { GetDataFromXML(); this.button4.Enabled = false; this.lineChange = false; this.comboBox1.Enabled = false; this.button3.Visible = false; this.button15.Visible = true; this.button15.Focus(); } } else { MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectaworkpiece.text")+"!"); } } else { MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectimage.Text")+"!"); } } /// /// 停止测量 /// /// /// private void button15_Click(object sender, EventArgs e) { this.button4.Enabled = true; this.pointDrawkb = false; this.lineChange = true; this.comboBox1.Enabled = true; this.button3.Visible = true; this.button15.Visible = false; this.button3.Focus(); this.documentWorkspace.Refresh(); } /// /// 单元格点击 /// /// /// private void dgvData_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex > -1) { if (this.dataGridView1.Columns[e.ColumnIndex].Index == 2) { mouseX = e.X; mouseY = e.Y; } } } /// /// 单元格点击内容 /// /// /// private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { switch (this.dataGridView1.Columns[e.ColumnIndex].Index) { case 2: Rectangle rc = this.dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false);//单元格区域的矩形 if (0 < mouseX && mouseX < rc.Width / 2) { } else if (rc.Width / 2 < mouseX && mouseX < rc.Width) { } break; } } } /// /// 编辑结束后 /// /// /// private void dataGridView1_RowLeave(object sender, DataGridViewCellEventArgs e) { this.dataGridView1.Rows[e.RowIndex].ReadOnly = true; this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.SelectionBackColor = SystemColors.MenuHighlight; } /// /// 样品保存 /// /// /// private void button5_Click(object sender, EventArgs e) { if (this.button3.Visible) MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!"); else { if (string.IsNullOrEmpty(this.textBox1.Text)) { MessageBox.Show(PdnResources.GetString("Menu.Pleaseenterthesamplename.text")+"!"); this.textBox1.Focus(); } else { bool canAdd = true; for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (this.textBox1.Text.Equals(dataGridView1.Rows[i].Cells[0].Value)) { MessageBox.Show(PdnResources.GetString("Menu.Namealreadyexists.text")+"!"); this.textBox1.Focus(); canAdd = false; } } if (canAdd) { this.pointDrawkb = true; DataTable dataTable = new DataTable(); DataGridViewRow row = new DataGridViewRow(); DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell(); string name = this.textBox1.Text; textboxcell.Value = this.textBox1.Text; dataTable.TableName = this.textBox1.Text; this.pointDataTables.Add(dataTable); row.Cells.Add(textboxcell); textboxcell = new DataGridViewTextBoxCell(); textboxcell.Value = this.textBox2.Text; row.Cells.Add(textboxcell); DataGridViewButtonCell dataGridViewButtonCell = new DataGridViewButtonCell(); dataGridViewButtonCell.Value = PdnResources.GetString("Menu.Edit.Text"); row.Cells.Add(dataGridViewButtonCell); dataGridViewButtonCell = new DataGridViewButtonCell(); dataGridViewButtonCell.Value = PdnResources.GetString("Menu.Edit.Delete.Text"); row.Cells.Add(dataGridViewButtonCell); row.ReadOnly = true; this.dataGridView1.Rows.Add(row); this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true; InitializeMeasurementPpointList(this.textBox1.Text); this.textBox1.Clear(); this.textBox2.Clear(); //this.pointCountA1 = 0; //this.pointCountA2 = 0; //this.pointCountA3 = 0; //this.pointCountB1 = 0; //this.pointCountB2 = 0; //this.pointCountB3 = 0; //this.pointCountB4 = 0; //this.pointCountC1 = 0; //this.pointCountC2 = 0; //this.pointCountC3 = 0; //this.pointCountC4 = 0; //this.pointCountC5 = 0; //this.rectangleFs.Clear(); if (this.dataGridView1.DisplayedRowCount(false) != this.dataGridView1.RowCount) this.dataGridView1.Columns[1].Width = 142; string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + name; pointRectangleFs.Add(new List()); pointCountA1.Add(0); pointCountA2.Add(0); pointCountA3.Add(0); pointCountB1.Add(0); pointCountB2.Add(0); pointCountB3.Add(0); pointCountB4.Add(0); pointCountC1.Add(0); pointCountC2.Add(0); pointCountC3.Add(0); pointCountC4.Add(0); pointCountC5.Add(0); if(this.linesNumber == 3) { this.lengthL1.Add(new List()); this.lengthL2.Add(new List()); this.lengthL3.Add(new List()); } else if (this.linesNumber == 4) { this.lengthL1.Add(new List()); this.lengthL2.Add(new List()); this.lengthL3.Add(new List()); this.lengthL4.Add(new List()); } else if (this.linesNumber == 5) { this.lengthL1.Add(new List()); this.lengthL2.Add(new List()); this.lengthL3.Add(new List()); this.lengthL4.Add(new List()); this.lengthL5.Add(new List()); } //保存处理后的图片 double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数 List tempBit = new List(); Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap(); originalBit.Tag = pantographRatio; tempBit.Add(originalBit); 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); this.saveSuccess = true; this.documentWorkspace.Refresh(); } } } } /// /// 单元格点击 /// /// /// private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { dataGridView1.Rows[e.RowIndex].Selected = true; if (e.RowIndex < 0) return; if (e.ColumnIndex < 0) return; if (PdnResources.GetString("Menu.Edit.Delete.Text").Equals(this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)) { DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodeletethesample?.text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); if (bitDic1.ContainsKey(tag)) bitDic1.Remove(tag); if(this.linesNumber == 3) { this.lengthL1.RemoveAt(e.RowIndex); this.lengthL2.RemoveAt(e.RowIndex); this.lengthL3.RemoveAt(e.RowIndex); } else if (this.linesNumber == 4) { this.lengthL1.RemoveAt(e.RowIndex); this.lengthL2.RemoveAt(e.RowIndex); this.lengthL3.RemoveAt(e.RowIndex); this.lengthL4.RemoveAt(e.RowIndex); } else if (this.linesNumber == 5) { this.lengthL1.RemoveAt(e.RowIndex); this.lengthL2.RemoveAt(e.RowIndex); this.lengthL3.RemoveAt(e.RowIndex); this.lengthL4.RemoveAt(e.RowIndex); this.lengthL5.RemoveAt(e.RowIndex); } if (this.dataGridView1.Rows.Count > 0) { this.pointRectangleFs.RemoveAt(e.RowIndex); this.pointCountA1.RemoveAt(e.RowIndex); this.pointCountA2.RemoveAt(e.RowIndex); this.pointCountA3.RemoveAt(e.RowIndex); this.pointCountB1.RemoveAt(e.RowIndex); this.pointCountB2.RemoveAt(e.RowIndex); this.pointCountB3.RemoveAt(e.RowIndex); this.pointCountB4.RemoveAt(e.RowIndex); this.pointCountC1.RemoveAt(e.RowIndex); this.pointCountC2.RemoveAt(e.RowIndex); this.pointCountC3.RemoveAt(e.RowIndex); this.pointCountC4.RemoveAt(e.RowIndex); this.pointCountC5.RemoveAt(e.RowIndex); } int deleteIndex = 0; foreach (var dataTable in this.pointDataTables) { if (this.pointDataTables[deleteIndex].TableName.Equals(this.dataGridView1.Rows[e.RowIndex].Cells[0].Value)) { this.pointDataTables.RemoveAt(deleteIndex); break; } deleteIndex++; } //if (e.RowIndex == this.dataGridView1.Rows.Count - 1) //{ // this.pointCountA1 = 0; // this.pointCountA2 = 0; // this.pointCountA3 = 0; // this.pointCountB1 = 0; // this.pointCountB2 = 0; // this.pointCountB3 = 0; // this.pointCountB4 = 0; // this.pointCountC1 = 0; // this.pointCountC2 = 0; // this.pointCountC3 = 0; // this.pointCountC4 = 0; // this.pointCountC5 = 0; // this.rectangleFs.Clear(); //} this.dataGridView1.Rows.RemoveAt(e.RowIndex); if (this.dataGridView1.Rows.Count > 0) this.dataGridView1.Rows[this.dataGridView1.Rows.Count - 1].Selected = true; else { //this.pointCountA1 = 0; //this.pointCountA2 = 0; //this.pointCountA3 = 0; //this.pointCountB1 = 0; //this.pointCountB2 = 0; //this.pointCountB3 = 0; //this.pointCountB4 = 0; //this.pointCountC1 = 0; //this.pointCountC2 = 0; //this.pointCountC3 = 0; //this.pointCountC4 = 0; //this.pointCountC5 = 0; //this.rectangleFs.Clear(); this.pointDrawkb = false; this.dataGridView2.Rows.Clear(); this.dataGridView3.Rows.Clear(); } if (this.dataGridView1.DisplayedRowCount(false) == this.dataGridView1.RowCount) this.dataGridView1.Columns[1].Width = 157; this.saveSuccess = true; this.documentWorkspace.Refresh(); } } else if (PdnResources.GetString("Menu.Edit.Text").Equals(this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)) { MessageBox.Show(PdnResources.GetString("Menu.Thecurrentlinecanbeedited.text")+"!"); //this.dataGridView1.ClearSelection(); this.dataGridView1.Rows[e.RowIndex].ReadOnly = false; this.dataGridView1.Rows[e.RowIndex].DefaultCellStyle.SelectionBackColor = Color.GreenYellow; } } /// /// 添加样品成功时初 /// 始化测量点列表 /// private void InitializeMeasurementPpointList(string sampleName) { int dataTableIndex = 0; for (int i = 0; i < this.pointDataTables.Count; i++) { if (this.pointDataTables[i].TableName.Equals(sampleName)) dataTableIndex = i; } // 配置文件中取得测量点列表值 if (workpieceMaintenanceModel.Workpieces != null && this.comboBox1.DataSource != null) { this.dataGridView2.Rows.Clear(); this.dataGridView3.Rows.Clear(); for (int i = 0; i < workpieceMaintenanceModel.Workpieces.Count; i++) { // 选中的工件 if (workpieceMaintenanceModel.Workpieces[i].Name.Equals(this.comboBox1.SelectedValue)) { // 工件A if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeA)) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewRow dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn c in this.dataGridView2.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA; dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA; dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA; dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA; this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); } // 工件B else if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeB)) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewRow dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn c in this.dataGridView2.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA; dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA; dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA; dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA; this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); dgvr = new DataGridViewRow(); dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn c in this.dataGridView2.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB; dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB; dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB; dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB; this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); } // 工件C else if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeC)) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewRow dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn c in this.dataGridView2.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA; dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA; dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA; dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA; this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); dgvr = new DataGridViewRow(); dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn c in this.dataGridView2.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB; dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB; dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB; dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB; this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); dgvr = new DataGridViewRow(); dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn c in this.dataGridView2.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameC; dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueC + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorC; dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameC; dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueC + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorC; this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); } // 工件D else if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeD)) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewRow dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn c in this.dataGridView2.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA; dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA; dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA; dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA; this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); dgvr = new DataGridViewRow(); dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn c in this.dataGridView2.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB; dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB; dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB; dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB; this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); dgvr = new DataGridViewRow(); dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn c in this.dataGridView2.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameC; dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueC + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorC; dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameC; dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueC + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorC; this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); dgvr = new DataGridViewRow(); dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn c in this.dataGridView2.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameD; dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueD + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorD; dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameD; dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueD + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorD; this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); } // 工件E else if (workpieceMaintenanceModel.Workpieces[i].Type.Equals(constTypeE)) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewRow dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn c in this.dataGridView2.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA; dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA; dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameA; dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueA + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorA; this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); dgvr = new DataGridViewRow(); dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn c in this.dataGridView2.Columns) { dgvr.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(c.CellTemplate.Clone() as DataGridViewCell); } dgvr.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB; dgvr.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB; dgvr1.Cells[0].Value = workpieceMaintenanceModel.Workpieces[i].NameB; dgvr1.Cells[1].Value = workpieceMaintenanceModel.Workpieces[i].StandardValueB + "%+-" + workpieceMaintenanceModel.Workpieces[i].ErrorB; this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); } foreach (DataGridViewColumn c in this.dataGridView3.Columns) { this.pointDataTables[dataTableIndex].Columns.Add(c.Name); } for (int r = 0; r < this.dataGridView3.Rows.Count; r++) { DataRow dataRow = this.pointDataTables[dataTableIndex].NewRow(); for (int c = 0; c < this.dataGridView3.Rows[r].Cells.Count; c++) { dataRow[this.dataGridView3.Columns[c].Name] = this.dataGridView3.Rows[r].Cells[c].Value; } this.pointDataTables[dataTableIndex].Rows.Add(dataRow); } } } } } /// /// 画布绘制 /// /// /// 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.listView1.SelectedItems.Count > 0 && this.dataGridView1.SelectedCells.Count > 0) { string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index] + "|" + this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value.ToString(); //保存处理后的图片 double pantographRatio = (double)this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetRulerMultiple(MeasurementUnit.Micron);//标尺*放大倍数 List tempBit = new List(); Bitmap originalBit = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].CompositionSurface.CreateAliasedBitmap(); originalBit.Tag = pantographRatio; tempBit.Add(originalBit); 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); } 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); } } /// /// 获取辅助线和测量点样式 /// public void RefreshPanel() { // 辅助线样式 CompoundRatioStyleModel compoundRatioStyleModelGuideStyle = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GuideStyle.xml", FileMode.Open)); if (compoundRatioStyleModelGuideStyle.guideStyle != null) { this.lineFont = compoundRatioStyleModelGuideStyle.guideStyle.font; this.lineFontSize = compoundRatioStyleModelGuideStyle.guideStyle.fontSize; this.lineColor = compoundRatioStyleModelGuideStyle.guideStyle.lineColor; this.linesNumber = compoundRatioStyleModelGuideStyle.guideStyle.linesNumber; this.lineWidth = compoundRatioStyleModelGuideStyle.guideStyle.lineWidth; if(unitLength != 0) this.lineSpacing = (float)(compoundRatioStyleModelGuideStyle.guideStyle.spacing / unitLength); if (this.linesNumber == 3) { this.dataGridView2.Columns[5].Visible = false; this.dataGridView2.Columns[6].Visible = false; this.dataGridView3.Columns[5].Visible = false; this.dataGridView3.Columns[6].Visible = false; } else if(this.linesNumber == 4) { this.dataGridView2.Columns[5].Visible = true; this.dataGridView2.Columns[6].Visible = false; this.dataGridView3.Columns[5].Visible = true; this.dataGridView3.Columns[6].Visible = false; } else if (this.linesNumber == 5) { this.dataGridView2.Columns[5].Visible = true; this.dataGridView2.Columns[6].Visible = true; this.dataGridView3.Columns[5].Visible = true; this.dataGridView3.Columns[6].Visible = true; } } // 测量点样式 CompoundRatioStyleModel compoundRatioStyleModelSurvePointStyle = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\SurvePointStyle.xml", FileMode.Open)); if (compoundRatioStyleModelSurvePointStyle.survePointStyle != null) { this.pointFont = compoundRatioStyleModelSurvePointStyle.survePointStyle.font; this.pointFontSize = compoundRatioStyleModelSurvePointStyle.survePointStyle.fontSize; this.pointColor = compoundRatioStyleModelSurvePointStyle.survePointStyle.pointColor; this.pointDiameter = (float)(compoundRatioStyleModelSurvePointStyle.survePointStyle.pointDiameter / unitLength); this.pointMarkerSymbol = compoundRatioStyleModelSurvePointStyle.survePointStyle.pointMarkerSymbol; this.pointStyle = compoundRatioStyleModelSurvePointStyle.survePointStyle.pointStyle; this.pointWidth = compoundRatioStyleModelSurvePointStyle.survePointStyle.pointWidth; } this.documentWorkspace.Refresh(); } /// /// 绘制 /// private void Draw(Graphics graphics) { // 抗锯齿 graphics.SmoothingMode = SmoothingMode.AntiAlias; // 以下为绘制样式 Pen linePen = new Pen(Color.FromArgb(this.lineColor), this.lineWidth); Pen pointPen = new Pen(Color.FromArgb(this.pointColor), this.pointWidth); Font pointFont = new Font(this.pointFont, this.pointFontSize); Font lineFont = new Font(this.lineFont, this.lineFontSize); SolidBrush brush = new SolidBrush(Color.FromArgb(this.pointColor)); /// 测量点操作限制 if(this.dataGridView1.SelectedRows.Count > 0) { this.button6.Enabled = this.pointDrawkb; this.button7.Enabled = this.pointDrawkb; this.button8.Enabled = this.pointDrawkb; } #region 绘制辅助线 // 线条数为三 if (this.linesNumber == 3) { // 绘制辅助线 graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing, 0), new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing, this.documentWorkspace.CompositionSurface.Height)); graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2, this.documentWorkspace.CompositionSurface.Height)); graphics.DrawLine(linePen, new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing, 0), new PointF((float)this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing, this.documentWorkspace.CompositionSurface.Height)); } // 线条数为四 else if (this.linesNumber == 4) { // 绘制辅助线 graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2, this.documentWorkspace.CompositionSurface.Height)); graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2, this.documentWorkspace.CompositionSurface.Height)); graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2, this.documentWorkspace.CompositionSurface.Height)); graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2, this.documentWorkspace.CompositionSurface.Height)); } // 线条数为五 else if (this.linesNumber == 5) { // 绘制辅助线 graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing, this.documentWorkspace.CompositionSurface.Height)); graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing, this.documentWorkspace.CompositionSurface.Height)); graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2, this.documentWorkspace.CompositionSurface.Height)); graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing, this.documentWorkspace.CompositionSurface.Height)); graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing, 0), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing, this.documentWorkspace.CompositionSurface.Height)); } #endregion if (this.dataGridView1.SelectedCells.Count == 0 || this.pointRectangleFs.Count == 0 || this.dataGridView1.SelectedCells[0].RowIndex >= this.pointRectangleFs.Count) return; RectangleF rectangleF = new RectangleF(); #region 线条数为三时的定义 List threeLine1RectangleFs = new List(); List threeLine2RectangleFs = new List(); List threeLine3RectangleFs = new List(); int threeLine1PointCount = 0; int threeLine2PointCount = 0; int threeLine3PointCount = 0; #endregion #region 线条数为四时的定义 List fourLine1RectangleFs = new List(); List fourLine2RectangleFs = new List(); List fourLine3RectangleFs = new List(); List fourLine4RectangleFs = new List(); int fourLine1PointCount = 0; int fourLine2PointCount = 0; int fourLine3PointCount = 0; int fourLine4PointCount = 0; #endregion #region 线条数为五时的定义 List fiveLine1RectangleFs = new List(); List fiveLine2RectangleFs = new List(); List fiveLine3RectangleFs = new List(); List fiveLine4RectangleFs = new List(); List fiveLine5RectangleFs = new List(); int fiveLine1PointCount = 0; int fiveLine2PointCount = 0; int fiveLine3PointCount = 0; int fiveLine4PointCount = 0; int fiveLine5PointCount = 0; #endregion #region 循环用于绘制测量点的矩形的集合 for (int i = 0; i < this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count; i++) { #region 更改样式时的自动绘制 rectangleF = this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]; // 更新矩形的宽高与测量点直径保持一致 rectangleF.Width = this.pointDiameter; rectangleF.Height = this.pointDiameter; // 线条数为三 if (this.linesNumber == 3) { // 第一条线 if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2) { threeLine1PointCount++; if (this.type.Equals(constTypeA)) { if (threeLine1PointCount <= 3) threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeB)) { if (threeLine1PointCount <= 4) threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeC)) { if (threeLine1PointCount <= 5) threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeD)) { if (threeLine1PointCount <= 6) threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeE)) { if (threeLine1PointCount <= 4) threeLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.pointDiameter / 2; } // 第二条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2) { threeLine2PointCount++; if (this.type.Equals(constTypeA)) { if (threeLine2PointCount <= 3) threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeB)) { if (threeLine2PointCount <= 4) threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeC)) { if (threeLine2PointCount <= 5) threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeD)) { if (threeLine2PointCount <= 6) threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeE)) { if (threeLine2PointCount <= 4) threeLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.pointDiameter / 2; } // 第三条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.pointDiameter / 2) { threeLine3PointCount++; if (this.type.Equals(constTypeA)) { if (threeLine3PointCount <= 3) threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeB)) { if (threeLine3PointCount <= 4) threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeC)) { if (threeLine3PointCount <= 5) threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeD)) { if (threeLine3PointCount <= 6) threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeE)) { if (threeLine3PointCount <= 4) threeLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.pointDiameter / 2; } } // 线条数为四 else if (this.linesNumber == 4) { // 第一条线 if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing) { fourLine1PointCount++; if (this.type.Equals(constTypeA)) { if (fourLine1PointCount <= 3) fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeB)) { if (fourLine1PointCount <= 4) fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeC)) { if (fourLine1PointCount <= 5) fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeD)) { if (fourLine1PointCount <= 6) fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeE)) { if (fourLine1PointCount <= 4) fourLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2 - this.pointDiameter / 2; } // 第二条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing) { fourLine2PointCount++; if (this.type.Equals(constTypeA)) { if (fourLine2PointCount <= 3) fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeB)) { if (fourLine2PointCount <= 4) fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeC)) { if (fourLine2PointCount <= 5) fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeD)) { if (fourLine2PointCount <= 6) fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeE)) { if (fourLine2PointCount <= 4) fourLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 - this.pointDiameter / 2; } // 第三条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2) { fourLine3PointCount++; if (this.type.Equals(constTypeA)) { if (fourLine3PointCount <= 3) fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeB)) { if (fourLine3PointCount <= 4) fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeC)) { if (fourLine3PointCount <= 5) fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeD)) { if (fourLine3PointCount <= 6) fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeE)) { if (fourLine3PointCount <= 4) fourLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 - this.pointDiameter / 2; } // 第四条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing) { fourLine4PointCount++; if (this.type.Equals(constTypeA)) { if (fourLine4PointCount <= 3) fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeB)) { if (fourLine4PointCount <= 4) fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeC)) { if (fourLine4PointCount <= 5) fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeD)) { if (fourLine4PointCount <= 6) fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeE)) { if (fourLine4PointCount <= 4) fourLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 - this.pointDiameter / 2; } } // 线条数为五 else if(this.linesNumber == 5) { // 第一条线 if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2) { fiveLine1PointCount++; if (this.type.Equals(constTypeA)) { if (fiveLine1PointCount <= 3) fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeB)) { if (fiveLine1PointCount <= 4) fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeC)) { if (fiveLine1PointCount <= 5) fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeD)) { if (fiveLine1PointCount <= 6) fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeE)) { if (fiveLine1PointCount <= 4) fiveLine1RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing - this.pointDiameter / 2; } // 第二条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2) { fiveLine2PointCount++; if (this.type.Equals(constTypeA)) { if (fiveLine2PointCount <= 3) fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeB)) { if (fiveLine2PointCount <= 4) fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeC)) { if (fiveLine2PointCount <= 5) fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeD)) { if (fiveLine2PointCount <= 6) fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeE)) { if (fiveLine2PointCount <= 4) fiveLine2RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.pointDiameter / 2; } // 第三条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2) { fiveLine3PointCount++; if (this.type.Equals(constTypeA)) { if (fiveLine3PointCount <= 3) fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeB)) { if (fiveLine3PointCount <= 4) fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeC)) { if (fiveLine3PointCount <= 5) fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeD)) { if (fiveLine3PointCount <= 6) fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeE)) { if (fiveLine3PointCount <= 4) fiveLine3RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 - this.pointDiameter / 2; } // 第四条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2) { fiveLine4PointCount++; if (this.type.Equals(constTypeA)) { if (fiveLine4PointCount <= 3) fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeB)) { if (fiveLine4PointCount <= 4) fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeC)) { if (fiveLine4PointCount <= 5) fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeD)) { if (fiveLine4PointCount <= 6) fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeE)) { if (fiveLine4PointCount <= 4) fiveLine4RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.pointDiameter / 2; } // 第五条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2) { fiveLine5PointCount++; if (this.type.Equals(constTypeA)) { if (fiveLine5PointCount <= 3) fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeB)) { if (fiveLine5PointCount <= 4) fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeC)) { if (fiveLine5PointCount <= 5) fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeD)) { if (fiveLine5PointCount <= 6) fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } else if (this.type.Equals(constTypeE)) { if (fiveLine5PointCount <= 4) fiveLine5RectangleFs.Add(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); } rectangleF.X = this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing - this.pointDiameter / 2; } } this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i] = rectangleF; #endregion #region 绘制测量点 // 选中点 if (i == selected) { // 绘制选中边框 graphics.DrawRectangle(new Pen(Color.Black, 2), new Rectangle(new Point((int)this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X, (int)this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Y), new System.Drawing.Size((int)this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Width, (int)this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Height))); } // 点样式为空心 if (this.pointStyle == 0) graphics.DrawEllipse(pointPen, this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); // 实心 else graphics.FillEllipse(brush, this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i]); // 点标记 if(pointMarkerSymbol) graphics.DrawString("p" + (i + 1), pointFont, new SolidBrush(Color.Black), new PointF(this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Width, this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Y)); #endregion } #endregion // 测量点间距 float a1 = 0, b1 = 0, c1 = 0, d1 = 0; float a2 = 0, b2 = 0, c2 = 0, d2 = 0; float a3 = 0, b3 = 0, c3 = 0, d3 = 0; float a4 = 0, b4 = 0, c4 = 0, d4 = 0; float a5 = 0, b5 = 0, c5 = 0, d5 = 0; float w = 0; // 初始化中间数据 if(lengthL1.Count > 0 && lengthL1.Count > this.dataGridView1.SelectedCells[0].RowIndex) this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex] = new List(); if (lengthL2.Count > 0 && lengthL2.Count > this.dataGridView1.SelectedCells[0].RowIndex) this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex] = new List(); if (lengthL3.Count > 0 && lengthL3.Count > this.dataGridView1.SelectedCells[0].RowIndex) this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex] = new List(); if (lengthL4.Count > 0 && lengthL4.Count > this.dataGridView1.SelectedCells[0].RowIndex) this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex] = new List(); if (lengthL5.Count > 0 && lengthL5.Count > this.dataGridView1.SelectedCells[0].RowIndex) this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex] = new List(); if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count > 0) { #region 是否在图像上显示数据 // 文本尺寸 SizeF sizeF; #region 线条数为三时的辅助线文本绘制 if (this.linesNumber == 3) { if (this.type.Equals(constTypeA)) { if (threeLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); } else if (threeLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength)); } if (threeLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength)); } if (threeLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); } else if (threeLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength)); } if (threeLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y); } if (threeLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y); } if (threeLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y); } } else if (this.type.Equals(constTypeB)) { if (threeLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); } else if (threeLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength)); } else if (threeLine1RectangleFs.Count == 4) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength)); } if (threeLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 4) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength)); } if (threeLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength)); } else if (threeLine3RectangleFs.Count == 4) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength)); } if (threeLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y); } if (threeLine1RectangleFs.Count > 3) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine1RectangleFs[2].X - sizeF.Width / 4, (threeLine1RectangleFs[2].Y + threeLine1RectangleFs[3].Y) / 2)); b1 = Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y); } if (threeLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y); } if (threeLine2RectangleFs.Count > 3) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine2RectangleFs[2].X - sizeF.Width / 4, (threeLine2RectangleFs[2].Y + threeLine2RectangleFs[3].Y) / 2)); b2 = Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y); } if (threeLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y); } if (threeLine3RectangleFs.Count > 3) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine3RectangleFs[2].X - sizeF.Width / 4, (threeLine3RectangleFs[2].Y + threeLine3RectangleFs[3].Y) / 2)); b3 = Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y); } } else if (this.type.Equals(constTypeC)) { if (threeLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); } else if (threeLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength)); } else if (threeLine1RectangleFs.Count == 4) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength)); } else if (threeLine1RectangleFs.Count == 5) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength)); } if (threeLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 4) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 5) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength)); } if (threeLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 4) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength)); } else if (threeLine3RectangleFs.Count == 5) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength)); } if (threeLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y); } if (threeLine1RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine1RectangleFs[1].X - sizeF.Width / 4, (threeLine1RectangleFs[1].Y + threeLine1RectangleFs[2].Y) / 2)); c1 = Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y); } if (threeLine1RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine1RectangleFs[3].X - sizeF.Width / 4, (threeLine1RectangleFs[3].Y + threeLine1RectangleFs[4].Y) / 2)); b1 = Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y); } if (threeLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y); } if (threeLine2RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine2RectangleFs[1].X - sizeF.Width / 4, (threeLine2RectangleFs[1].Y + threeLine2RectangleFs[2].Y) / 2)); c2 = Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y); } if (threeLine2RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine2RectangleFs[3].X - sizeF.Width / 4, (threeLine2RectangleFs[3].Y + threeLine2RectangleFs[4].Y) / 2)); b2 = Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y); } if (threeLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y); } if (threeLine3RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine3RectangleFs[1].X - sizeF.Width / 4, (threeLine3RectangleFs[1].Y + threeLine3RectangleFs[2].Y) / 2)); c3 = Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y); } if (threeLine3RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine3RectangleFs[3].X - sizeF.Width / 4, (threeLine3RectangleFs[3].Y + threeLine3RectangleFs[4].Y) / 2)); b3 = Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y); } } else if (this.type.Equals(constTypeD)) { if (threeLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); } else if (threeLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength)); } else if (threeLine1RectangleFs.Count == 4) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength)); } else if (threeLine1RectangleFs.Count == 5) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength)); } else if (threeLine1RectangleFs.Count == 5) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[2].Y - threeLine1RectangleFs[3].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[4].Y - threeLine1RectangleFs[5].Y) * this.unitLength)); } if (threeLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 4) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 5) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 5) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[2].Y - threeLine2RectangleFs[3].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[4].Y - threeLine2RectangleFs[5].Y) * this.unitLength)); } if (threeLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); } else if (threeLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength)); } else if (threeLine3RectangleFs.Count == 4) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength)); } else if (threeLine3RectangleFs.Count == 5) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength)); } else if (threeLine3RectangleFs.Count == 5) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[2].Y - threeLine3RectangleFs[3].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[4].Y - threeLine3RectangleFs[5].Y) * this.unitLength)); } if (threeLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y); } if (threeLine1RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine1RectangleFs[1].X - sizeF.Width / 4, (threeLine1RectangleFs[1].Y + threeLine1RectangleFs[2].Y) / 2)); c1 = Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y); } if (threeLine1RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine1RectangleFs[3].X - sizeF.Width / 4, (threeLine1RectangleFs[3].Y + threeLine1RectangleFs[4].Y) / 2)); d1 = Math.Abs(threeLine1RectangleFs[3].Y - threeLine1RectangleFs[4].Y); } if (threeLine1RectangleFs.Count > 5) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[4].Y - threeLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[4].Y - threeLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine1RectangleFs[4].X - sizeF.Width / 4, (threeLine1RectangleFs[4].Y + threeLine1RectangleFs[5].Y) / 2)); b1 = Math.Abs(threeLine1RectangleFs[4].Y - threeLine1RectangleFs[5].Y); } if (threeLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y); } if (threeLine2RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine2RectangleFs[1].X - sizeF.Width / 4, (threeLine2RectangleFs[1].Y + threeLine2RectangleFs[2].Y) / 2)); c2 = Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y); } if (threeLine2RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine2RectangleFs[3].X - sizeF.Width / 4, (threeLine2RectangleFs[3].Y + threeLine2RectangleFs[4].Y) / 2)); d2 = Math.Abs(threeLine2RectangleFs[3].Y - threeLine2RectangleFs[4].Y); } if (threeLine2RectangleFs.Count > 5) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[4].Y - threeLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[4].Y - threeLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine2RectangleFs[4].X - sizeF.Width / 4, (threeLine2RectangleFs[4].Y + threeLine2RectangleFs[5].Y) / 2)); b2 = Math.Abs(threeLine2RectangleFs[4].Y - threeLine2RectangleFs[5].Y); } if (threeLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y); } if (threeLine3RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine3RectangleFs[1].X - sizeF.Width / 4, (threeLine3RectangleFs[1].Y + threeLine3RectangleFs[2].Y) / 2)); c3 = Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y); } if (threeLine3RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine3RectangleFs[3].X - sizeF.Width / 4, (threeLine3RectangleFs[3].Y + threeLine3RectangleFs[4].Y) / 2)); d3 = Math.Abs(threeLine3RectangleFs[3].Y - threeLine3RectangleFs[4].Y); } if (threeLine3RectangleFs.Count > 5) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[4].Y - threeLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[4].Y - threeLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine3RectangleFs[4].X - sizeF.Width / 4, (threeLine3RectangleFs[4].Y + threeLine3RectangleFs[5].Y) / 2)); b3 = Math.Abs(threeLine3RectangleFs[4].Y - threeLine3RectangleFs[5].Y); } } else if (this.type.Equals(constTypeE)) { if (threeLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); } else if (threeLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength)); } if (threeLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); } else if (threeLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength)); } if (threeLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); } else if (threeLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength)); } if (threeLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine1RectangleFs[0].X - sizeF.Width / 4, (threeLine1RectangleFs[0].Y + threeLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[1].Y); } if (threeLine1RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine1RectangleFs[1].X - sizeF.Width / 4, (threeLine1RectangleFs[1].Y + threeLine1RectangleFs[2].Y) / 2)); c1 = Math.Abs(threeLine1RectangleFs[1].Y - threeLine1RectangleFs[2].Y); } if (threeLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine2RectangleFs[0].X - sizeF.Width / 4, (threeLine2RectangleFs[0].Y + threeLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[1].Y); } if (threeLine2RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine2RectangleFs[1].X - sizeF.Width / 4, (threeLine2RectangleFs[1].Y + threeLine2RectangleFs[2].Y) / 2)); c2 = Math.Abs(threeLine2RectangleFs[1].Y - threeLine2RectangleFs[2].Y); } if (threeLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine3RectangleFs[0].X - sizeF.Width / 4, (threeLine3RectangleFs[0].Y + threeLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[1].Y); } if (threeLine3RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(threeLine3RectangleFs[1].X - sizeF.Width / 4, (threeLine3RectangleFs[1].Y + threeLine3RectangleFs[2].Y) / 2)); c3 = Math.Abs(threeLine3RectangleFs[1].Y - threeLine3RectangleFs[2].Y); } } } #endregion #region 线条数为四时的辅助线文本绘制 if (this.linesNumber == 4) { if (this.type.Equals(constTypeA)) { if (fourLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength)); } if (fourLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); } else if (fourLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength)); } if (fourLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); } else if (fourLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength)); } if (fourLine4RectangleFs.Count == 2) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); } else if (fourLine4RectangleFs.Count == 3) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength)); } if (fourLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y); } if (fourLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y); } if (fourLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y); } if (fourLine4RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2)); a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y); } } else if (this.type.Equals(constTypeB)) { if (fourLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 4) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength)); } if (fourLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); } else if (fourLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength)); } else if (fourLine2RectangleFs.Count == 4) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength)); } if (fourLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); } else if (fourLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength)); } else if (fourLine3RectangleFs.Count == 4) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength)); } if (fourLine4RectangleFs.Count == 2) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); } else if (fourLine4RectangleFs.Count == 3) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength)); } else if (fourLine4RectangleFs.Count == 4) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength)); } if (fourLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y); } if (fourLine1RectangleFs.Count > 3) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine1RectangleFs[2].X - sizeF.Width / 4, (fourLine1RectangleFs[2].Y + fourLine1RectangleFs[3].Y) / 2)); b1 = Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y); } if (fourLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y); } if (fourLine2RectangleFs.Count > 3) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine2RectangleFs[2].X - sizeF.Width / 4, (fourLine2RectangleFs[2].Y + fourLine2RectangleFs[3].Y) / 2)); b2 = Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y); } if (fourLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y); } if (fourLine3RectangleFs.Count > 3) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine3RectangleFs[2].X - sizeF.Width / 4, (fourLine3RectangleFs[2].Y + fourLine3RectangleFs[3].Y) / 2)); b3 = Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y); } if (fourLine4RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2)); a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y); } if (fourLine4RectangleFs.Count > 3) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine4RectangleFs[2].X - sizeF.Width / 4, (fourLine4RectangleFs[2].Y + fourLine4RectangleFs[3].Y) / 2)); b4 = Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y); } } else if (this.type.Equals(constTypeC)) { if (fourLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 4) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 5) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength)); } if (fourLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 4) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 5) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength)); } if (fourLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); } else if (fourLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength)); } else if (fourLine3RectangleFs.Count == 4) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength)); } else if (fourLine3RectangleFs.Count == 5) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength)); } if (fourLine4RectangleFs.Count == 2) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); } else if (fourLine4RectangleFs.Count == 3) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength)); } else if (fourLine4RectangleFs.Count == 4) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength)); } else if (fourLine4RectangleFs.Count == 5) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength)); } if (fourLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y); } if (fourLine1RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine1RectangleFs[1].X - sizeF.Width / 4, (fourLine1RectangleFs[1].Y + fourLine1RectangleFs[2].Y) / 2)); c1 = Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y); } if (fourLine1RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine1RectangleFs[3].X - sizeF.Width / 4, (fourLine1RectangleFs[3].Y + fourLine1RectangleFs[4].Y) / 2)); b1 = Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y); } if (fourLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y); } if (fourLine2RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine2RectangleFs[1].X - sizeF.Width / 4, (fourLine2RectangleFs[1].Y + fourLine2RectangleFs[2].Y) / 2)); c2 = Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y); } if (fourLine2RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine2RectangleFs[3].X - sizeF.Width / 4, (fourLine2RectangleFs[3].Y + fourLine2RectangleFs[4].Y) / 2)); b2 = Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y); } if (fourLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y); } if (fourLine3RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine3RectangleFs[1].X - sizeF.Width / 4, (fourLine3RectangleFs[1].Y + fourLine3RectangleFs[2].Y) / 2)); c3 = Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y); } if (fourLine3RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine3RectangleFs[3].X - sizeF.Width / 4, (fourLine3RectangleFs[3].Y + fourLine3RectangleFs[4].Y) / 2)); b3 = Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y); } if (fourLine4RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2)); a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y); } if (fourLine4RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine4RectangleFs[1].X - sizeF.Width / 4, (fourLine4RectangleFs[1].Y + fourLine4RectangleFs[2].Y) / 2)); c4 = Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y); } if (fourLine4RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine4RectangleFs[3].X - sizeF.Width / 4, (fourLine4RectangleFs[3].Y + fourLine4RectangleFs[4].Y) / 2)); b4 = Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y); } } else if (this.type.Equals(constTypeD)) { if (fourLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 4) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 5) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 6) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[2].Y - fourLine1RectangleFs[3].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[4].Y - fourLine1RectangleFs[5].Y) * this.unitLength)); } if (fourLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); } else if (fourLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength)); } else if (fourLine2RectangleFs.Count == 4) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength)); } else if (fourLine2RectangleFs.Count == 5) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength)); } else if (fourLine2RectangleFs.Count == 6) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[2].Y - fourLine2RectangleFs[3].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[4].Y - fourLine2RectangleFs[5].Y) * this.unitLength)); } if (fourLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); } else if (fourLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength)); } else if (fourLine3RectangleFs.Count == 4) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength)); } else if (fourLine3RectangleFs.Count == 5) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength)); } else if (fourLine3RectangleFs.Count == 6) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[2].Y - fourLine3RectangleFs[3].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[4].Y - fourLine3RectangleFs[5].Y) * this.unitLength)); } if (fourLine4RectangleFs.Count == 2) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); } else if (fourLine4RectangleFs.Count == 3) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength)); } else if (fourLine4RectangleFs.Count == 4) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength)); } else if (fourLine4RectangleFs.Count == 5) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength)); } else if (fourLine4RectangleFs.Count == 6) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[2].Y - fourLine4RectangleFs[3].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[4].Y - fourLine4RectangleFs[5].Y) * this.unitLength)); } if (fourLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y); } if (fourLine1RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine1RectangleFs[1].X - sizeF.Width / 4, (fourLine1RectangleFs[1].Y + fourLine1RectangleFs[2].Y) / 2)); c1 = Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y); } if (fourLine1RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine1RectangleFs[3].X - sizeF.Width / 4, (fourLine1RectangleFs[3].Y + fourLine1RectangleFs[4].Y) / 2)); d1 = Math.Abs(fourLine1RectangleFs[3].Y - fourLine1RectangleFs[4].Y); } if (fourLine1RectangleFs.Count > 5) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[4].Y - fourLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[4].Y - fourLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine1RectangleFs[4].X - sizeF.Width / 4, (fourLine1RectangleFs[4].Y + fourLine1RectangleFs[5].Y) / 2)); b1 = Math.Abs(fourLine1RectangleFs[4].Y - fourLine1RectangleFs[5].Y); } if (fourLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y); } if (fourLine2RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine2RectangleFs[1].X - sizeF.Width / 4, (fourLine2RectangleFs[1].Y + fourLine2RectangleFs[2].Y) / 2)); c2 = Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y); } if (fourLine2RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine2RectangleFs[3].X - sizeF.Width / 4, (fourLine2RectangleFs[3].Y + fourLine2RectangleFs[4].Y) / 2)); d2 = Math.Abs(fourLine2RectangleFs[3].Y - fourLine2RectangleFs[4].Y); } if (fourLine2RectangleFs.Count > 5) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[4].Y - fourLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[4].Y - fourLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine2RectangleFs[4].X - sizeF.Width / 4, (fourLine2RectangleFs[4].Y + fourLine2RectangleFs[5].Y) / 2)); b2 = Math.Abs(fourLine2RectangleFs[4].Y - fourLine2RectangleFs[5].Y); } if (fourLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y); } if (fourLine3RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine3RectangleFs[1].X - sizeF.Width / 4, (fourLine3RectangleFs[1].Y + fourLine3RectangleFs[2].Y) / 2)); c3 = Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y); } if (fourLine3RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine3RectangleFs[3].X - sizeF.Width / 4, (fourLine3RectangleFs[3].Y + fourLine3RectangleFs[4].Y) / 2)); d3 = Math.Abs(fourLine3RectangleFs[3].Y - fourLine3RectangleFs[4].Y); } if (fourLine3RectangleFs.Count > 5) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[4].Y - fourLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[4].Y - fourLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine3RectangleFs[4].X - sizeF.Width / 4, (fourLine3RectangleFs[4].Y + fourLine3RectangleFs[5].Y) / 2)); b3 = Math.Abs(fourLine3RectangleFs[4].Y - fourLine3RectangleFs[5].Y); } if (fourLine4RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2)); a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y); } if (fourLine4RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine4RectangleFs[1].X - sizeF.Width / 4, (fourLine4RectangleFs[1].Y + fourLine4RectangleFs[2].Y) / 2)); c4 = Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y); } if (fourLine4RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine4RectangleFs[3].X - sizeF.Width / 4, (fourLine4RectangleFs[3].Y + fourLine4RectangleFs[4].Y) / 2)); d4 = Math.Abs(fourLine4RectangleFs[3].Y - fourLine4RectangleFs[4].Y); } if (fourLine4RectangleFs.Count > 5) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[4].Y - fourLine4RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[4].Y - fourLine4RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine4RectangleFs[4].X - sizeF.Width / 4, (fourLine4RectangleFs[4].Y + fourLine4RectangleFs[5].Y) / 2)); b4 = Math.Abs(fourLine4RectangleFs[4].Y - fourLine4RectangleFs[5].Y); } } else if (this.type.Equals(constTypeE)) { if (fourLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); } else if (fourLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength)); } if (fourLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); } else if (fourLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength)); } if (fourLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); } else if (fourLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength)); } if (fourLine4RectangleFs.Count == 2) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); } else if (fourLine3RectangleFs.Count == 3) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength)); } if (fourLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine1RectangleFs[0].X - sizeF.Width / 4, (fourLine1RectangleFs[0].Y + fourLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[1].Y); } if (fourLine1RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine1RectangleFs[1].X - sizeF.Width / 4, (fourLine1RectangleFs[1].Y + fourLine1RectangleFs[2].Y) / 2)); c1 = Math.Abs(fourLine1RectangleFs[1].Y - fourLine1RectangleFs[2].Y); } if (fourLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine2RectangleFs[0].X - sizeF.Width / 4, (fourLine2RectangleFs[0].Y + fourLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[1].Y); } if (fourLine2RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine2RectangleFs[1].X - sizeF.Width / 4, (fourLine2RectangleFs[1].Y + fourLine2RectangleFs[2].Y) / 2)); c2 = Math.Abs(fourLine2RectangleFs[1].Y - fourLine2RectangleFs[2].Y); } if (fourLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine3RectangleFs[0].X - sizeF.Width / 4, (fourLine3RectangleFs[0].Y + fourLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[1].Y); } if (fourLine3RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine3RectangleFs[1].X - sizeF.Width / 4, (fourLine3RectangleFs[1].Y + fourLine3RectangleFs[2].Y) / 2)); c3 = Math.Abs(fourLine3RectangleFs[1].Y - fourLine3RectangleFs[2].Y); } if (fourLine4RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine4RectangleFs[0].X - sizeF.Width / 4, (fourLine4RectangleFs[0].Y + fourLine4RectangleFs[1].Y) / 2)); a4 = Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[1].Y); } if (fourLine4RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fourLine4RectangleFs[1].X - sizeF.Width / 4, (fourLine4RectangleFs[1].Y + fourLine4RectangleFs[2].Y) / 2)); c4 = Math.Abs(fourLine4RectangleFs[1].Y - fourLine4RectangleFs[2].Y); } } } #endregion #region 线条数为五时的辅助线文本绘制 if (this.linesNumber == 5) { if (this.type.Equals(constTypeA)) { if (fiveLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength)); } if (fiveLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength)); } if (fiveLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength)); } if (fiveLine4RectangleFs.Count == 2) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine4RectangleFs.Count == 3) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength)); } if (fiveLine5RectangleFs.Count == 2) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine5RectangleFs.Count == 3) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength)); } if (fiveLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y); } if (fiveLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y); } if (fiveLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y); } if (fiveLine4RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2)); a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y); } if (fiveLine5RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2)); a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y); } } else if (this.type.Equals(constTypeB)) { if (fiveLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine1RectangleFs.Count == 4) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength)); } if (fiveLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine2RectangleFs.Count == 4) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength)); } if (fiveLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine3RectangleFs.Count == 4) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength)); } if (fiveLine4RectangleFs.Count == 2) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine4RectangleFs.Count == 3) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine4RectangleFs.Count == 4) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength)); } if (fiveLine5RectangleFs.Count == 2) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine5RectangleFs.Count == 3) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine5RectangleFs.Count == 4) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength)); } if (fiveLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y); } if (fiveLine1RectangleFs.Count > 3) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine1RectangleFs[2].X - sizeF.Width / 4, (fiveLine1RectangleFs[2].Y + fiveLine1RectangleFs[3].Y) / 2)); b1 = Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y); } if (fiveLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y); } if (fiveLine2RectangleFs.Count > 3) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine2RectangleFs[2].X - sizeF.Width / 4, (fiveLine2RectangleFs[2].Y + fiveLine2RectangleFs[3].Y) / 2)); b2 = Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y); } if (fiveLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y); } if (fiveLine3RectangleFs.Count > 3) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine3RectangleFs[2].X - sizeF.Width / 4, (fiveLine3RectangleFs[2].Y + fiveLine3RectangleFs[3].Y) / 2)); b3 = Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y); } if (fiveLine4RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2)); a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y); } if (fiveLine4RectangleFs.Count > 3) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine4RectangleFs[2].X - sizeF.Width / 4, (fiveLine4RectangleFs[2].Y + fiveLine4RectangleFs[3].Y) / 2)); b4 = Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y); } if (fiveLine5RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2)); a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y); } if (fiveLine5RectangleFs.Count > 3) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine5RectangleFs[2].X - sizeF.Width / 4, (fiveLine5RectangleFs[2].Y + fiveLine5RectangleFs[3].Y) / 2)); b5 = Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y); } } else if (this.type.Equals(constTypeC)) { if (fiveLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine1RectangleFs.Count == 4) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength)); } else if (fiveLine1RectangleFs.Count == 5) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength)); } if (fiveLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine2RectangleFs.Count == 4) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength)); } else if (fiveLine2RectangleFs.Count == 5) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength)); } if (fiveLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine3RectangleFs.Count == 4) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength)); } else if (fiveLine3RectangleFs.Count == 5) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength)); } if (fiveLine4RectangleFs.Count == 2) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine4RectangleFs.Count == 3) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine4RectangleFs.Count == 4) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength)); } else if (fiveLine4RectangleFs.Count == 5) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength)); } if (fiveLine5RectangleFs.Count == 2) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine5RectangleFs.Count == 3) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine5RectangleFs.Count == 4) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength)); } else if (fiveLine5RectangleFs.Count == 5) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength)); } if (fiveLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y); } if (fiveLine1RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine1RectangleFs[1].X - sizeF.Width / 4, (fiveLine1RectangleFs[1].Y + fiveLine1RectangleFs[2].Y) / 2)); c1 = Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y); } if (fiveLine1RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine1RectangleFs[3].X - sizeF.Width / 4, (fiveLine1RectangleFs[3].Y + fiveLine1RectangleFs[4].Y) / 2)); b1 = Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y); } if (fiveLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y); } if (fiveLine2RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine2RectangleFs[1].X - sizeF.Width / 4, (fiveLine2RectangleFs[1].Y + fiveLine2RectangleFs[2].Y) / 2)); c2 = Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y); } if (fiveLine2RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine2RectangleFs[3].X - sizeF.Width / 4, (fiveLine2RectangleFs[3].Y + fiveLine2RectangleFs[4].Y) / 2)); b2 = Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y); } if (fiveLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y); } if (fiveLine3RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine3RectangleFs[1].X - sizeF.Width / 4, (fiveLine3RectangleFs[1].Y + fiveLine3RectangleFs[2].Y) / 2)); c3 = Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y); } if (fiveLine3RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine3RectangleFs[3].X - sizeF.Width / 4, (fiveLine3RectangleFs[3].Y + fiveLine3RectangleFs[4].Y) / 2)); b3 = Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y); } if (fiveLine4RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2)); a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y); } if (fiveLine4RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine4RectangleFs[1].X - sizeF.Width / 4, (fiveLine4RectangleFs[1].Y + fiveLine4RectangleFs[2].Y) / 2)); c4 = Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y); } if (fiveLine4RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine4RectangleFs[3].X - sizeF.Width / 4, (fiveLine4RectangleFs[3].Y + fiveLine4RectangleFs[4].Y) / 2)); b4 = Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y); } if (fiveLine5RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2)); a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y); } if (fiveLine5RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine5RectangleFs[1].X - sizeF.Width / 4, (fiveLine5RectangleFs[1].Y + fiveLine5RectangleFs[2].Y) / 2)); c5 = Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y); } if (fiveLine5RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine5RectangleFs[3].X - sizeF.Width / 4, (fiveLine5RectangleFs[3].Y + fiveLine5RectangleFs[4].Y) / 2)); b5 = Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y); } } else if (this.type.Equals(constTypeD)) { if (fiveLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine1RectangleFs.Count == 4) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength)); } else if (fiveLine1RectangleFs.Count == 5) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength)); } else if (fiveLine1RectangleFs.Count == 6) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[2].Y - fiveLine1RectangleFs[3].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[4].Y - fiveLine1RectangleFs[5].Y) * this.unitLength)); } if (fiveLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine2RectangleFs.Count == 4) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength)); } else if (fiveLine2RectangleFs.Count == 5) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength)); } else if (fiveLine2RectangleFs.Count == 6) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[2].Y - fiveLine2RectangleFs[3].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[4].Y - fiveLine2RectangleFs[5].Y) * this.unitLength)); } if (fiveLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine3RectangleFs.Count == 4) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength)); } else if (fiveLine3RectangleFs.Count == 5) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength)); } else if (fiveLine3RectangleFs.Count == 6) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[2].Y - fiveLine3RectangleFs[3].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[4].Y - fiveLine3RectangleFs[5].Y) * this.unitLength)); } if (fiveLine4RectangleFs.Count == 2) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine4RectangleFs.Count == 3) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine4RectangleFs.Count == 4) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength)); } else if (fiveLine4RectangleFs.Count == 5) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength)); } else if (fiveLine4RectangleFs.Count == 6) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[2].Y - fiveLine4RectangleFs[3].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[4].Y - fiveLine4RectangleFs[5].Y) * this.unitLength)); } if (fiveLine5RectangleFs.Count == 2) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine5RectangleFs.Count == 3) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength)); } else if (fiveLine5RectangleFs.Count == 4) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength)); } else if (fiveLine5RectangleFs.Count == 5) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength)); } else if (fiveLine5RectangleFs.Count == 6) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[2].Y - fiveLine5RectangleFs[3].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[4].Y - fiveLine5RectangleFs[5].Y) * this.unitLength)); } if (fiveLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y); } if (fiveLine1RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine1RectangleFs[1].X - sizeF.Width / 4, (fiveLine1RectangleFs[1].Y + fiveLine1RectangleFs[2].Y) / 2)); c1 = Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y); } if (fiveLine1RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine1RectangleFs[3].X - sizeF.Width / 4, (fiveLine1RectangleFs[3].Y + fiveLine1RectangleFs[4].Y) / 2)); d1 = Math.Abs(fiveLine1RectangleFs[3].Y - fiveLine1RectangleFs[4].Y); } if (fiveLine1RectangleFs.Count > 5) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[4].Y - fiveLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[4].Y - fiveLine1RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine1RectangleFs[4].X - sizeF.Width / 4, (fiveLine1RectangleFs[4].Y + fiveLine1RectangleFs[5].Y) / 2)); b1 = Math.Abs(fiveLine1RectangleFs[4].Y - fiveLine1RectangleFs[5].Y); } if (fiveLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y); } if (fiveLine2RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine2RectangleFs[1].X - sizeF.Width / 4, (fiveLine2RectangleFs[1].Y + fiveLine2RectangleFs[2].Y) / 2)); c2 = Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y); } if (fiveLine2RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine2RectangleFs[3].X - sizeF.Width / 4, (fiveLine2RectangleFs[3].Y + fiveLine2RectangleFs[4].Y) / 2)); d2 = Math.Abs(fiveLine2RectangleFs[3].Y - fiveLine2RectangleFs[4].Y); } if (fiveLine2RectangleFs.Count > 5) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[4].Y - fiveLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[4].Y - fiveLine2RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine2RectangleFs[4].X - sizeF.Width / 4, (fiveLine2RectangleFs[4].Y + fiveLine2RectangleFs[5].Y) / 2)); b2 = Math.Abs(fiveLine2RectangleFs[4].Y - fiveLine2RectangleFs[5].Y); } if (fiveLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y); } if (fiveLine3RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine3RectangleFs[1].X - sizeF.Width / 4, (fiveLine3RectangleFs[1].Y + fiveLine3RectangleFs[2].Y) / 2)); c3 = Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y); } if (fiveLine3RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine3RectangleFs[3].X - sizeF.Width / 4, (fiveLine3RectangleFs[3].Y + fiveLine3RectangleFs[4].Y) / 2)); d3 = Math.Abs(fiveLine3RectangleFs[3].Y - fiveLine3RectangleFs[4].Y); } if (fiveLine3RectangleFs.Count > 5) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[4].Y - fiveLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[4].Y - fiveLine3RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine3RectangleFs[4].X - sizeF.Width / 4, (fiveLine3RectangleFs[4].Y + fiveLine3RectangleFs[5].Y) / 2)); b3 = Math.Abs(fiveLine3RectangleFs[4].Y - fiveLine3RectangleFs[5].Y); } if (fiveLine4RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2)); a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y); } if (fiveLine4RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine4RectangleFs[1].X - sizeF.Width / 4, (fiveLine4RectangleFs[1].Y + fiveLine4RectangleFs[2].Y) / 2)); c4 = Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y); } if (fiveLine4RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine4RectangleFs[3].X - sizeF.Width / 4, (fiveLine4RectangleFs[3].Y + fiveLine4RectangleFs[4].Y) / 2)); d4 = Math.Abs(fiveLine4RectangleFs[3].Y - fiveLine4RectangleFs[4].Y); } if (fiveLine4RectangleFs.Count > 5) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[4].Y - fiveLine4RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[4].Y - fiveLine4RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine4RectangleFs[4].X - sizeF.Width / 4, (fiveLine4RectangleFs[4].Y + fiveLine4RectangleFs[5].Y) / 2)); b4 = Math.Abs(fiveLine4RectangleFs[4].Y - fiveLine4RectangleFs[5].Y); } if (fiveLine5RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2)); a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y); } if (fiveLine5RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine5RectangleFs[1].X - sizeF.Width / 4, (fiveLine5RectangleFs[1].Y + fiveLine5RectangleFs[2].Y) / 2)); c5 = Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y); } if (fiveLine5RectangleFs.Count > 4) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine5RectangleFs[3].X - sizeF.Width / 4, (fiveLine5RectangleFs[3].Y + fiveLine5RectangleFs[4].Y) / 2)); d5 = Math.Abs(fiveLine5RectangleFs[3].Y - fiveLine5RectangleFs[4].Y); } if (fiveLine5RectangleFs.Count > 5) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[4].Y - fiveLine5RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[4].Y - fiveLine5RectangleFs[5].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine5RectangleFs[4].X - sizeF.Width / 4, (fiveLine5RectangleFs[4].Y + fiveLine5RectangleFs[5].Y) / 2)); b5 = Math.Abs(fiveLine5RectangleFs[4].Y - fiveLine5RectangleFs[5].Y); } } else if (this.type.Equals(constTypeE)) { if (fiveLine1RectangleFs.Count == 2) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine1RectangleFs.Count == 3) { this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength)); this.lengthL1[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength)); } if (fiveLine2RectangleFs.Count == 2) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine2RectangleFs.Count == 3) { this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength)); this.lengthL2[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength)); } if (fiveLine3RectangleFs.Count == 2) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine3RectangleFs.Count == 3) { this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength)); this.lengthL3[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength)); } if (fiveLine4RectangleFs.Count == 2) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine4RectangleFs.Count == 3) { this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength)); this.lengthL4[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength)); } if (fiveLine5RectangleFs.Count == 2) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); } else if (fiveLine5RectangleFs.Count == 3) { this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength)); this.lengthL5[this.dataGridView1.SelectedCells[0].RowIndex].Add(Convert.ToDecimal(Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength)); } if (fiveLine1RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine1RectangleFs[0].X - sizeF.Width / 4, (fiveLine1RectangleFs[0].Y + fiveLine1RectangleFs[1].Y) / 2)); a1 = Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[1].Y); } if (fiveLine1RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine1RectangleFs[1].X - sizeF.Width / 4, (fiveLine1RectangleFs[1].Y + fiveLine1RectangleFs[2].Y) / 2)); c1 = Math.Abs(fiveLine1RectangleFs[1].Y - fiveLine1RectangleFs[2].Y); } if (fiveLine2RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine2RectangleFs[0].X - sizeF.Width / 4, (fiveLine2RectangleFs[0].Y + fiveLine2RectangleFs[1].Y) / 2)); a2 = Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[1].Y); } if (fiveLine2RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine2RectangleFs[1].X - sizeF.Width / 4, (fiveLine2RectangleFs[1].Y + fiveLine2RectangleFs[2].Y) / 2)); c2 = Math.Abs(fiveLine2RectangleFs[1].Y - fiveLine2RectangleFs[2].Y); } if (fiveLine3RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine3RectangleFs[0].X - sizeF.Width / 4, (fiveLine3RectangleFs[0].Y + fiveLine3RectangleFs[1].Y) / 2)); a3 = Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[1].Y); } if (fiveLine3RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine3RectangleFs[1].X - sizeF.Width / 4, (fiveLine3RectangleFs[1].Y + fiveLine3RectangleFs[2].Y) / 2)); c3 = Math.Abs(fiveLine3RectangleFs[1].Y - fiveLine3RectangleFs[2].Y); } if (fiveLine4RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine4RectangleFs[0].X - sizeF.Width / 4, (fiveLine4RectangleFs[0].Y + fiveLine4RectangleFs[1].Y) / 2)); a4 = Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[1].Y); } if (fiveLine4RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine4RectangleFs[1].X - sizeF.Width / 4, (fiveLine4RectangleFs[1].Y + fiveLine4RectangleFs[2].Y) / 2)); c4 = Math.Abs(fiveLine4RectangleFs[1].Y - fiveLine4RectangleFs[2].Y); } if (fiveLine5RectangleFs.Count > 1) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine5RectangleFs[0].X - sizeF.Width / 4, (fiveLine5RectangleFs[0].Y + fiveLine5RectangleFs[1].Y) / 2)); a5 = Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[1].Y); } if (fiveLine5RectangleFs.Count > 2) { sizeF = graphics.MeasureString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont); if (this.checkBox1.Checked) graphics.DrawString("" + Math.Round((Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y) * this.unitLength), this.decimalCls) + "μm", lineFont, new SolidBrush(Color.Black), new PointF(fiveLine5RectangleFs[1].X - sizeF.Width / 4, (fiveLine5RectangleFs[1].Y + fiveLine5RectangleFs[2].Y) / 2)); c5 = Math.Abs(fiveLine5RectangleFs[1].Y - fiveLine5RectangleFs[2].Y); } } } #endregion #endregion #region 计算百分比基数 if (this.linesNumber == 3) { if (this.type.Equals(constTypeA)) { int line = 0; if (threeLine1RectangleFs.Count > 2) { line++; w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[2].Y); } if (threeLine2RectangleFs.Count > 2) { line++; w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[2].Y); } if (threeLine3RectangleFs.Count > 2) { line++; w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[2].Y); } w = w / line; } else if (this.type.Equals(constTypeB)) { int line = 0; if (threeLine1RectangleFs.Count > 3) { line++; w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[3].Y); } if (threeLine2RectangleFs.Count > 3 ) { line++; w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[3].Y); } if (threeLine3RectangleFs.Count > 3) { line++; w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[3].Y); } w = w / line; } else if (this.type.Equals(constTypeC)) { int line = 0; if (threeLine1RectangleFs.Count > 4) { line++; w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[4].Y); } if (threeLine2RectangleFs.Count > 4) { line++; w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[4].Y); } if (threeLine3RectangleFs.Count > 4) { line++; w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[4].Y); } w = w / line; } else if (this.type.Equals(constTypeD)) { int line = 0; if (threeLine1RectangleFs.Count > 5) { line++; w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[5].Y); } if (threeLine2RectangleFs.Count > 5) { line++; w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[5].Y); } if (threeLine3RectangleFs.Count > 5) { line++; w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[5].Y); } w = w / line; } else if (this.type.Equals(constTypeE)) { int line = 0; if (threeLine1RectangleFs.Count > 3) { line++; w += Math.Abs(threeLine1RectangleFs[0].Y - threeLine1RectangleFs[3].Y); } if (threeLine2RectangleFs.Count > 3) { line++; w += Math.Abs(threeLine2RectangleFs[0].Y - threeLine2RectangleFs[3].Y); } if (threeLine3RectangleFs.Count > 3) { line++; w += Math.Abs(threeLine3RectangleFs[0].Y - threeLine3RectangleFs[3].Y); } w = w / line; } } else if (this.linesNumber == 4) { if (this.type.Equals(constTypeA)) { int line = 0; if (fourLine1RectangleFs.Count > 2) { line++; w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[2].Y); } if (fourLine2RectangleFs.Count > 2) { line++; w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[2].Y); } if (fourLine3RectangleFs.Count > 2) { line++; w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[2].Y); } if (fourLine4RectangleFs.Count > 2) { line++; w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[2].Y); } w = w / line; } else if (this.type.Equals(constTypeB)) { int line = 0; if (fourLine1RectangleFs.Count > 3) { line++; w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[3].Y); } if (fourLine2RectangleFs.Count > 3) { line++; w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[3].Y); } if (fourLine3RectangleFs.Count > 3) { line++; w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[3].Y); } if (fourLine4RectangleFs.Count > 3) { line++; w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[3].Y); } w = w / line; } else if (this.type.Equals(constTypeC)) { int line = 0; if (fourLine1RectangleFs.Count > 4) { line++; w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[4].Y); } if (fourLine2RectangleFs.Count > 4) { line++; w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[4].Y); } if (fourLine3RectangleFs.Count > 4) { line++; w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[4].Y); } if (fourLine4RectangleFs.Count > 4) { line++; w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[4].Y); } w = w / line; } else if (this.type.Equals(constTypeD)) { int line = 0; if (fourLine1RectangleFs.Count > 5) { line++; w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[5].Y); } if (fourLine2RectangleFs.Count > 5) { line++; w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[5].Y); } if (fourLine3RectangleFs.Count > 5) { line++; w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[5].Y); } if (fourLine4RectangleFs.Count > 5) { line++; w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[5].Y); } w = w / line; } else if (this.type.Equals(constTypeE)) { int line = 0; if (fourLine1RectangleFs.Count > 3) { line++; w += Math.Abs(fourLine1RectangleFs[0].Y - fourLine1RectangleFs[3].Y); } if (fourLine2RectangleFs.Count > 3) { line++; w += Math.Abs(fourLine2RectangleFs[0].Y - fourLine2RectangleFs[3].Y); } if (fourLine3RectangleFs.Count > 3) { line++; w += Math.Abs(fourLine3RectangleFs[0].Y - fourLine3RectangleFs[3].Y); } if (fourLine4RectangleFs.Count > 3) { line++; w += Math.Abs(fourLine4RectangleFs[0].Y - fourLine4RectangleFs[3].Y); } w = w / line; } } else if (this.linesNumber == 5) { if (this.type.Equals(constTypeA)) { int line = 0; if (fiveLine1RectangleFs.Count > 2) { line++; w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[2].Y); } if (fiveLine2RectangleFs.Count > 2) { line++; w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[2].Y); } if (fiveLine3RectangleFs.Count > 2) { line++; w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[2].Y); } if (fiveLine4RectangleFs.Count > 2) { line++; w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[2].Y); } if (fiveLine5RectangleFs.Count > 2) { line++; w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[2].Y); } w = w / line; } else if (this.type.Equals(constTypeB)) { int line = 0; if (fiveLine1RectangleFs.Count > 3) { line++; w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[3].Y); } if (fiveLine2RectangleFs.Count > 3) { line++; w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[3].Y); } if (fiveLine3RectangleFs.Count > 3) { line++; w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[3].Y); } if (fiveLine4RectangleFs.Count > 3) { line++; w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[3].Y); } if (fiveLine5RectangleFs.Count > 3) { line++; w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[3].Y); } w = w / line; } else if (this.type.Equals(constTypeC)) { int line = 0; if (fiveLine1RectangleFs.Count > 4) { line++; w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[4].Y); } if (fiveLine2RectangleFs.Count > 4) { line++; w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[4].Y); } if (fiveLine3RectangleFs.Count > 4) { line++; w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[4].Y); } if (fiveLine4RectangleFs.Count > 4) { line++; w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[4].Y); } if (fiveLine5RectangleFs.Count > 4) { line++; w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[4].Y); } w = w / line; } else if (this.type.Equals(constTypeD)) { int line = 0; if (fiveLine1RectangleFs.Count > 5) { line++; w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[5].Y); } if (fiveLine2RectangleFs.Count > 5) { line++; w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[5].Y); } if (fiveLine3RectangleFs.Count > 5) { line++; w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[5].Y); } if (fiveLine4RectangleFs.Count > 5) { line++; w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[5].Y); } if (fiveLine5RectangleFs.Count > 5) { line++; w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[5].Y); } w = w / line; } else if (this.type.Equals(constTypeE)) { int line = 0; if (fiveLine1RectangleFs.Count > 3) { line++; w += Math.Abs(fiveLine1RectangleFs[0].Y - fiveLine1RectangleFs[3].Y); } if (fiveLine2RectangleFs.Count > 3) { line++; w += Math.Abs(fiveLine2RectangleFs[0].Y - fiveLine2RectangleFs[3].Y); } if (fiveLine3RectangleFs.Count > 3) { line++; w += Math.Abs(fiveLine3RectangleFs[0].Y - fiveLine3RectangleFs[3].Y); } if (fiveLine4RectangleFs.Count > 3) { line++; w += Math.Abs(fiveLine4RectangleFs[0].Y - fiveLine4RectangleFs[3].Y); } if (fiveLine5RectangleFs.Count > 3) { line++; w += Math.Abs(fiveLine5RectangleFs[0].Y - fiveLine5RectangleFs[3].Y); } w = w / line; } } #endregion if(w > 0) { Matrix mtxSave = graphics.Transform; Matrix matrix = graphics.Transform; float sp = 0; // 线条数为三 if (this.linesNumber == 3) { sp = this.documentWorkspace.CompositionSurface.Width - (this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing); PointF point = new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + sp / 2 - this.lineWidth / 2, this.documentWorkspace.CompositionSurface.Height / 2); graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + sp / 2, this.documentWorkspace.CompositionSurface.Height / 2 - (int)w / 2), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + sp / 2, this.documentWorkspace.CompositionSurface.Height / 2 + (int)w / 2)); matrix.RotateAt((float)90, new PointF(point.X, point.Y)); graphics.Transform = matrix; graphics.DrawString("" + Math.Round(w * this.unitLength, this.decimalCls) + "μm", lineFont, brush, point); //还原为原始旋转矩阵 graphics.Transform = mtxSave; } // 线条数为四 else if (this.linesNumber == 4) { sp = this.documentWorkspace.CompositionSurface.Width - (this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2); PointF point = new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 + sp / 2 - this.lineWidth / 2, this.documentWorkspace.CompositionSurface.Height / 2); graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 + sp / 2, this.documentWorkspace.CompositionSurface.Height / 2 - (int)w / 2), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 + sp / 2, this.documentWorkspace.CompositionSurface.Height / 2 + (int)w / 2)); matrix.RotateAt((float)90, new PointF(point.X, point.Y)); graphics.Transform = matrix; graphics.DrawString("" + Math.Round(w * this.unitLength, this.decimalCls) + "μm", lineFont, brush, point); //还原为原始旋转矩阵 graphics.Transform = mtxSave; } // 线条数为五 else if (this.linesNumber == 5) { sp = this.documentWorkspace.CompositionSurface.Width - (this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing); PointF point = new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing + sp / 2 - this.lineWidth / 2, this.documentWorkspace.CompositionSurface.Height / 2); graphics.DrawLine(linePen, new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing + sp / 2, this.documentWorkspace.CompositionSurface.Height / 2 - (int)w / 2), new PointF(this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing + sp / 2, this.documentWorkspace.CompositionSurface.Height / 2 + (int)w / 2)); matrix.RotateAt((float)90, new PointF(point.X, point.Y)); graphics.Transform = matrix; graphics.DrawString("" + Math.Round(w * this.unitLength, this.decimalCls) + "μm", lineFont, brush, point); //还原为原始旋转矩阵 graphics.Transform = mtxSave; } matrix.Dispose(); } } #region 计算测量点百分比 if (this.pointDrawkb) { // 取目标值/误差 int left; int right; string leftValue; string rightValue; float length1 = 0; float length2 = 0; float length3 = 0; float length4 = 0; float length5 = 0; // 线条数为三 if (this.linesNumber == 3) { for (int i = 0; i < this.dataGridView2.Rows.Count; i++) { // 总百分比 float all = 0; if (i == 0) { length1 = a1; length2 = a2; length3 = a3; } else if (i == 1) { if (this.type.Equals(constTypeE)) { length1 = c1; length2 = c2; length3 = c3; } else { length1 = b1; length2 = b2; length3 = b3; } } else if (i == 2) { length1 = c1; length2 = c2; length3 = c3; } else if (i == 3) { length1 = d1; length2 = d2; length3 = d3; } left = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("%"); right = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("-"); leftValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(0, left); rightValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(right + 1); if (pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount) { this.dataGridView2.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView3.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red; } else { this.dataGridView2.Rows[i].Cells[2].Value = "" + Math.Round((length1 / w) * 100, decimalCls); this.dataGridView3.Rows[i].Cells[2].Value = "" + ((length1 / w) * 100); all += (length1 / w) * 100; if (length1 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || length1 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[2].Style.BackColor = SystemColors.ControlLightLight; } if (pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount) { this.dataGridView2.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView3.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red; } else { this.dataGridView2.Rows[i].Cells[3].Value = "" + Math.Round((length2 / w) * 100, decimalCls); this.dataGridView3.Rows[i].Cells[3].Value = "" + ((length2 / w) * 100); all += (length2 / w) * 100; if (length2 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || length2 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[3].Style.BackColor = SystemColors.ControlLightLight; } if (pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount) { this.dataGridView2.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView3.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red; } else { this.dataGridView2.Rows[i].Cells[4].Value = "" + Math.Round((length3 / w) * 100, decimalCls); this.dataGridView3.Rows[i].Cells[4].Value = "" + ((length3 / w) * 100); all += (length3 / w) * 100; if (length3 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || length3 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[4].Style.BackColor = SystemColors.ControlLightLight; } // 平均值 this.dataGridView2.Rows[i].Cells[7].Value = "" + Math.Round(all / 3, decimalCls); this.dataGridView3.Rows[i].Cells[7].Value = "" + (all / 3); if (all / 3 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || all / 3 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[7].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[7].Style.BackColor = SystemColors.ControlLightLight; } } // 线条数为四 else if (this.linesNumber == 4) { for (int i = 0; i < this.dataGridView2.Rows.Count; i++) { // 总百分比 float all = 0; if (i == 0) { length1 = a1; length2 = a2; length3 = a3; length4 = a4; } else if (i == 1) { if (this.type.Equals(constTypeE)) { length1 = c1; length2 = c2; length3 = c3; length4 = c4; } else { length1 = b1; length2 = b2; length3 = b3; length4 = b4; } } else if (i == 2) { length1 = c1; length2 = c2; length3 = c3; length4 = c4; } else if (i == 3) { length1 = d1; length2 = d2; length3 = d3; length4 = d4; } left = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("%"); right = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("-"); leftValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(0, left); rightValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(right + 1); if (pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount) { this.dataGridView2.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView3.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red; } else { this.dataGridView2.Rows[i].Cells[2].Value = "" + Math.Round((length1 / w) * 100, decimalCls); this.dataGridView3.Rows[i].Cells[2].Value = "" + ((length1 / w) * 100); all += (length1 / w) * 100; if (length1 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || length1 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[2].Style.BackColor = SystemColors.ControlLightLight; } if (pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount) { this.dataGridView2.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView3.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red; } else { this.dataGridView2.Rows[i].Cells[3].Value = "" + Math.Round((length2 / w) * 100, decimalCls); this.dataGridView3.Rows[i].Cells[3].Value = "" + ((length2 / w) * 100); all += (length2 / w) * 100; if (length2 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || length2 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[3].Style.BackColor = SystemColors.ControlLightLight; } if (pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount) { this.dataGridView2.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView3.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red; } else { this.dataGridView2.Rows[i].Cells[4].Value = "" + Math.Round((length3 / w) * 100, decimalCls); this.dataGridView3.Rows[i].Cells[4].Value = "" + ((length3 / w) * 100); all += (length3 / w) * 100; if (length3 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || length3 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[4].Style.BackColor = SystemColors.ControlLightLight; } if (pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount) { this.dataGridView2.Rows[i].Cells[5].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView3.Rows[i].Cells[5].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red; } else { this.dataGridView2.Rows[i].Cells[5].Value = "" + Math.Round((length4 / w) * 100, decimalCls); this.dataGridView3.Rows[i].Cells[5].Value = "" + ((length4 / w) * 100); all += (length4 / w) * 100; if (length4 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || length4 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[5].Style.BackColor = SystemColors.ControlLightLight; } // 平均值 this.dataGridView2.Rows[i].Cells[7].Value = "" + Math.Round(all / 4, decimalCls); this.dataGridView3.Rows[i].Cells[7].Value = "" + (all / 4); if (all / 4 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || all / 4 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[7].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[7].Style.BackColor = SystemColors.ControlLightLight; } } // 线条数为五 else if (this.linesNumber == 5) { for (int i = 0; i < this.dataGridView2.Rows.Count; i++) { // 总百分比 float all = 0; if (i == 0) { length1 = a1; length2 = a2; length3 = a3; length4 = a4; length5 = a5; } else if (i == 1) { if (this.type.Equals(constTypeE)) { length1 = c1; length2 = c2; length3 = c3; length4 = c4; length4 = c5; } else { length1 = b1; length2 = b2; length3 = b3; length4 = b4; length4 = b5; } } else if (i == 2) { length1 = c1; length2 = c2; length3 = c3; length4 = c4; length5 = c5; } else if (i == 3) { length1 = d1; length2 = d2; length3 = d3; length4 = d4; length5 = d5; } left = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("%"); right = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("-"); leftValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(0, left); rightValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(right + 1); if (pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount) { this.dataGridView2.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView3.Rows[i].Cells[2].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red; } else { this.dataGridView2.Rows[i].Cells[2].Value = "" + Math.Round((length1 / w) * 100, decimalCls); this.dataGridView3.Rows[i].Cells[2].Value = "" + ((length1 / w) * 100); all += (length1 / w) * 100; if (length1 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || length1 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[2].Style.BackColor = SystemColors.ControlLightLight; } if (pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount) { this.dataGridView2.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView3.Rows[i].Cells[3].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red; } else { this.dataGridView2.Rows[i].Cells[3].Value = "" + Math.Round((length2 / w) * 100, decimalCls); this.dataGridView3.Rows[i].Cells[3].Value = "" + ((length2 / w) * 100); all += (length2 / w) * 100; if (length2 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || length2 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[3].Style.BackColor = SystemColors.ControlLightLight; } if (pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount) { this.dataGridView2.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView3.Rows[i].Cells[4].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red; } else { this.dataGridView2.Rows[i].Cells[4].Value = "" + Math.Round((length3 / w) * 100, decimalCls); this.dataGridView3.Rows[i].Cells[4].Value = "" + ((length3 / w) * 100); all += (length3 / w) * 100; if (length3 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || length3 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[4].Style.BackColor = SystemColors.ControlLightLight; } if (pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount) { this.dataGridView2.Rows[i].Cells[5].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView3.Rows[i].Cells[5].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red; } else { this.dataGridView2.Rows[i].Cells[5].Value = "" + Math.Round((length4 / w) * 100, decimalCls); this.dataGridView3.Rows[i].Cells[5].Value = "" + ((length4 / w) * 100); all += (length4 / w) * 100; if (length4 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || length4 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[5].Style.BackColor = SystemColors.ControlLightLight; } if (pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] < this.pointDrawCount) { this.dataGridView2.Rows[i].Cells[6].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView3.Rows[i].Cells[6].Value = PdnResources.GetString("Menu.Alittleless.Text"); this.dataGridView2.Rows[i].Cells[6].Style.BackColor = Color.Red; } else { this.dataGridView2.Rows[i].Cells[6].Value = "" + Math.Round((length5 / w) * 100, decimalCls); this.dataGridView3.Rows[i].Cells[6].Value = "" + ((length5 / w) * 100); all += (length5 / w) * 100; if (length5 / w * 100 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || length5 / w * 100 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[6].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[6].Style.BackColor = SystemColors.ControlLightLight; } // 平均值 this.dataGridView2.Rows[i].Cells[7].Value = "" + Math.Round(all / 5, decimalCls); this.dataGridView3.Rows[i].Cells[7].Value = "" + (all / 5); if (all / 5 > (float)(Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || all / 5 < (float)(Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[7].Style.BackColor = Color.Red; else this.dataGridView2.Rows[i].Cells[7].Style.BackColor = SystemColors.ControlLightLight; } } } #endregion brush.Dispose(); } /// /// 鼠标按下 /// /// /// private void OnMouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) return; for (int i = 0; i < this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count; i++) { this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].Selected = false; } // 换算后的点 PointF point1 = documentWorkspace.GetScalePoint(e.Location); // 选择范围 int selectTop = 0; int selectBottom = 0; if (operationK == 0) { selectTop = 0; selectBottom = this.documentWorkspace.CompositionSurface.Height; } else if (operationK == 1 || operationK == 2) { selectTop = - (int)this.pointDiameter / 2; selectBottom = this.documentWorkspace.CompositionSurface.Height + (int)this.pointDiameter / 2; } // 点在图片内 if (point1.Y >= selectTop && point1.Y <= selectBottom) { // 添加测量点 if (operationK == 0) { // 线条数为三 if (this.linesNumber == 3) { // 在线条上添加测量点 if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing + this.lineWidth / 2 && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineWidth / 2) { // 可绘制的点数 if (pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount) { // 创建用于绘制测量点的矩形 RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter); this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF); this.saveSuccess = true; } pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex]++; if (pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1) pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount; } // 在线条上添加测量点 else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineWidth / 2 && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineWidth / 2) { // 可绘制的点数 if (pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount) { // 创建用于绘制测量点的矩形 RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter); this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF); this.saveSuccess = true; } pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex]++; if (pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1) pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount; } // 在线条上添加测量点 else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineWidth / 2 && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.lineWidth / 2) { // 可绘制的点数 if (pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount) { // 创建用于绘制测量点的矩形 RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter); this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF); this.saveSuccess = true; } pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex]++; if (pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1) pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount; } } // 线条数为四 else if (this.linesNumber == 4) { // 在线条上添加测量点 if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2 + this.lineWidth / 2 && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2 - this.lineWidth / 2) { // 可绘制的点数 if (pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount) { // 创建用于绘制测量点的矩形 RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter); this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF); this.saveSuccess = true; } pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex]++; if (pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1) pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount; } // 在线条上添加测量点 else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 + this.lineWidth / 2 && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 - this.lineWidth / 2) { // 可绘制的点数 if (pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount) { // 创建用于绘制测量点的矩形 RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter); this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF); this.saveSuccess = true; } pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex]++; if (pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1) pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount; } // 在线条上添加测量点 else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 + this.lineWidth / 2 && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 - this.lineWidth / 2) { // 可绘制的点数 if (pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount) { // 创建用于绘制测量点的矩形 RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter); this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF); this.saveSuccess = true; } pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex]++; if (pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1) pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount; } // 在线条上添加测量点 else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 + this.lineWidth / 2 && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 - this.lineWidth / 2) { // 可绘制的点数 if (pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount) { // 创建用于绘制测量点的矩形 RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter); this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF); this.saveSuccess = true; } pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex]++; if (pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1) pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount; } } // 线条数为五 else if (this.linesNumber == 5) { // 在线条上添加测量点 if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing + this.lineWidth / 2 && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing - this.lineWidth / 2) { // 可绘制的点数 if (pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount) { // 创建用于绘制测量点的矩形 RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - 2 * this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter); this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF); this.saveSuccess = true; } pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex]++; if (pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1) pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount; } // 在线条上添加测量点 else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing + this.lineWidth / 2 && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineWidth / 2) { // 可绘制的点数 if (pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount) { // 创建用于绘制测量点的矩形 RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter); this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF); this.saveSuccess = true; } pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex]++; if (pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1) pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount; } // 在线条上添加测量点 else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineWidth / 2 && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineWidth / 2) { // 可绘制的点数 if (pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount) { // 创建用于绘制测量点的矩形 RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter); this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF); this.saveSuccess = true; } pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex]++; if (pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1) pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount; } // 在线条上添加测量点 else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineWidth / 2 && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.lineWidth / 2) { // 可绘制的点数 if (pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount) { // 创建用于绘制测量点的矩形 RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter); this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF); this.saveSuccess = true; } pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex]++; if (pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1) pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount; } // 在线条上添加测量点 else if (point1.X <= this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing + this.lineWidth / 2 && point1.X >= this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing - this.lineWidth / 2) { // 可绘制的点数 if (pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] < pointDrawCount) { // 创建用于绘制测量点的矩形 RectangleF rectangleF = new RectangleF((this.documentWorkspace.CompositionSurface.Width / 2 + 2 * this.lineSpacing - this.pointDiameter / 2), (point1.Y - this.pointDiameter / 2), this.pointDiameter, this.pointDiameter); this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Add(rectangleF); this.saveSuccess = true; } pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex]++; if (pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] > pointDrawCount - 1) pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] = pointDrawCount; } } } // 选择测量点 else if (operationK == 1) { for (int i = 0; i < this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count; i++) { if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Contains(point1)) { m_canMove = true; selected = i; this.m_StartPoint = point1; } } } // 删除测量点 else if (operationK == 2) { int count = this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].Count; // 循环测量点矩形集合 for (int i = count - 1; i >= 0; i--) { // 线条数为三 if (this.linesNumber == 3) { // 鼠标在矩形内 if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Contains(point1)) { // 第一条线 if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2) { pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex]--; if (pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] < 0) pointCountA1[this.dataGridView1.SelectedCells[0].RowIndex] = 0; } // 第二条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2) { pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex]--; if (pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] < 0) pointCountA2[this.dataGridView1.SelectedCells[0].RowIndex] = 0; } // 第三条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2) { pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex]--; if (pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] < 0) pointCountA3[this.dataGridView1.SelectedCells[0].RowIndex] = 0; } // 删除选择的矩形 this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].RemoveAt(i); this.saveSuccess = true; break; } } // 线条数为四 else if (this.linesNumber == 4) { // 鼠标在矩形内 if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Contains(point1)) { // 第一条线 if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 <= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing) { pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex]--; if (pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] < 0) pointCountB1[this.dataGridView1.SelectedCells[0].RowIndex] = 0; } // 第二条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing) { pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex]--; if (pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] < 0) pointCountB2[this.dataGridView1.SelectedCells[0].RowIndex] = 0; } // 第三条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2) { pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex]--; if (pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] < 0) pointCountB3[this.dataGridView1.SelectedCells[0].RowIndex] = 0; } // 第四条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing) { pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex]--; if (pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] < 0) pointCountB4[this.dataGridView1.SelectedCells[0].RowIndex] = 0; } // 删除选择的矩形 this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].RemoveAt(i); this.saveSuccess = true; break; } } // 线条数为五 else if (this.linesNumber == 5) { // 鼠标在矩形内 if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].Contains(point1)) { // 第一条线 if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2) { pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex]--; if (pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] < 0) pointCountC1[this.dataGridView1.SelectedCells[0].RowIndex] = 0; } // 第二条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2 && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing - this.lineSpacing / 2) { pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex]--; if (pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] < 0) pointCountC2[this.dataGridView1.SelectedCells[0].RowIndex] = 0; } // 第三条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2 && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 - this.lineSpacing / 2) { pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex]--; if (pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] < 0) pointCountC3[this.dataGridView1.SelectedCells[0].RowIndex] = 0; } // 第四条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 < this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2 && this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing / 2) { pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex]--; if (pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] < 0) pointCountC4[this.dataGridView1.SelectedCells[0].RowIndex] = 0; } // 第五条线 else if (this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][i].X + this.pointDiameter / 2 >= this.documentWorkspace.CompositionSurface.Width / 2 + this.lineSpacing + this.lineSpacing / 2) { pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex]--; if (pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] < 0) pointCountC5[this.dataGridView1.SelectedCells[0].RowIndex] = 0; } // 删除选择的矩形 this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex].RemoveAt(i); this.saveSuccess = true; break; } } } } } this.documentWorkspace.Refresh(); } /// /// 选择测量点移动 /// /// /// private void onMouseMove(object sender, MouseEventArgs e) { // 换算后的点 PointF point1 = documentWorkspace.GetScalePoint(e.Location); if (e.Button == MouseButtons.Left && m_canMove) { RectangleF rectangleF = new RectangleF(); rectangleF = this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][selected]; // 矩形偏移 rectangleF.Offset(0, point1.Y - this.m_StartPoint.Y); if (rectangleF.Bottom > this.documentWorkspace.CompositionSurface.Height + rectangleF.Height / 2) rectangleF.Y = this.documentWorkspace.CompositionSurface.Height - rectangleF.Height + rectangleF.Height / 2; if (rectangleF.Top < - rectangleF.Height / 2) rectangleF.Y = - rectangleF.Height / 2; if (point1.Y <= this.documentWorkspace.CompositionSurface.Height && point1.Y >= 0) this.m_StartPoint = point1; this.pointRectangleFs[this.dataGridView1.SelectedCells[0].RowIndex][selected] = rectangleF; this.saveSuccess = true; this.documentWorkspace.Refresh(); } } /// /// 鼠标抬起(测量点不可移动) /// /// /// private void onMouseUp(object sender, MouseEventArgs e) { m_canMove = false; } /// /// 添加测量点 /// /// /// private void button6_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) return; operationK = 0; selected = -1; this.documentWorkspace.Refresh(); } /// /// 失去焦点 /// /// /// private void button6_LostFocus(object sender, EventArgs e) { operationK = -1; selected = -1; this.documentWorkspace.Refresh(); } /// /// 失去焦点 /// /// /// private void button7_LostFocus(object sender, EventArgs e) { operationK = -1; selected = -1; this.documentWorkspace.Refresh(); } /// /// 失去焦点 /// /// /// private void button8_LostFocus(object sender, EventArgs e) { operationK = -1; selected = -1; this.documentWorkspace.Refresh(); } /// /// 选择测量点 /// /// /// private void button8_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) return; operationK = 1; } /// /// 删除测量点 /// /// /// private void button7_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) return; operationK = 2; selected = -1; this.documentWorkspace.Refresh(); } /// /// 辅助线样式设置 /// /// /// private void button9_Click(object sender, EventArgs e) { GuideStyleSettingsDialog guideStyleSettingsDialog = new GuideStyleSettingsDialog(this.lineChange); guideStyleSettingsDialog.StartPosition = FormStartPosition.CenterScreen; guideStyleSettingsDialog.ShowDialog(this); } /// /// 测量点样式设置 /// /// /// private void button10_Click(object sender, EventArgs e) { SurveyPointStyleSettingDialog surveyPointStyleSettingDialog = new SurveyPointStyleSettingDialog(); surveyPointStyleSettingDialog.StartPosition = FormStartPosition.CenterScreen; surveyPointStyleSettingDialog.ShowDialog(this); } /// /// 从XML获取数据 /// private void GetDataFromXML() { workpieceMaintenanceModel = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\WorkpieceMaintenanceModel.xml", FileMode.Open)); // 工件类型 this.type = string.Empty; if (workpieceMaintenanceModel.Workpieces != null && this.comboBox1.DataSource != null) { for (int i = 0; i < workpieceMaintenanceModel.Workpieces.Count; i++) { if (workpieceMaintenanceModel.Workpieces[i].Name.Equals(this.comboBox1.SelectedValue)) this.type = workpieceMaintenanceModel.Workpieces[i].Type; } if (this.type.Equals(constTypeA)) pointDrawCount = 3; else if (this.type.Equals(constTypeB)) pointDrawCount = 4; else if (this.type.Equals(constTypeC)) pointDrawCount = 5; else if (this.type.Equals(constTypeD)) pointDrawCount = 6; else if (this.type.Equals(constTypeE)) pointDrawCount = 4; } } /// /// 选择样品更改 /// /// /// private void dataGridView1_SelectionChanged(object sender, EventArgs e) { if (this.dataGridView1.SelectedCells.Count > 0) { int dataTableIndex = 0; for (int i = 0; i < this.pointDataTables.Count; i++) { if (this.pointDataTables[i].TableName.Equals(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value)) dataTableIndex = i; } if (this.pointDataTables[dataTableIndex].Rows.Count > 0) { this.dataGridView2.Rows.Clear(); this.dataGridView3.Rows.Clear(); for (int r = 0; r < this.pointDataTables[dataTableIndex].Rows.Count; r++) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewRow dgvr1 = new DataGridViewRow(); foreach (DataGridViewColumn Column in this.dataGridView2.Columns) { dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell); dgvr1.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell); } for (int c = 0; c < this.pointDataTables[dataTableIndex].Columns.Count; c++) { if(c > 1 && !this.pointDataTables[dataTableIndex].Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(this.pointDataTables[dataTableIndex].Rows[r][c].ToString())) dgvr.Cells[c].Value = Math.Round((double)Convert.ToDecimal(this.pointDataTables[dataTableIndex].Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString(); else dgvr.Cells[c].Value = this.pointDataTables[dataTableIndex].Rows[r][c].ToString(); dgvr1.Cells[c].Value = this.pointDataTables[dataTableIndex].Rows[r][c].ToString(); } this.dataGridView2.Rows.Add(dgvr); this.dataGridView3.Rows.Add(dgvr1); } int left; int right; string leftValue; string rightValue; for (int i = 0; i < this.dataGridView2.Rows.Count; i++) { left = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("%"); right = this.dataGridView2.Rows[i].Cells[1].Value.ToString().IndexOf("-"); leftValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(0, left); rightValue = this.dataGridView2.Rows[i].Cells[1].Value.ToString().Substring(right + 1); if (this.dataGridView2.Rows[i].Cells[2].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[2].Value.ToString()) && !this.dataGridView2.Rows[i].Cells[2].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[2].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[2].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))))) this.dataGridView2.Rows[i].Cells[2].Style.BackColor = Color.Red; if (this.dataGridView2.Rows[i].Cells[3].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[3].Value.ToString()) && !this.dataGridView2.Rows[i].Cells[3].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[3].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[3].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))))) this.dataGridView2.Rows[i].Cells[3].Style.BackColor = Color.Red; if (this.dataGridView2.Rows[i].Cells[4].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[4].Value.ToString()) && !this.dataGridView2.Rows[i].Cells[4].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[4].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[4].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))))) this.dataGridView2.Rows[i].Cells[4].Style.BackColor = Color.Red; if (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[7].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[7].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))) this.dataGridView2.Rows[i].Cells[7].Style.BackColor = Color.Red; if (this.linesNumber == 4) { if (this.dataGridView2.Rows[i].Cells[5].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[5].Value.ToString()) && !this.dataGridView2.Rows[i].Cells[5].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[5].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[5].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))))) this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red; } else if (this.linesNumber == 5) { if (this.dataGridView2.Rows[i].Cells[5].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[5].Value.ToString()) && !this.dataGridView2.Rows[i].Cells[5].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[5].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[5].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))))) this.dataGridView2.Rows[i].Cells[5].Style.BackColor = Color.Red; if (this.dataGridView2.Rows[i].Cells[6].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) || (!string.IsNullOrEmpty(this.dataGridView2.Rows[i].Cells[6].Value.ToString()) && !this.dataGridView2.Rows[i].Cells[6].Value.ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && (Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[6].Value) > (Convert.ToDecimal(leftValue) + Convert.ToDecimal(rightValue)) || Convert.ToDecimal(this.dataGridView2.Rows[i].Cells[6].Value) < (Convert.ToDecimal(leftValue) - Convert.ToDecimal(rightValue))))) this.dataGridView2.Rows[i].Cells[6].Style.BackColor = Color.Red; } } } this.documentWorkspace.Refresh(); } } /// /// 显示测量点间距 /// /// /// private void checkBox1_CheckedChanged(object sender, EventArgs e) { this.documentWorkspace.Refresh(); } private void dataGridView3_CellValueChanged(object sender, DataGridViewCellEventArgs e) { int dataTableIndex = 0; if (this.dataGridView3.Rows.Count > 0) { for (int i = 0; i < this.pointDataTables.Count; i++) { if (this.pointDataTables[i].TableName.Equals(this.dataGridView1.Rows[this.dataGridView1.SelectedCells[0].RowIndex].Cells[0].Value)) dataTableIndex = i; } this.pointDataTables[dataTableIndex].Rows.Clear(); for (int r = 0; r < this.dataGridView3.Rows.Count; r++) { DataRow dataRow = this.pointDataTables[dataTableIndex].NewRow(); for (int c = 0; c < this.dataGridView3.Rows[r].Cells.Count; c++) { dataRow[this.dataGridView3.Columns[c].Name] = this.dataGridView3.Rows[r].Cells[c].Value; } this.pointDataTables[dataTableIndex].Rows.Add(dataRow); } } } /// /// 单元格修改验证 /// /// /// private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if(e.RowIndex >= 0) { string newValue = this.dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (i != e.RowIndex && newValue.Equals(this.dataGridView1.Rows[i].Cells[0].Value.ToString())) { MessageBox.Show(PdnResources.GetString("Menu.Namealreadyexists.text")+"!"); this.dataGridView1.Rows[e.RowIndex].Cells[0].Value = oldValue; return; } } foreach (DataTable item in this.pointDataTables) { if (item.TableName.Equals(oldValue)) item.TableName = newValue; } this.saveSuccess = true; } } /// /// 获取单元格修改之前的值 /// /// /// private void dataGridView1_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { oldValue = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); } /// /// 保存结果 /// /// /// private void button2_Click(object sender, EventArgs e) { SaveMeasurementResults(); } /// /// 保存结果 /// private void SaveMeasurementResults() { if (this.listView1.SelectedItems.Count > 0) { string imgName = this.appWorkspace.DocumentWorkspaces[this.listView1.FocusedItem.Index].GetFriendlyName(); string tag = this.imageList1.Images.Keys[this.listView1.SelectedItems[0].Index]; if (this.button3.Visible) { MessageBox.Show(PdnResources.GetString("Menu.Pleasestartmeasuring.text")+"!"); return; } if (this.pointDataTables.Count > 0) { DataTable dataTable1 = new DataTable(); bool replace = false; int add = 0; foreach (ListViewItem item in this.listView2.Items) { if (item.Name.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; } } if (replace || this.listView2.Items.Count == 0 || add == 0) { this.dataGridView4.Rows.Clear(); if (this.linesNumber == 3) { this.dataGridView4.Columns[7].Visible = false; this.dataGridView4.Columns[8].Visible = false; } else if (this.linesNumber == 4) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = false; } else if (this.linesNumber == 5) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = true; } ListViewItem listViewItem = new ListViewItem(); listViewItem.Name = tag; listViewItem.SubItems[0].Text = imgName; listViewItem.Tag = "" + this.linesNumber; if (this.listView2.Items.Count == 0) this.listView2.Items.Add(listViewItem); else this.listView2.Items.Insert(0, listViewItem); dataTable1.TableName = tag; foreach (DataGridViewColumn c in this.dataGridView4.Columns) { dataTable1.Columns.Add(c.HeaderText); } foreach (DataTable dataTable in this.pointDataTables) { for (int r = 0; r < dataTable.Rows.Count; r++) { DataGridViewRow dgvr = new DataGridViewRow(); dgvr.Tag = tag; foreach (DataGridViewColumn Column in this.dataGridView4.Columns) { dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell); } for (int c = 0; c < dataTable.Columns.Count; c++) { dgvr.Cells[0].Value = imgName; dgvr.Cells[1].Value = dataTable.TableName; if (c > 1 && !dataTable.Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text"))) { if (this.linesNumber == 3) { if (c + 2 != 7 && c + 2 != 8) dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString(); else dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString(); } else if (this.linesNumber == 4) { if (c + 2 != 8) dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString(); else dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString(); } else if (this.linesNumber == 5) { dgvr.Cells[c + 2].Value = Math.Round((double)Convert.ToDecimal(dataTable.Rows[r][c]), Convert.ToInt32(this.numericUpDown1.Value)).ToString(); } } else dgvr.Cells[c + 2].Value = dataTable.Rows[r][c].ToString(); } this.dataGridView4.Rows.Add(dgvr); DataRow dataRow = dataTable1.NewRow(); for (int c = 0; c < dataTable.Columns.Count + 2; c++) { if (c == 0) dataRow[this.dataGridView4.Columns[c].HeaderText] = imgName; else if (c == 1) dataRow[this.dataGridView4.Columns[c].HeaderText] = dataTable.TableName; else dataRow[this.dataGridView4.Columns[c].HeaderText] = dataTable.Rows[r][c - 2].ToString(); } dataTable1.Rows.Add(dataRow); } } foreach (DataTable dataTable2 in pictureDataTables) { if (dataTable2.TableName.Equals(dataTable1.TableName)) { pictureDataTables.Remove(dataTable2); break; } } this.pictureDataTables.Add(dataTable1); if (this.allShow) AllShow(); this.listView2.Items[0].Selected = true; this.saveSuccess = false; 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")); columnName.Add(PdnResources.GetString("Menu.Thesamplename.Text")); columnName.Add(PdnResources.GetString("Menu.Theintersectionsofthefirstline.Text")); columnName.Add(PdnResources.GetString("Menu.Theintersectionsofthesecondtline.Text")); columnName.Add(PdnResources.GetString("Menu.Theintersectionsofthethirdtline.Text")); if (this.linesNumber == 4) { columnName.Add(PdnResources.GetString("Menu.Theintersectionsoftheforthtline.Text")); } else if (this.linesNumber == 5) { columnName.Add(PdnResources.GetString("Menu.Theintersectionsoftheforthtline.Text")); columnName.Add(PdnResources.GetString("Menu.Theintersectionsofthefivthtline.Text")); } dataList.Add(columnName); string valuesL1 = string.Empty; string valuesL2 = string.Empty; string valuesL3 = string.Empty; string valuesL4 = string.Empty; string valuesL5 = string.Empty; int valueCt1 = 0; int valueCt2 = 0; int valueCt3 = 0; int valueCt4 = 0; int valueCt5 = 0; if (this.linesNumber == 3) { for (int i = 0; i < this.dataGridView1.Rows.Count; i++) { valuesL1 = string.Empty; valuesL2 = string.Empty; valuesL3 = string.Empty; List strList = new List(); strList.Add((i + 1).ToString()); strList.Add(this.dataGridView1.Rows[i].Cells[0].Value.ToString()); foreach (var lengthList in this.lengthL1[i]) { if (this.lengthL1[i].Count == 1 || valueCt1 == this.lengthL1[i].Count - 1) valuesL1 += lengthList.ToString(); else valuesL1 += lengthList.ToString() + ","; valueCt1++; } foreach (var lengthList in this.lengthL2[i]) { if (this.lengthL2[i].Count == 1 || valueCt2 == this.lengthL2[i].Count - 1) valuesL2 += lengthList.ToString(); else valuesL2 += lengthList.ToString() + ","; valueCt2++; } foreach (var lengthList in this.lengthL3[i]) { if (this.lengthL3[i].Count == 1 || valueCt3 == this.lengthL3[i].Count - 1) valuesL3 += lengthList.ToString(); else valuesL3 += lengthList.ToString() + ","; valueCt3++; } strList.Add(valuesL1); strList.Add(valuesL2); strList.Add(valuesL3); dataList.Add(strList); } } else if (this.linesNumber == 4) { for (int i = 0; i < this.dataGridView1.Rows.Count; i++) { valuesL1 = string.Empty; valuesL2 = string.Empty; valuesL3 = string.Empty; valuesL4 = string.Empty; List strList = new List(); strList.Add((i + 1).ToString()); strList.Add(this.dataGridView1.Rows[i].Cells[0].Value.ToString()); foreach (var lengthList in this.lengthL1[i]) { if (this.lengthL1[i].Count == 1 || valueCt1 == this.lengthL1[i].Count - 1) valuesL1 += lengthList.ToString(); else valuesL1 += lengthList.ToString() + ","; valueCt1++; } foreach (var lengthList in this.lengthL2[i]) { if (this.lengthL2[i].Count == 1 || valueCt2 == this.lengthL2[i].Count - 1) valuesL2 += lengthList.ToString(); else valuesL2 += lengthList.ToString() + ","; valueCt2++; } foreach (var lengthList in this.lengthL3[i]) { if (this.lengthL3[i].Count == 1 || valueCt3 == this.lengthL3[i].Count - 1) valuesL3 += lengthList.ToString(); else valuesL3 += lengthList.ToString() + ","; valueCt3++; } foreach (var lengthList in this.lengthL4[i]) { if (this.lengthL4[i].Count == 1 || valueCt4 == this.lengthL4[i].Count - 1) valuesL4 += lengthList.ToString(); else valuesL4 += lengthList.ToString() + ","; valueCt4++; } strList.Add(valuesL1); strList.Add(valuesL2); strList.Add(valuesL3); strList.Add(valuesL4); dataList.Add(strList); } } else if(this.linesNumber == 5) { for (int i = 0; i < this.dataGridView1.Rows.Count; i++) { valuesL1 = string.Empty; valuesL2 = string.Empty; valuesL3 = string.Empty; valuesL4 = string.Empty; valuesL5 = string.Empty; List strList = new List(); strList.Add((i + 1).ToString()); strList.Add(this.dataGridView1.Rows[i].Cells[0].Value.ToString()); foreach (var lengthList in this.lengthL1[i]) { if (this.lengthL1[i].Count == 1 || valueCt1 == this.lengthL1[i].Count - 1) valuesL1 += lengthList.ToString(); else valuesL1 += lengthList.ToString() + ","; valueCt1++; } foreach (var lengthList in this.lengthL2[i]) { if (this.lengthL2[i].Count == 1 || valueCt2 == this.lengthL2[i].Count - 1) valuesL2 += lengthList.ToString(); else valuesL2 += lengthList.ToString() + ","; valueCt2++; } foreach (var lengthList in this.lengthL3[i]) { if (this.lengthL3[i].Count == 1 || valueCt3 == this.lengthL3[i].Count - 1) valuesL3 += lengthList.ToString(); else valuesL3 += lengthList.ToString() + ","; valueCt3++; } foreach (var lengthList in this.lengthL4[i]) { if (this.lengthL4[i].Count == 1 || valueCt4 == this.lengthL4[i].Count - 1) valuesL4 += lengthList.ToString(); else valuesL4 += lengthList.ToString() + ","; valueCt4++; } foreach (var lengthList in this.lengthL5[i]) { if (this.lengthL5[i].Count == 1 || valueCt5 == this.lengthL5[i].Count - 1) valuesL5 += lengthList.ToString(); else valuesL5 += lengthList.ToString() + ","; valueCt5++; } strList.Add(valuesL1); strList.Add(valuesL2); strList.Add(valuesL3); strList.Add(valuesL4); strList.Add(valuesL5); 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.Pleaseaddsamples.text")+"!"); } } else { MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectapictureandmeasure.text")+"!"); } } /// /// 切换测量记录 /// /// /// private void listView_SelectedIndexChanged(object sender, EventArgs e) { if(!this.allShow) { if (this.listView2.SelectedItems.Count > 0) { if(this.listView2.SelectedItems[0].Tag.ToString().Equals("3")) { this.dataGridView4.Columns[7].Visible = false; this.dataGridView4.Columns[8].Visible = false; } else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("4")) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = false; } else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("5")) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = true; } 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.Name)) dataTableIndex .Add(i); } } this.dataGridView4.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.dataGridView4.Columns) { dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell); } for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++) { if (c > 3 && !this.pictureDataTables[item].Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(this.pictureDataTables[item].Rows[r][c].ToString())) 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.dataGridView4.Rows.Add(dgvr); } } } } } else { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = true; } } /// /// 全部显示 /// /// /// private void button11_Click(object sender, EventArgs e) { this.allShow = true; this.button11.Visible = false; this.button16.Visible = true; AllShow(); } private void AllShow() { this.dataGridView4.Rows.Clear(); DataTable dataTable = new DataTable(); foreach (DataTable item in this.pictureDataTables) { if (item.Columns.Count == 8) { this.dataGridView4.Columns[7].Visible = false; this.dataGridView4.Columns[8].Visible = false; } if (item.Columns.Count == 9) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = false; } if (item.Columns.Count == 10) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = true; } } 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.dataGridView4.Columns) { dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell); } for (int c = 0; c < dataTable.Columns.Count; c++) { if (c > 3 && !dataTable.Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(dataTable.Rows[r][c].ToString())) 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.dataGridView4.Rows.Add(dgvr); } } } /// /// 取消全部显示 /// /// /// private void button16_Click(object sender, EventArgs e) { this.allShow = false; this.button11.Visible = true; this.button16.Visible = false; if (this.listView2.SelectedItems.Count > 0) { if (this.listView2.SelectedItems[0].Tag.ToString().Equals("3")) { this.dataGridView4.Columns[7].Visible = false; this.dataGridView4.Columns[8].Visible = false; } else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("4")) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = false; } else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("5")) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = true; } 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.Name)) dataTableIndex.Add(i); } } this.dataGridView4.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.dataGridView4.Columns) { dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell); } for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++) { if (c > 3 && !this.pictureDataTables[item].Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(this.pictureDataTables[item].Rows[r][c].ToString())) 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.dataGridView4.Rows.Add(dgvr); } } } } else { if (this.listView2.Items.Count >0 ) { this.listView2.Items[0].Selected = true; } if (this.pictureDataTables.Count > 0 && this.pictureDataTables[this.pictureDataTables.Count - 1].Rows.Count > 0) { this.dataGridView4.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.dataGridView4.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 > 3 && !this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(this.pictureDataTables[this.pictureDataTables.Count - 1].Rows[r][c].ToString())) 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.dataGridView4.Rows.Add(dgvr); } } } } /// /// 导出结果Excel /// /// /// private void button14_Click(object sender, EventArgs e) { if(this.listView2.Items.Count > 0) { SaveFileDialog exe = new SaveFileDialog(); exe.Filter = "Execl files (*.xlsx)|*.xlsx"; exe.FilterIndex = 0; exe.RestoreDirectory = true; exe.Title = "Export Excel File"; exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + PdnResources.GetString("Menu.DedicatedAnalysis.NonferrousMetal.RecombinationRate.Text")+ PdnResources.GetString("Menu.Analysisresult.text"); DialogResult dr = exe.ShowDialog(); if (dr == DialogResult.OK) { DataTable dtb = new DataTable(); foreach (DataGridViewColumn c in this.dataGridView4.Columns) { dtb.Columns.Add(c.HeaderText); } for (int r = 0; r < this.dataGridView4.Rows.Count; r++) { DataRow dataRow = dtb.NewRow(); for (int c = 0; c < this.dataGridView4.Rows[r].Cells.Count; c++) { dataRow[this.dataGridView4.Columns[c].HeaderText] = this.dataGridView4.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 numericUpDown1_ValueChanged(object sender, EventArgs e) { this.decimalCls = (int)this.numericUpDown1.Value; this.documentWorkspace.Refresh(); RefreshDataGridView4(); } /// /// 分析结果删除 /// /// /// private void button12_Click(object sender, EventArgs e) { if(this.listView2.Items.Count > 0) { if (this.listView2.SelectedItems.Count > 0) { if (this.listView2.SelectedItems[0].Tag.ToString().Equals("3")) { this.dataGridView4.Columns[7].Visible = false; this.dataGridView4.Columns[8].Visible = false; } else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("4")) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = false; } else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("5")) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = true; } 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.Name.ToString()); this.listView2.Items.Remove(item); } foreach (string item in detaleName) { foreach (DataTable dataTable in this.pictureDataTables) { if (dataTable.TableName.Equals(item)) { this.pictureDataTables.Remove(dataTable); break; } } } foreach (string tag in detaleName) { 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.dataGridView4.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) { if (this.listView2.SelectedItems[0].Tag.ToString().Equals("3")) { this.dataGridView4.Columns[7].Visible = false; this.dataGridView4.Columns[8].Visible = false; } else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("4")) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = false; } else if (this.listView2.SelectedItems[0].Tag.ToString().Equals("5")) { this.dataGridView4.Columns[7].Visible = true; this.dataGridView4.Columns[8].Visible = true; } 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.Name)) dataTableIndex.Add(i); } } this.dataGridView4.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.dataGridView4.Columns) { dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell); } for (int c = 0; c < this.pictureDataTables[item].Columns.Count; c++) { if (c > 3 && !this.pictureDataTables[item].Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(this.pictureDataTables[item].Rows[r][c].ToString())) 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.dataGridView4.Rows.Add(dgvr); } } } } } else { this.dataGridView4.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.dataGridView4.Columns) { dgvr.Cells.Add(Column.CellTemplate.Clone() as DataGridViewCell); } for (int c = 0; c < dataTable.Columns.Count; c++) { if (c > 3 && !dataTable.Rows[r][c].ToString().Equals(PdnResources.GetString("Menu.Alittleless.Text")) && !string.IsNullOrEmpty(dataTable.Rows[r][c].ToString())) 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.dataGridView4.Rows.Add(dgvr); } } } } /// /// 生成报告 /// /// /// private void button13_Click(object sender, EventArgs e) { if (this.checkBox2.Checked) { AnalyzeSettingDialog recombinationRateSetDialog = new AnalyzeSettingDialog(this, "Template.Manager.item3.RecombinationRate"); 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>(); if (this.linesNumber == 3) { for (int i = 0; i < this.dataGridView4.Rows.Count; i++) { List content1 = new List(); if(i == 0) { content1.Add(this.dataGridView4.Columns[0].HeaderText); content1.Add(this.dataGridView4.Columns[1].HeaderText); content1.Add(this.dataGridView4.Columns[2].HeaderText); content1.Add(this.dataGridView4.Columns[3].HeaderText); content1.Add(this.dataGridView4.Columns[4].HeaderText); content1.Add(this.dataGridView4.Columns[5].HeaderText); content1.Add(this.dataGridView4.Columns[6].HeaderText); content1.Add(this.dataGridView4.Columns[9].HeaderText); analysisContent.Add(content1); } content1 = new List(); content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString()); analysisContent.Add(content1); } } else if (this.linesNumber == 4) { for (int i = 0; i < this.dataGridView4.Rows.Count; i++) { List content1 = new List(); if (i == 0) { content1.Add(this.dataGridView4.Columns[0].HeaderText); content1.Add(this.dataGridView4.Columns[1].HeaderText); content1.Add(this.dataGridView4.Columns[2].HeaderText); content1.Add(this.dataGridView4.Columns[3].HeaderText); content1.Add(this.dataGridView4.Columns[4].HeaderText); content1.Add(this.dataGridView4.Columns[5].HeaderText); content1.Add(this.dataGridView4.Columns[6].HeaderText); content1.Add(this.dataGridView4.Columns[7].HeaderText); content1.Add(this.dataGridView4.Columns[9].HeaderText); analysisContent.Add(content1); } content1 = new List(); content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString()); analysisContent.Add(content1); } } else if (this.linesNumber == 5) { for (int i = 0; i < this.dataGridView4.Rows.Count; i++) { List content1 = new List(); if (i == 0) { content1.Add(this.dataGridView4.Columns[0].HeaderText); content1.Add(this.dataGridView4.Columns[1].HeaderText); content1.Add(this.dataGridView4.Columns[2].HeaderText); content1.Add(this.dataGridView4.Columns[3].HeaderText); content1.Add(this.dataGridView4.Columns[4].HeaderText); content1.Add(this.dataGridView4.Columns[5].HeaderText); content1.Add(this.dataGridView4.Columns[6].HeaderText); content1.Add(this.dataGridView4.Columns[7].HeaderText); content1.Add(this.dataGridView4.Columns[8].HeaderText); content1.Add(this.dataGridView4.Columns[9].HeaderText); analysisContent.Add(content1); } content1 = new List(); content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[8].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[9].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.dataGridView4.Rows) { foreach (ListViewItem item in this.listView2.SelectedItems) { if (bitDic.ContainsKey(item.Name + "|" + itemRow.Cells[1].Value.ToString()) && itemRow.Tag.Equals(item.Name)) { bitList.Add(bitDic[item.Name + "|" + itemRow.Cells[1].Value.ToString()][0]); bitList.Add(bitDic[item.Name + "|" + itemRow.Cells[1].Value.ToString()][1]); } } } } } this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, bitList, tagInfos); } else MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!"); } private void listView2_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { if(!this.allShow) { if (this.listView2.SelectedItems.Count == 0) this.dataGridView4.Rows.Clear(); } } /// /// 不可点击空白区域 /// /// /// 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 button17_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.DedicatedAnalysis.NonferrousMetal.RecombinationRate.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>(); if (this.linesNumber == 3) { for (int i = 0; i < this.dataGridView4.Rows.Count; i++) { List content1 = new List(); if (i == 0) { content1.Add(this.dataGridView4.Columns[0].HeaderText); content1.Add(this.dataGridView4.Columns[1].HeaderText); content1.Add(this.dataGridView4.Columns[2].HeaderText); content1.Add(this.dataGridView4.Columns[3].HeaderText); content1.Add(this.dataGridView4.Columns[4].HeaderText); content1.Add(this.dataGridView4.Columns[5].HeaderText); content1.Add(this.dataGridView4.Columns[6].HeaderText); content1.Add(this.dataGridView4.Columns[9].HeaderText); analysisContent.Add(content1); } content1 = new List(); content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString()); analysisContent.Add(content1); } } else if (this.linesNumber == 4) { for (int i = 0; i < this.dataGridView4.Rows.Count; i++) { List content1 = new List(); if (i == 0) { content1.Add(this.dataGridView4.Columns[0].HeaderText); content1.Add(this.dataGridView4.Columns[1].HeaderText); content1.Add(this.dataGridView4.Columns[2].HeaderText); content1.Add(this.dataGridView4.Columns[3].HeaderText); content1.Add(this.dataGridView4.Columns[4].HeaderText); content1.Add(this.dataGridView4.Columns[5].HeaderText); content1.Add(this.dataGridView4.Columns[6].HeaderText); content1.Add(this.dataGridView4.Columns[7].HeaderText); content1.Add(this.dataGridView4.Columns[9].HeaderText); analysisContent.Add(content1); } content1 = new List(); content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[9].Value.ToString()); analysisContent.Add(content1); } } else if (this.linesNumber == 5) { for (int i = 0; i < this.dataGridView4.Rows.Count; i++) { List content1 = new List(); if (i == 0) { content1.Add(this.dataGridView4.Columns[0].HeaderText); content1.Add(this.dataGridView4.Columns[1].HeaderText); content1.Add(this.dataGridView4.Columns[2].HeaderText); content1.Add(this.dataGridView4.Columns[3].HeaderText); content1.Add(this.dataGridView4.Columns[4].HeaderText); content1.Add(this.dataGridView4.Columns[5].HeaderText); content1.Add(this.dataGridView4.Columns[6].HeaderText); content1.Add(this.dataGridView4.Columns[7].HeaderText); content1.Add(this.dataGridView4.Columns[8].HeaderText); content1.Add(this.dataGridView4.Columns[9].HeaderText); analysisContent.Add(content1); } content1 = new List(); content1.Add(this.dataGridView4.Rows[i].Cells[0].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[1].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[2].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[3].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[4].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[5].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[6].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[7].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[8].Value.ToString()); content1.Add(this.dataGridView4.Rows[i].Cells[9].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.dataGridView4.Rows) { foreach (ListViewItem itemL2 in this.listView2.SelectedItems) { if (bitDic.ContainsKey(itemL2.Name + "|" + itemRow.Cells[1].Value.ToString())) { bitList.Add(bitDic[itemL2.Name + "|" + itemRow.Cells[1].Value.ToString()][0]); bitList.Add(bitDic[itemL2.Name + "|" + itemRow.Cells[1].Value.ToString()][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.Name)) { 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 this.appWorkspace.CreateAnalysisReport(this.analyzeSettingModel, analysisContent, tempDataModel, bitList, tagInfos, item.path, item.code); } else { MessageBox.Show(PdnResources.GetString("Menu.Pleasesettheanalysisreportfirst.text")+"!"); return; } //保存项目信息到数据库 this.appWorkspace.InsertIntoDB(this.analyzeSettingModel, item); } } catch (Exception) { } } #region 参数保存及提取 /// /// 保存参数的key,value和type /// /// /// /// private void saveParamValue(string param_key, string param_value, int param_type) { bool foundItem = false; foreach (var item in this.analysisModel.ListParam) { if (item.param_key.Equals(param_key) && item.menuId == this.menuId) { item.param_value = param_value; item.setValue(); foundItem = true; break; } } if (!foundItem) { GrainSizeAnalysisModel analysisItem = new GrainSizeAnalysisModel(); analysisItem.menuId = this.menuId; analysisItem.param_key = param_key; analysisItem.param_type = param_type; analysisItem.param_value = param_value; analysisItem.setValue(); this.analysisModel.ListParam.Add(analysisItem); } } /// /// 保存界面中的参数到model /// private void saveDialogParamValues() { saveParamValue(ParamKey_ShowData, checkBox1.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//显示数据 saveParamValue(ParamKey_Report, checkBox2.Checked ? "0" : "1", (int)Base.Dtryt.Boolean);//报告设置 saveParamValue(ParamKey_DecimalPlace, numericUpDown1 != null ? numericUpDown1.Value.ToString() : "", (int)Base.Dtryt.Decimal);//保留小数位数 } /// /// 获取保存的参数 /// private void GetListParamModel() { if (this.analysisModel != null) { for (int i = 0; i < this.analysisModel.ListParam.Count; i++) { switch (this.analysisModel.ListParam[i].param_key) { case ParamKey_ShowData: checkBox1.Checked = (Boolean)this.analysisModel.ListParam[i].value; break; case ParamKey_Report: checkBox2.Checked = (Boolean)this.analysisModel.ListParam[i].value; break; case ParamKey_DecimalPlace: numericUpDown1.Value = decimal.Parse(this.analysisModel.ListParam[i].param_value); break; } } } } /// /// 关闭窗体时保存参数 /// /// /// private void RecombinationRateDialog_FormClosing(object sender, FormClosingEventArgs e) { #region [开启脚本录制] if (appWorkspace.startScriptRecording) { getScriptRecording(); } #endregion this.saveDialogParamValues(); //xml保存路径 string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\GrainSizeAnalyze\\GrainSizeAnalysisModel.xml"; GrainSizeAnalysisModel analysisModelXml = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(filePath, System.IO.FileMode.Open)); foreach (var analysisItem in this.analysisModel.ListParam) { bool foundItem = false; foreach (var item in analysisModelXml.ListParam) { if (item.param_key.Equals(analysisItem.param_key) && item.menuId == analysisItem.menuId) { item.param_value = analysisItem.param_value; foundItem = true; break; } } if (!foundItem) analysisModelXml.ListParam.Add(analysisItem.cloneModel()); } //按路径和名称保存xml文件 string userInfoXml = XmlSerializeHelper.XmlSerialize(analysisModelXml); //保存xml FileOperationHelper.WriteStringToFile(userInfoXml, filePath, System.IO.FileMode.Create); } #endregion #region [脚本相关] private void getValue(string key, object value) { switch (key) { case "parameter1": checkBox1.Checked = Convert.ToBoolean(value); break; case "OpenWhileExportReport": checkBox2.Checked = Convert.ToBoolean(value); break; case "CalculatorDecimalDigits": numericUpDown1.Value = Convert.ToDecimal(value); break; } } #endregion #region [脚本录制] private void getScriptRecording() { string className = InvariantData.path_Action + ".Action" + menuId; ParamObject param = (ParamObject)System.Reflection.Assembly.Load(InvariantData.assembly_Data).CreateInstance(className); List args = param.Lists; foreach (var item in args) { item.value = setScriptRecording(item.key); } appWorkspace.SetScriptStartRecording(this.menuId, menuName, args); } private object setScriptRecording(string key) { object value = null; switch (key) { case "parameter1": value = checkBox1.Checked; break; case "OpenWhileExportReport": value = checkBox2.Checked; break; case "CalculatorDecimalDigits": value = numericUpDown1.Value; break; } return value; } #endregion } }