소스 검색

Merge branch 'Release2.3' of http://36.129.163.148:10080/gaoshipeng/OTS2_0 into Release2.3

zhangjiaxin 3 년 전
부모
커밋
b14516e122

+ 42 - 40
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -163,15 +163,7 @@ namespace OTSMeasureApp
         #endregion
 
         #region 标尺变量
-        //缩放的增大缩小的增量
-        private float f_zoom_increment = 0.1f;
-
-        //缩放的基数,临时变量
-        private float f_widthandheight_js = 0;
-
-        //与原先缩放的记录数
-        private float f_zoom_record = 1;
-
+        
         //最小缩放倍数
         private float f_zoom_mix = 0.5f;
 
@@ -654,7 +646,7 @@ namespace OTSMeasureApp
             //绘制样品台信息
             DrawSampleStage(m_OTSSampleStageData);
             //标尺初始化
-            RulerInit();
+            RulerInit(m_OTSSampleStageData);
             //重新绘制
             Invalidate();
             //1.将测量结果窗体中已存在的内容清空
@@ -2727,45 +2719,38 @@ namespace OTSMeasureApp
 
             if (e.Delta > 0)
             {
-               
-                #region //图形缩放计算部份-------放大------------//是放大
-                f_widthandheight_js = f_zoom_increment;
-                f_zoom_record = f_zoom_record + f_zoom_increment;
-                f_zoom_record = float.Parse(f_zoom_record.ToString("#0.0")); //四舍五入,保留一位小数,如果不这样,float会不附合规则
-                #endregion
-
                 #region 计算标尺尺寸部份-----放大------
                 //计算标尺实际占用像素的宽度
-                f_ruler_size = f_ruler_size + Convert.ToInt32(f_old_ruler_size * f_zoom_increment);
+                f_ruler_size = f_old_ruler_size * m_GlobalZoomNum;
                 control_Ruler2.RulerWidth = Convert.ToInt32(f_ruler_size);
+                control_Ruler2.Value = 1000;
                 //显示该像素宽度代表的实际宽度
-                control_Ruler2.SetValueInspector(f_ruler_size, ((Convert.ToDouble(m_OTSSampleStageData.StageDomain.Width) / 54f) / 10));
+                //control_Ruler2.SetValue(control_Ruler2.RulerWidth);
                 //放大过长时,这里将宽度与代表的实际宽度进行折半显示
-                if (control_Ruler2.RulerWidth > 200)
+                while (control_Ruler2.Width > 300)
                 {
-                    control_Ruler2.RulerWidth = Convert.ToInt32(f_ruler_size) / 2;
+                    control_Ruler2.RulerWidth = Convert.ToInt32(control_Ruler2.RulerWidth) / 2;
+                    control_Ruler2.Value = control_Ruler2.Value * 2;
                 }
+                control_Ruler2.SetValue(control_Ruler2.RulerWidth, control_Ruler2.Value.ToString());
                 #endregion
                 
             }
             else
             {
-                if (f_zoom_record >= f_zoom_mix)
+                if (m_GlobalZoomNum >= f_zoom_mix)
                 {
-                    #region //图形缩放计算部份------缩小--------------------
-                    f_widthandheight_js = -f_zoom_increment;
-                    f_zoom_record = f_zoom_record - f_zoom_increment;
-                    f_zoom_record = float.Parse(f_zoom_record.ToString("#0.0")); //四舍五入,保留一位小数,如果不这样,float会不附合规则
-                    #endregion
-
-                    #region 计算标尺尺寸部份-----缩小------f_onepixel_size,是不是该乘以rulerwidth是实际的长度
-                    f_ruler_size = f_ruler_size + Convert.ToInt32(f_old_ruler_size * -f_zoom_increment);
+                    #region 计算标尺尺寸部份-----缩小
+                    f_ruler_size =f_old_ruler_size * m_GlobalZoomNum;
                     control_Ruler2.RulerWidth = Convert.ToInt32(f_ruler_size);
-                    control_Ruler2.SetValueInspector(f_ruler_size, ((Convert.ToDouble(m_OTSSampleStageData.StageDomain.Width) / Convert.ToDouble(54)) / 10));
-                    if (control_Ruler2.RulerWidth > 200)
+                    control_Ruler2.Value = 1000;
+                    //control_Ruler2.SetValue(control_Ruler2.RulerWidth);
+                    while (control_Ruler2.Width > 300)
                     {
-                        control_Ruler2.RulerWidth = Convert.ToInt32(f_ruler_size) / 2;
+                        control_Ruler2.RulerWidth = Convert.ToInt32(control_Ruler2.RulerWidth) / 2;
+                        control_Ruler2.Value = control_Ruler2.Value * 2;
                     }
+                        control_Ruler2.SetValue(control_Ruler2.RulerWidth, control_Ruler2.Value.ToString());
                     #endregion
                 }
             }
