Browse Source

处理样品孔拍摄只一张图片时程序报错bug
添加样品台编辑器部分代码

CXS 3 years ago
parent
commit
24d320ccff

+ 8 - 8
OTSIncAMeasureApp/0-OTSModel/Measure/ParamData/COTSMsrPrjResultData.cs

@@ -1581,10 +1581,10 @@ namespace OTSModelSharp
                 xSystype.AssignValue(m_nPackId.ToString());
                 xSystype.AssignValue(m_nPackId.ToString());
                 xstrPathName.AssignValue(m_strPathName);
                 xstrPathName.AssignValue(m_strPathName);
                 xholeBSEImgs.Clear();
                 xholeBSEImgs.Clear();
-                foreach (var hole in m_listHoleBSEImg)
-                {
-                    xholeBSEImgs.addItem(hole);
-                }
+                //foreach (var hole in m_listHoleBSEImg)
+                //{
+                //    xholeBSEImgs.addItem(hole);
+                //}
                 xsamples.Clear();
                 xsamples.Clear();
                 foreach (var sample in m_listSamples)
                 foreach (var sample in m_listSamples)
                 {
                 {
@@ -1598,10 +1598,10 @@ namespace OTSModelSharp
                 slo.Serialize(false, classDoc, rootNode);
                 slo.Serialize(false, classDoc, rootNode);
                 m_strPathName = xstrPathName.value();
                 m_strPathName = xstrPathName.value();
                 m_listHoleBSEImg.Clear();
                 m_listHoleBSEImg.Clear();
-                for (int i = 0; i < xholeBSEImgs.size(); i++)
-                {
-                    m_listHoleBSEImg.Add(xholeBSEImgs.getItem(i));
-                }
+                //for (int i = 0; i < xholeBSEImgs.size(); i++)
+                //{
+                //    m_listHoleBSEImg.Add(xholeBSEImgs.getItem(i));
+                //}
                 m_listSamples.Clear();
                 m_listSamples.Clear();
                 for (int i = 0; i < (int)xsamples.size(); i++)
                 for (int i = 0; i < (int)xsamples.size(); i++)
                 {
                 {

+ 54 - 18
OTSIncAMeasureApp/7-OTSProgMgrInfo/Stage/DlgStageEdit.Designer.cs

@@ -61,22 +61,25 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
             this.radioButton__StandardsampleSqare = new System.Windows.Forms.RadioButton();
             this.radioButton__StandardsampleSqare = new System.Windows.Forms.RadioButton();
             this.radioButton_StandardsampleCircle = new System.Windows.Forms.RadioButton();
             this.radioButton_StandardsampleCircle = new System.Windows.Forms.RadioButton();
             this.label14 = new System.Windows.Forms.Label();
             this.label14 = new System.Windows.Forms.Label();
-            this.label15 = new System.Windows.Forms.Label();
             this.button_Generate = new System.Windows.Forms.Button();
             this.button_Generate = new System.Windows.Forms.Button();
             this.dataGridView_Holes = new System.Windows.Forms.DataGridView();
             this.dataGridView_Holes = new System.Windows.Forms.DataGridView();
+            this.button_AddHole = new System.Windows.Forms.Button();
+            this.button_DelHole = new System.Windows.Forms.Button();
+            this.groupBox3 = new System.Windows.Forms.GroupBox();
             ((System.ComponentModel.ISupportInitialize)(this.m_ctrlStagePicture)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.m_ctrlStagePicture)).BeginInit();
             this.groupBox1.SuspendLayout();
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.groupBox2.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Holes)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Holes)).BeginInit();
+            this.groupBox3.SuspendLayout();
             this.SuspendLayout();
             this.SuspendLayout();
             // 
             // 
             // m_ctrlStagePicture
             // m_ctrlStagePicture
             // 
             // 
             this.m_ctrlStagePicture.BackColor = System.Drawing.Color.White;
             this.m_ctrlStagePicture.BackColor = System.Drawing.Color.White;
-            this.m_ctrlStagePicture.Location = new System.Drawing.Point(848, 13);
+            this.m_ctrlStagePicture.Location = new System.Drawing.Point(831, 13);
             this.m_ctrlStagePicture.Margin = new System.Windows.Forms.Padding(4);
             this.m_ctrlStagePicture.Margin = new System.Windows.Forms.Padding(4);
             this.m_ctrlStagePicture.Name = "m_ctrlStagePicture";
             this.m_ctrlStagePicture.Name = "m_ctrlStagePicture";