@@ -2811,7 +2796,7 @@ namespace OTSMeasureApp
 
                         control_Ruler2.RulerWidth = Convert.ToInt32(f_ruler_size);
                         control_Ruler2.ShowString = "1000um";
-                        control_Ruler2.SetValueInspector(110, ((Convert.ToDouble(m_OTSSampleStageData.StageDomain.Width) / Convert.ToDouble(54)) / 10));
+                        control_Ruler2.SetValue(control_Ruler2.RulerWidth);
                     }
 
                     //重新绘制
@@ -4319,17 +4304,34 @@ namespace OTSMeasureApp
             {
                 //显示
                 control_Ruler2.Visible = true;
-                control_Ruler2.ShowString = "1000um";
+                //control_Ruler2.ShowString = control_Ruler2.Value+"um";
 
-                f_ruler_size = f_ruler_size + Convert.ToInt32(f_old_ruler_size * f_zoom_increment);
+                f_ruler_size = Convert.ToInt32(f_old_ruler_size * m_GlobalZoomNum);
                 control_Ruler2.RulerWidth = Convert.ToInt32(f_ruler_size);
-                control_Ruler2.SetValueInspector(f_ruler_size, ((Convert.ToDouble(m_OTSSampleStageData.StageDomain.Width) / Convert.ToDouble(54)) / 10));
+                control_Ruler2.Value = 1000;
+                //显示该像素宽度代表的实际宽度
+                //control_Ruler2.SetValue(control_Ruler2.RulerWidth);
+                //放大过长时,这里将宽度与代表的实际宽度进行折半显示
+                while (control_Ruler2.Width > 300)
+                {
+                    control_Ruler2.RulerWidth = Convert.ToInt32(control_Ruler2.RulerWidth) / 2;
+                    control_Ruler2.Value = control_Ruler2.Value * 2;
+                }
+                control_Ruler2.SetValue(control_Ruler2.RulerWidth, control_Ruler2.Value.ToString());
             }
         }
-        public void RulerInit()
+        public void RulerInit(StageDrawingData SData)
         {
-            control_Ruler2.ShowString = "100um";
-            control_Ruler2.Width = 130;
+            control_Ruler2.ShowString = "1000um";
+            Point xDomain = new Point(SData.StageDomain.Left, SData.StageDomain.Top);
+            Point yDomain = new Point(SData.StageDomain.Right, SData.StageDomain.Bottom);
+
+            //OTS宽度高度差值
+            float widthDomain = Math.Abs(yDomain.X - xDomain.X);
+            int length = this.Height > this.Width ? this.Width : this.Height;
+            control_Ruler2.RulerWidth = (int)(length / widthDomain * 1000);
+            f_ruler_size = f_old_ruler_size = control_Ruler2.RulerWidth;
+            control_Ruler2.Value = 1000;
         }
         #endregion
 

+ 12 - 60
OTSIncAMeasureApp/5-OTSMeasureStatuImageFun/Control_Ruler.cs