-            this.m_ctrlStagePicture.Size = new System.Drawing.Size(900, 848);
+            this.m_ctrlStagePicture.Size = new System.Drawing.Size(917, 848);
             this.m_ctrlStagePicture.TabIndex = 2;
             this.m_ctrlStagePicture.TabIndex = 2;
             this.m_ctrlStagePicture.TabStop = false;
             this.m_ctrlStagePicture.TabStop = false;
             // 
             // 
@@ -240,6 +243,7 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
             this.radioButton_BoundarySquare.TabStop = true;
             this.radioButton_BoundarySquare.TabStop = true;
             this.radioButton_BoundarySquare.Text = "方形";
             this.radioButton_BoundarySquare.Text = "方形";
             this.radioButton_BoundarySquare.UseVisualStyleBackColor = true;
             this.radioButton_BoundarySquare.UseVisualStyleBackColor = true;
+            this.radioButton_BoundarySquare.Click += new System.EventHandler(this.radioButton_BoundarySquare_Click);
             // 
             // 
             // radioButton_BoundaryCircle
             // radioButton_BoundaryCircle
             // 
             // 
@@ -251,6 +255,7 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
             this.radioButton_BoundaryCircle.TabStop = true;
             this.radioButton_BoundaryCircle.TabStop = true;
             this.radioButton_BoundaryCircle.Text = "圆形";
             this.radioButton_BoundaryCircle.Text = "圆形";
             this.radioButton_BoundaryCircle.UseVisualStyleBackColor = true;
             this.radioButton_BoundaryCircle.UseVisualStyleBackColor = true;
+            this.radioButton_BoundaryCircle.Click += new System.EventHandler(this.radioButton_BoundaryCircle_Click);
             // 
             // 
             // groupBox2
             // groupBox2
             // 
             // 
@@ -356,6 +361,7 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
             this.radioButton__StandardsampleSqare.TabStop = true;
             this.radioButton__StandardsampleSqare.TabStop = true;
             this.radioButton__StandardsampleSqare.Text = "方形";
             this.radioButton__StandardsampleSqare.Text = "方形";
             this.radioButton__StandardsampleSqare.UseVisualStyleBackColor = true;
             this.radioButton__StandardsampleSqare.UseVisualStyleBackColor = true;
+            this.radioButton__StandardsampleSqare.Click += new System.EventHandler(this.radioButton__StandardsampleSqare_Click);
             // 
             // 
             // radioButton_StandardsampleCircle
             // radioButton_StandardsampleCircle
             // 
             // 
@@ -367,6 +373,7 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
             this.radioButton_StandardsampleCircle.TabStop = true;
             this.radioButton_StandardsampleCircle.TabStop = true;
             this.radioButton_StandardsampleCircle.Text = "圆形";
             this.radioButton_StandardsampleCircle.Text = "圆形";
             this.radioButton_StandardsampleCircle.UseVisualStyleBackColor = true;
             this.radioButton_StandardsampleCircle.UseVisualStyleBackColor = true;
+            this.radioButton_StandardsampleCircle.Click += new System.EventHandler(this.radioButton_StandardsampleCircle_Click);
             // 
             // 
             // label14
             // label14
             // 
             // 
@@ -377,42 +384,68 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
             this.label14.TabIndex = 8;
             this.label14.TabIndex = 8;
             this.label14.Text = "标样形状:";
             this.label14.Text = "标样形状:";
             // 
             // 
-            // label15
-            // 
-            this.label15.AutoSize = true;
-            this.label15.Location = new System.Drawing.Point(3, 433);
-            this.label15.Name = "label15";
-            this.label15.Size = new System.Drawing.Size(116, 18);
-            this.label15.TabIndex = 15;
-            this.label15.Text = "样品孔信息:";
-            // 
             // button_Generate
             // button_Generate
             // 
             // 
             this.button_Generate.Location = new System.Drawing.Point(848, 879);
             this.button_Generate.Location = new System.Drawing.Point(848, 879);
             this.button_Generate.Name = "button_Generate";
             this.button_Generate.Name = "button_Generate";
-            this.button_Generate.Size = new System.Drawing.Size(900, 44);
+            this.button_Generate.Size = new System.Drawing.Size(898, 44);
             this.button_Generate.TabIndex = 16;
             this.button_Generate.TabIndex = 16;
             this.button_Generate.Text = "生成";
             this.button_Generate.Text = "生成";
             this.button_Generate.UseVisualStyleBackColor = true;
             this.button_Generate.UseVisualStyleBackColor = true;
             // 
             // 
             // dataGridView_Holes
             // dataGridView_Holes
             // 
             // 