@@ -10,9 +10,9 @@ namespace MyControls
     public partial class Control_Ruler : UserControl
     {
         #region 变量定义
-        private string m_showstring = "100um";
-        private double m_f_value = 0;  //实际表示的长度值
-        private float m_bs = 0;//倍数,计算使用
+        private string m_showstring = "1000um";
+        private double m_f_value = 1000;  //实际表示的长度值
+        //private float m_bs = 0;//倍数,计算使用
 
         /// <summary>
         /// 显示在标尺上的文字
@@ -93,69 +93,21 @@ namespace MyControls
         #endregion
 
         /// <summary>
-        /// 设置当前标尺显示的值,自动计算其显示的文字及宽
+        /// 设置当前标尺
         /// </summary>
-        public void SetValue(double in_value)
+        public void SetValue(int in_value)
         {
-            this.m_f_value = in_value;
-            this.RulerWidth = Convert.ToInt32(in_value);
-
-            //写死缩放逻辑
-            if (this.Width > 100)
-            {
-                m_bs = (float)in_value / 100;
-                for (int i = 0; i < 100; i++)
-                {
-                    if (m_bs > i && m_bs <= (i + 1))
-                    {
-                        m_bs = i + 1;
-                    }
-                }
-
-                this.Width = Convert.ToInt32(in_value / m_bs) + 20; //有20的宽度是边,所以补上
-
-                //修改显示文字
-                m_showstring = Convert.ToInt32(100 / m_bs).ToString() + "μm";
-            }
+            this.Width = in_value + 20; //有20的宽度是边,所以补上
         }
-
-
         /// <summary>
-        /// 传入标尺要显示的宽度,及该宽度代表的1像素um单位级实际宽度
+        /// 
         /// </summary>
-        /// <param name="in_width"></param>
-        /// <param name="in_onepixel_size"></param>
-        public void SetValue(double in_width, double in_onepixel_size)
+        /// <param name="in_value"></param>
+        /// <param name="showstring"></param>
+        public void SetValue(int in_value,string showstring)
         {
-            this.m_f_value = in_width;
-            this.RulerWidth = Convert.ToInt32(in_width);
-            //显示信息
-            m_showstring = Convert.ToInt32(in_width* in_onepixel_size).ToString() + "μm";
-     
-
+            this.Width = in_value + 20; //有20的宽度是边,所以补上
+            m_showstring = showstring + "um";
         }
-        /// <summary>
-        /// 设置当前标尺显示的值,自动计算其显示的文字及宽度
-        /// </summary>
-        public void SetValueInspector(double in_value, double in_xs)
-        {
-            double rulerWidth = 100;
-            double bs = rulerWidth / in_value;
-            if (bs > 1)
-            {
-                m_bs = (float)Math.Round(bs);
-            }
-            else if (bs < 1)
-            {
-                m_bs = (float)Math.Round(bs, 1);
-            }
-            this.Width = (int)(m_bs * in_value);
-            //修改显示文字
-            m_showstring = Convert.ToInt32(100 * m_bs * in_xs).ToString() + "um";
-
-            Invalidate();
-        }
-
-
     }
 }

+ 53 - 55
OTSIncAReportApp/1-UI/OTSTemplateDesigner/OTSReport_Export.Designer.cs

@@ -51,47 +51,45 @@
             // 
             // richTextBox1
             // 
-            this.richTextBox1.Location = new System.Drawing.Point(13, 53);
-            this.richTextBox1.Margin = new System.Windows.Forms.Padding(2);
+            this.richTextBox1.Location = new System.Drawing.Point(17, 66);
+            this.richTextBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.richTextBox1.Name = "richTextBox1";
-            this.richTextBox1.Size = new System.Drawing.Size(455, 231);
+            this.richTextBox1.Size = new System.Drawing.Size(605, 288);
             this.richTextBox1.TabIndex = 60;
             this.richTextBox1.Text = "";
             // 
             // progressBar1
             // 
-            this.progressBar1.Location = new System.Drawing.Point(93, 293);
-            this.progressBar1.Margin = new System.Windows.Forms.Padding(2);
+            this.progressBar1.Location = new System.Drawing.Point(124, 366);
+            this.progressBar1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.progressBar1.Name = "progressBar1";
-            this.progressBar1.Size = new System.Drawing.Size(374, 15);
+            this.progressBar1.Size = new System.Drawing.Size(499, 19);
             this.progressBar1.TabIndex = 70;
             // 
             // label2
             // 
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(5, 293);
-            this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label2.Location = new System.Drawing.Point(7, 366);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(77, 12);
+            this.label2.Size = new System.Drawing.Size(97, 15);
             this.label2.TabIndex = 1004;
             this.label2.Text = "当前导出进度";
             // 
             // label3
             // 
             this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(11, 9);
-            this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label3.Location = new System.Drawing.Point(15, 11);
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(53, 12);
+            this.label3.Size = new System.Drawing.Size(67, 15);
             this.label3.TabIndex = 1001;
             this.label3.Text = "选择模板";
             // 
             // btn_exit
             // 