+            this.dataGridView_Holes.AllowUserToAddRows = false;
+            this.dataGridView_Holes.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader;
+            this.dataGridView_Holes.BackgroundColor = System.Drawing.SystemColors.Menu;
+            this.dataGridView_Holes.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
             this.dataGridView_Holes.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.dataGridView_Holes.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
-            this.dataGridView_Holes.Location = new System.Drawing.Point(6, 454);
+            this.dataGridView_Holes.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.dataGridView_Holes.Location = new System.Drawing.Point(3, 24);
             this.dataGridView_Holes.Name = "dataGridView_Holes";
             this.dataGridView_Holes.Name = "dataGridView_Holes";
+            this.dataGridView_Holes.RowHeadersVisible = false;
             this.dataGridView_Holes.RowHeadersWidth = 62;
             this.dataGridView_Holes.RowHeadersWidth = 62;
             this.dataGridView_Holes.RowTemplate.Height = 30;
             this.dataGridView_Holes.RowTemplate.Height = 30;
-            this.dataGridView_Holes.Size = new System.Drawing.Size(806, 469);
+            this.dataGridView_Holes.Size = new System.Drawing.Size(773, 466);
             this.dataGridView_Holes.TabIndex = 17;
             this.dataGridView_Holes.TabIndex = 17;
             // 
             // 
+            // button_AddHole
+            // 
+            this.button_AddHole.Location = new System.Drawing.Point(788, 454);
+            this.button_AddHole.Name = "button_AddHole";
+            this.button_AddHole.Size = new System.Drawing.Size(34, 127);
+            this.button_AddHole.TabIndex = 18;
+            this.button_AddHole.Text = "增加样品孔";
+            this.button_AddHole.UseVisualStyleBackColor = true;
+            // 
+            // button_DelHole
+            // 
+            this.button_DelHole.Location = new System.Drawing.Point(788, 587);
+            this.button_DelHole.Name = "button_DelHole";
+            this.button_DelHole.Size = new System.Drawing.Size(34, 127);
+            this.button_DelHole.TabIndex = 19;
+            this.button_DelHole.Text = "删除样品孔";
+            this.button_DelHole.UseVisualStyleBackColor = true;
+            // 
+            // groupBox3
+            // 
+            this.groupBox3.Controls.Add(this.dataGridView_Holes);
+            this.groupBox3.Location = new System.Drawing.Point(6, 430);
+            this.groupBox3.Name = "groupBox3";
+            this.groupBox3.Size = new System.Drawing.Size(779, 493);
+            this.groupBox3.TabIndex = 20;
+            this.groupBox3.TabStop = false;
+            this.groupBox3.Text = "样品孔信息:";
+            // 
             // DlgStageEdit
             // DlgStageEdit
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
             this.ClientSize = new System.Drawing.Size(1758, 935);
             this.ClientSize = new System.Drawing.Size(1758, 935);
-            this.Controls.Add(this.dataGridView_Holes);
+            this.Controls.Add(this.button_DelHole);
+            this.Controls.Add(this.groupBox3);
             this.Controls.Add(this.button_Generate);
             this.Controls.Add(this.button_Generate);
-            this.Controls.Add(this.label15);
+            this.Controls.Add(this.button_AddHole);
             this.Controls.Add(this.groupBox2);
             this.Controls.Add(this.groupBox2);
             this.Controls.Add(this.groupBox1);
             this.Controls.Add(this.groupBox1);
             this.Controls.Add(this.radioButton_SEM);
             this.Controls.Add(this.radioButton_SEM);
@@ -437,6 +470,7 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
             this.groupBox2.ResumeLayout(false);
             this.groupBox2.ResumeLayout(false);
             this.groupBox2.PerformLayout();
             this.groupBox2.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Holes)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Holes)).EndInit();
+            this.groupBox3.ResumeLayout(false);
             this.ResumeLayout(false);
             this.ResumeLayout(false);
             this.PerformLayout();
             this.PerformLayout();
 
 
@@ -476,8 +510,10 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
         private System.Windows.Forms.RadioButton radioButton__StandardsampleSqare;
         private System.Windows.Forms.RadioButton radioButton__StandardsampleSqare;
         private System.Windows.Forms.RadioButton radioButton_StandardsampleCircle;
         private System.Windows.Forms.RadioButton radioButton_StandardsampleCircle;
         private System.Windows.Forms.Label label14;
         private System.Windows.Forms.Label label14;
-        private System.Windows.Forms.Label label15;
         private System.Windows.Forms.Button button_Generate;
         private System.Windows.Forms.Button button_Generate;
         private System.Windows.Forms.DataGridView dataGridView_Holes;
         private System.Windows.Forms.DataGridView dataGridView_Holes;
+        private System.Windows.Forms.Button button_AddHole;
+        private System.Windows.Forms.Button button_DelHole;
+        private System.Windows.Forms.GroupBox groupBox3;
     }
     }
 }
 }

+ 81 - 0
OTSIncAMeasureApp/7-OTSProgMgrInfo/Stage/DlgStageEdit.cs

@@ -19,7 +19,88 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
 
 
         private void DlgStageEdit_Load(object sender, EventArgs e)
         private void DlgStageEdit_Load(object sender, EventArgs e)
         {
         {
+            radioButton_OTS.Checked = true;
+            radioButton_BoundarySquare.Checked = true;
+            radioButton__StandardsampleSqare.Checked = true;
+            dataGridView_Holes.Columns.Add("HoleName", "样品孔名称");
+            //dataGridView_Holes.Columns.Add("HoleShape", "样品孔形状");
+            DataGridViewComboBoxColumn HoleShape = new DataGridViewComboBoxColumn();//新建一个列,列的类型是DataGridViewComboBoxColumn
+            HoleShape.HeaderText = "样品孔形状";
+            HoleShape.Items.Add("圆形");//下拉列表选项
+            HoleShape.Items.Add("方形");
+            HoleShape.DefaultCellStyle.NullValue = HoleShape.Items[0];
+            dataGridView_Holes.Columns.Add(HoleShape);//把d这个列添加到datagridview里
+            dataGridView_Holes.Columns.Add("CenterCoordinatesX", "中心x坐标");
+            dataGridView_Holes.Columns.Add("CenterCoordinatesY", "中心y坐标");
+            dataGridView_Holes.Columns.Add("Param1", "宽度或直径");
+            dataGridView_Holes.Columns.Add("Param2", "高度或0");
+            dataGridView_Holes.Rows.Add("", HoleShape.Items[0], "", "", "", "");
+            //SetDataGridViewStyle();
+        }
+        private void SetDataGridViewStyle()
+        {
+            //用户不能调整标题的高度
+            dataGridView_Holes.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
+
+            //用户不能调整 行高
+            dataGridView_Holes.AllowUserToResizeRows = false;
+
+            //点击选择整行
+            //dataGridView_Holes.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+
+            //居中显示
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
+            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+            dataGridView_Holes.DefaultCellStyle = dataGridViewCellStyle1;
+            dataGridView_Holes.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
+
+            //再次重覆禁用拖动表头高度,居然有效果了
+            dataGridView_Holes.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
+
+            //设置grid可以复制
+            //dataGridView_Holes.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText;
+
+            //设置每列的宽度
+            //dataGridView_Holes.Columns[0].Width = 100;//第一列序号的宽度设置一下吧,要不太丑
+            //dataGridView_Holes.Columns[1].Width = 150;
+            //dataGridView_Holes.Columns[dataGridView_Holes.Columns.Count - 1].Width = 450;
+            //dataGridView_Holes.Columns[dataGridView_Holes.Columns.Count - 1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
+
+            //设置序号列不排序
+            dataGridView_Holes.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
+
+            //设置序号列不可以设置宽度
+            //dataGridView_Holes.Columns[0].Resizable = DataGridViewTriState.False;
+
+            dataGridView_Holes.RowsDefaultCellStyle.BackColor = Color.Azure;
+        }
+
+        private void radioButton_BoundaryCircle_Click(object sender, EventArgs e)
+        {
+            label8.Visible = false;
+            tBoundaryHeight.Visible = false;
+            label7.Text = "半径:";
+        }
 
 
+        private void radioButton_BoundarySquare_Click(object sender, EventArgs e)
+        {
+            label8.Visible = true;
+            tBoundaryHeight.Visible = true;
+            label7.Text = "高度:";
+        }
+
+        private void radioButton_StandardsampleCircle_Click(object sender, EventArgs e)
+        {
+            label9.Visible = false;
+            tStandardsampleHeight.Visible = false;
+            label10.Text = "半径:";
+        }
+
+        private void radioButton__StandardsampleSqare_Click(object sender, EventArgs e)
+        {
+            label9.Visible = true;
+            tStandardsampleHeight.Visible = true;
+            label10.Text = "高度:";
         }
         }
     }
     }
 }
 }