-            this.btn_exit.Location = new System.Drawing.Point(389, 319);
-            this.btn_exit.Margin = new System.Windows.Forms.Padding(2);
+            this.btn_exit.Location = new System.Drawing.Point(519, 399);
+            this.btn_exit.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btn_exit.Name = "btn_exit";
-            this.btn_exit.Size = new System.Drawing.Size(73, 27);
+            this.btn_exit.Size = new System.Drawing.Size(97, 34);
             this.btn_exit.TabIndex = 90;
             this.btn_exit.Text = "退  出";
             this.btn_exit.UseVisualStyleBackColor = true;
@@ -100,30 +98,29 @@
             // label1
             // 
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(11, 33);
-            this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label1.Location = new System.Drawing.Point(15, 41);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(53, 12);
+            this.label1.Size = new System.Drawing.Size(67, 15);
             this.label1.TabIndex = 1002;
             this.label1.Text = "保存路径";
             this.label1.Visible = false;
             // 
             // tb_lj
             // 
-            this.tb_lj.Location = new System.Drawing.Point(68, 30);
-            this.tb_lj.Margin = new System.Windows.Forms.Padding(2);
+            this.tb_lj.Location = new System.Drawing.Point(91, 38);
+            this.tb_lj.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.tb_lj.Name = "tb_lj";
             this.tb_lj.ReadOnly = true;
-            this.tb_lj.Size = new System.Drawing.Size(285, 21);
+            this.tb_lj.Size = new System.Drawing.Size(379, 25);
             this.tb_lj.TabIndex = 30;
             this.tb_lj.Visible = false;
             // 
             // btn_selectPath
             // 
-            this.btn_selectPath.Location = new System.Drawing.Point(356, 29);
-            this.btn_selectPath.Margin = new System.Windows.Forms.Padding(2);
+            this.btn_selectPath.Location = new System.Drawing.Point(475, 36);
+            this.btn_selectPath.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btn_selectPath.Name = "btn_selectPath";
-            this.btn_selectPath.Size = new System.Drawing.Size(47, 20);
+            this.btn_selectPath.Size = new System.Drawing.Size(63, 25);
             this.btn_selectPath.TabIndex = 40;
             this.btn_selectPath.Text = "...";
             this.btn_selectPath.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -133,19 +130,19 @@
             // 
             // tb_mblj
             // 
-            this.tb_mblj.Location = new System.Drawing.Point(68, 6);
-            this.tb_mblj.Margin = new System.Windows.Forms.Padding(2);
+            this.tb_mblj.Location = new System.Drawing.Point(91, 8);
+            this.tb_mblj.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.tb_mblj.Name = "tb_mblj";
             this.tb_mblj.ReadOnly = true;
-            this.tb_mblj.Size = new System.Drawing.Size(285, 21);
+            this.tb_mblj.Size = new System.Drawing.Size(379, 25);
             this.tb_mblj.TabIndex = 0;
             // 
             // btn_openfilepath
             // 
-            this.btn_openfilepath.Location = new System.Drawing.Point(356, 4);
-            this.btn_openfilepath.Margin = new System.Windows.Forms.Padding(2);
+            this.btn_openfilepath.Location = new System.Drawing.Point(475, 5);
+            this.btn_openfilepath.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btn_openfilepath.Name = "btn_openfilepath";
-            this.btn_openfilepath.Size = new System.Drawing.Size(47, 20);
+            this.btn_openfilepath.Size = new System.Drawing.Size(63, 25);
             this.btn_openfilepath.TabIndex = 10;
             this.btn_openfilepath.Text = "...";
             this.btn_openfilepath.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -154,10 +151,10 @@
             // 
             // btn_TempDes
             // 
-            this.btn_TempDes.Location = new System.Drawing.Point(407, 4);
-            this.btn_TempDes.Margin = new System.Windows.Forms.Padding(2);
+            this.btn_TempDes.Location = new System.Drawing.Point(543, 5);
+            this.btn_TempDes.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btn_TempDes.Name = "btn_TempDes";
-            this.btn_TempDes.Size = new System.Drawing.Size(65, 20);
+            this.btn_TempDes.Size = new System.Drawing.Size(87, 25);
             this.btn_TempDes.TabIndex = 20;
             this.btn_TempDes.Text = "导出编辑";
             this.btn_TempDes.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -167,10 +164,9 @@
             // label4
             // 
             this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(11, 33);
-            this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.label4.Location = new System.Drawing.Point(15, 41);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(53, 12);
+            this.label4.Size = new System.Drawing.Size(68, 15);
             this.label4.TabIndex = 1003;
             this.label4.Text = "数 据 源";
             // 
@@ -178,26 +174,26 @@
             // 
             this.cbo_sjy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.cbo_sjy.FormattingEnabled = true;
-            this.cbo_sjy.Location = new System.Drawing.Point(68, 31);
-            this.cbo_sjy.Margin = new System.Windows.Forms.Padding(2);
+            this.cbo_sjy.Location = new System.Drawing.Point(91, 39);
+            this.cbo_sjy.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.cbo_sjy.Name = "cbo_sjy";
-            this.cbo_sjy.Size = new System.Drawing.Size(285, 20);
+            this.cbo_sjy.Size = new System.Drawing.Size(379, 23);
             this.cbo_sjy.TabIndex = 50;
             // 
             // panel_container
             // 
-            this.panel_container.Location = new System.Drawing.Point(66, 188);
-            this.panel_container.Margin = new System.Windows.Forms.Padding(2);
+            this.panel_container.Location = new System.Drawing.Point(88, 235);
+            this.panel_container.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.panel_container.Name = "panel_container";
-            this.panel_container.Size = new System.Drawing.Size(17, 21);
+            this.panel_container.Size = new System.Drawing.Size(23, 26);
             this.panel_container.TabIndex = 5;
             // 
             // button3
             // 
-            this.button3.Location = new System.Drawing.Point(407, 29);
-            this.button3.Margin = new System.Windows.Forms.Padding(2);
+            this.button3.Location = new System.Drawing.Point(543, 36);
+            this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.button3.Name = "button3";
-            this.button3.Size = new System.Drawing.Size(65, 20);
+            this.button3.Size = new System.Drawing.Size(87, 25);
             this.button3.TabIndex = 40;
             this.button3.Text = "打开文件";
             this.button3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
@@ -207,10 +203,10 @@
             // 
             // btn_preview
             // 
-            this.btn_preview.Location = new System.Drawing.Point(312, 319);
-            this.btn_preview.Margin = new System.Windows.Forms.Padding(2);
+            this.btn_preview.Location = new System.Drawing.Point(416, 399);
+            this.btn_preview.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btn_preview.Name = "btn_preview";
-            this.btn_preview.Size = new System.Drawing.Size(73, 27);
+            this.btn_preview.Size = new System.Drawing.Size(97, 34);
             this.btn_preview.TabIndex = 80;
             this.btn_preview.Text = "打开报表";
             this.btn_preview.UseVisualStyleBackColor = true;
@@ -224,19 +220,21 @@
             // 
             // button7
             // 
-            this.button7.Location = new System.Drawing.Point(234, 319);
+            this.button7.Location = new System.Drawing.Point(312, 399);
+            this.button7.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.button7.Name = "button7";
-            this.button7.Size = new System.Drawing.Size(73, 27);
+            this.button7.Size = new System.Drawing.Size(97, 34);
             this.button7.TabIndex = 1008;
             this.button7.Text = "国标导出";
             this.button7.UseVisualStyleBackColor = true;
+            this.button7.Visible = false;
             this.button7.Click += new System.EventHandler(this.button7_Click);
             // 
             // OTSReport_Export
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(475, 351);
+            this.ClientSize = new System.Drawing.Size(631, 429);
             this.ControlBox = false;
             this.Controls.Add(this.button7);
             this.Controls.Add(this.cbo_sjy);
@@ -256,11 +254,11 @@
             this.Controls.Add(this.richTextBox1);
             this.Controls.Add(this.panel_container);
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
-            this.Margin = new System.Windows.Forms.Padding(2);
+            this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.MaximizeBox = false;
-            this.MaximumSize = new System.Drawing.Size(491, 390);
+            this.MaximumSize = new System.Drawing.Size(649, 476);
             this.MinimizeBox = false;
-            this.MinimumSize = new System.Drawing.Size(491, 390);
+            this.MinimumSize = new System.Drawing.Size(649, 476);
             this.Name = "OTSReport_Export";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
             this.Text = "报告程序输出界面";