Explorar o código

1、解决系统显示缩放后,截图显示不完全的问题;
2、允许离线使用是关闭网络定时检测;
3、定时检测网络断开时不自动关闭,此时不允许使用,等待网络恢复;
4、启动登录密码错误时不自动关闭,重新进入登录。

Dail hai 1 ano
pai
achega
60da623862

BIN=BIN
.vs/Welling_Motor_Debug_Tool/v17/.suo


+ 6 - 2
Welling_Motor_Debug_Tool/GenerateParams.cs

@@ -14,6 +14,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
 using static System.Net.WebRequestMethods;
+using static Welling_Motor_Debug_Tool.mainForm;
 
 namespace Welling_Motor_Debug_Tool
 {
@@ -1203,12 +1204,15 @@ namespace Welling_Motor_Debug_Tool
             Thread.Sleep(1000);
 
             //保存页面
-            Bitmap bit = new Bitmap(this.Width, this.Height);//实例化一个和窗体一样大的bitmap
+            Double scaleX = PrimaryScreen.ScaleX;
+            Double scaleY = PrimaryScreen.ScaleY;
+            Bitmap bit = new Bitmap((int)(this.Width * scaleX), (int)(this.Height * scaleY));//实例化一个和窗体一样大的bitmap
             Graphics g = Graphics.FromImage(bit);
-            g.CopyFromScreen(this.Left, this.Top, 0, 0, new Size(this.Width, this.Height));//保存整个窗体为图片  
+            g.CopyFromScreen((int)(this.Left * scaleX), (int)(this.Top * scaleY), 0, 0, new Size((int)(this.Width * scaleX), (int)(this.Height * scaleY)));//保存整个窗体为图片              
             bit.Save(LocalPath + "\\" + fileName + ".png");
 
             //生成pdf文件,上传服务器
+            //...
 
             //上传            
             bool result1 = myFtp.UploadFile(LocalPath + "\\" + fileName + ".src", ServerPath);

+ 48 - 18
Welling_Motor_Debug_Tool/mainForm.Designer.cs

@@ -555,6 +555,8 @@ namespace Welling_Motor_Debug_Tool
             this.label107 = new System.Windows.Forms.Label();
             this.label_StarInfo = new System.Windows.Forms.Label();
             this.pictureBox2 = new System.Windows.Forms.PictureBox();
+            this.uART协议ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+            this.协议类型ToolStripMenuItem = new System.Windows.Forms.ToolStripComboBox();
             this.menuStrip_Set.SuspendLayout();
             this.statusStrip1.SuspendLayout();
             this.groupBox1.SuspendLayout();
@@ -772,7 +774,8 @@ namespace Welling_Motor_Debug_Tool
             this.生产信息ToolStripMenuItem,
             this.电机类型ToolStripMenuItem,
             this.判断阈值ToolStripMenuItem,
-            this.力矩传感器检验ToolStripMenuItem});
+            this.力矩传感器检验ToolStripMenuItem,
+            this.uART协议ToolStripMenuItem});
             this.配置ToolStripMenuItem.ForeColor = System.Drawing.Color.White;
             this.配置ToolStripMenuItem.Name = "配置ToolStripMenuItem";
             this.配置ToolStripMenuItem.Size = new System.Drawing.Size(54, 25);
@@ -799,7 +802,7 @@ namespace Welling_Motor_Debug_Tool
             // 允许ToolStripMenuItem
             // 
             this.允许ToolStripMenuItem.Name = "允许ToolStripMenuItem";
-            this.允许ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.允许ToolStripMenuItem.Size = new System.Drawing.Size(128, 26);
             this.允许ToolStripMenuItem.Text = "允许";
             this.允许ToolStripMenuItem.Click += new System.EventHandler(this.允许ToolStripMenuItem_Click);
             // 
@@ -808,7 +811,7 @@ namespace Welling_Motor_Debug_Tool
             this.不允许ToolStripMenuItem.Checked = true;
             this.不允许ToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
             this.不允许ToolStripMenuItem.Name = "不允许ToolStripMenuItem";
-            this.不允许ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.不允许ToolStripMenuItem.Size = new System.Drawing.Size(128, 26);
             this.不允许ToolStripMenuItem.Text = "不允许";
             this.不允许ToolStripMenuItem.Click += new System.EventHandler(this.不允许ToolStripMenuItem_Click);
             // 
@@ -829,7 +832,7 @@ namespace Welling_Motor_Debug_Tool
             this.IP地址ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerIP});
             this.IP地址ToolStripMenuItem.Name = "IP地址ToolStripMenuItem";
-            this.IP地址ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.IP地址ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.IP地址ToolStripMenuItem.Text = "IP地址";
             // 
             // toolStripTextBox_ServerIP
@@ -845,7 +848,7 @@ namespace Welling_Motor_Debug_Tool
             this.端口ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerPort});
             this.端口ToolStripMenuItem.Name = "端口ToolStripMenuItem";
-            this.端口ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.端口ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.端口ToolStripMenuItem.Text = "端口";
             // 
             // toolStripTextBox_ServerPort
@@ -861,7 +864,7 @@ namespace Welling_Motor_Debug_Tool
             this.用户名ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerUser});
             this.用户名ToolStripMenuItem.Name = "用户名ToolStripMenuItem";
-            this.用户名ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.用户名ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.用户名ToolStripMenuItem.Text = "用户名";
             // 
             // toolStripTextBox_ServerUser
@@ -877,7 +880,7 @@ namespace Welling_Motor_Debug_Tool
             this.密码ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerPasswd});
             this.密码ToolStripMenuItem.Name = "密码ToolStripMenuItem";
-            this.密码ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.密码ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.密码ToolStripMenuItem.Text = "密码";
             // 
             // toolStripTextBox_ServerPasswd
@@ -893,7 +896,7 @@ namespace Welling_Motor_Debug_Tool
             this.存储路径ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
             this.toolStripTextBox_ServerPath});
             this.存储路径ToolStripMenuItem.Name = "存储路径ToolStripMenuItem";
-            this.存储路径ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.存储路径ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.存储路径ToolStripMenuItem.Text = "存储路径";
             // 
             // toolStripTextBox_ServerPath
@@ -1187,28 +1190,28 @@ namespace Welling_Motor_Debug_Tool
             // 运行信息记录ToolStripMenuItem
             // 
             this.运行信息记录ToolStripMenuItem.Name = "运行信息记录ToolStripMenuItem";
-            this.运行信息记录ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.运行信息记录ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.运行信息记录ToolStripMenuItem.Text = "自动记录";
             this.运行信息记录ToolStripMenuItem.Click += new System.EventHandler(this.记录数据ToolStripMenuItem_Click);
             // 
             // 计算器ToolStripMenuItem
             // 
             this.计算器ToolStripMenuItem.Name = "计算器ToolStripMenuItem";
-            this.计算器ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.计算器ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.计算器ToolStripMenuItem.Text = "计算器";
             this.计算器ToolStripMenuItem.Click += new System.EventHandler(this.计算器ToolStripMenuItem_Click);
             // 
             // 页面保存ToolStripMenuItem
             // 
             this.页面保存ToolStripMenuItem.Name = "页面保存ToolStripMenuItem";
-            this.页面保存ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.页面保存ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.页面保存ToolStripMenuItem.Text = "页面保存";
             this.页面保存ToolStripMenuItem.Click += new System.EventHandler(this.页面保存ToolStripMenuItem_Click);
             // 
             // 屏幕键盘ToolStripMenuItem
             // 
             this.屏幕键盘ToolStripMenuItem.Name = "屏幕键盘ToolStripMenuItem";
-            this.屏幕键盘ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.屏幕键盘ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.屏幕键盘ToolStripMenuItem.Text = "屏幕键盘";
             this.屏幕键盘ToolStripMenuItem.Click += new System.EventHandler(this.屏幕键盘ToolStripMenuItem_Click);
             // 
@@ -1216,7 +1219,7 @@ namespace Welling_Motor_Debug_Tool
             // 
             this.指令调试ToolStripMenuItem.Enabled = false;
             this.指令调试ToolStripMenuItem.Name = "指令调试ToolStripMenuItem";
-            this.指令调试ToolStripMenuItem.Size = new System.Drawing.Size(180, 26);
+            this.指令调试ToolStripMenuItem.Size = new System.Drawing.Size(144, 26);
             this.指令调试ToolStripMenuItem.Text = "指令调试";
             // 
             // 查询ToolStripMenuItem
@@ -4954,6 +4957,7 @@ namespace Welling_Motor_Debug_Tool
             this.textBox_FacModeScan.Name = "textBox_FacModeScan";
             this.textBox_FacModeScan.Size = new System.Drawing.Size(453, 28);
             this.textBox_FacModeScan.TabIndex = 6;
+            this.textBox_FacModeScan.MouseClick += new System.Windows.Forms.MouseEventHandler(this.textBox_FacModeScan_MouseClick);
             this.textBox_FacModeScan.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox_FacModeScan_KeyUp);
             // 
             // label112
@@ -5100,7 +5104,7 @@ namespace Welling_Motor_Debug_Tool
             this.label_CheckModeSN.ForeColor = System.Drawing.SystemColors.ControlText;
             this.label_CheckModeSN.Location = new System.Drawing.Point(108, 100);
             this.label_CheckModeSN.Name = "label_CheckModeSN";
-            this.label_CheckModeSN.Size = new System.Drawing.Size(40, 20);
+            this.label_CheckModeSN.Size = new System.Drawing.Size(35, 20);
             this.label_CheckModeSN.TabIndex = 17;
             this.label_CheckModeSN.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
@@ -5123,7 +5127,7 @@ namespace Welling_Motor_Debug_Tool
             this.label_CheckModeTorque.ForeColor = System.Drawing.SystemColors.ControlText;
             this.label_CheckModeTorque.Location = new System.Drawing.Point(108, 168);
             this.label_CheckModeTorque.Name = "label_CheckModeTorque";
-            this.label_CheckModeTorque.Size = new System.Drawing.Size(40, 20);
+            this.label_CheckModeTorque.Size = new System.Drawing.Size(35, 20);
             this.label_CheckModeTorque.TabIndex = 13;
             this.label_CheckModeTorque.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
@@ -5146,7 +5150,7 @@ namespace Welling_Motor_Debug_Tool
             this.label_CheckModeCfg.ForeColor = System.Drawing.SystemColors.ControlText;
             this.label_CheckModeCfg.Location = new System.Drawing.Point(108, 134);
             this.label_CheckModeCfg.Name = "label_CheckModeCfg";
-            this.label_CheckModeCfg.Size = new System.Drawing.Size(40, 20);
+            this.label_CheckModeCfg.Size = new System.Drawing.Size(35, 20);
             this.label_CheckModeCfg.TabIndex = 13;
             this.label_CheckModeCfg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
@@ -5169,7 +5173,7 @@ namespace Welling_Motor_Debug_Tool
             this.label_CheckModeBoot.ForeColor = System.Drawing.SystemColors.ControlText;
             this.label_CheckModeBoot.Location = new System.Drawing.Point(108, 32);
             this.label_CheckModeBoot.Name = "label_CheckModeBoot";
-            this.label_CheckModeBoot.Size = new System.Drawing.Size(40, 20);
+            this.label_CheckModeBoot.Size = new System.Drawing.Size(35, 20);
             this.label_CheckModeBoot.TabIndex = 9;
             this.label_CheckModeBoot.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
@@ -5192,7 +5196,7 @@ namespace Welling_Motor_Debug_Tool
             this.label_CheckModeFWVer.ForeColor = System.Drawing.SystemColors.ControlText;
             this.label_CheckModeFWVer.Location = new System.Drawing.Point(108, 66);
             this.label_CheckModeFWVer.Name = "label_CheckModeFWVer";
-            this.label_CheckModeFWVer.Size = new System.Drawing.Size(40, 20);
+            this.label_CheckModeFWVer.Size = new System.Drawing.Size(35, 20);
             this.label_CheckModeFWVer.TabIndex = 9;
             this.label_CheckModeFWVer.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
             // 
@@ -5330,6 +5334,7 @@ namespace Welling_Motor_Debug_Tool
             this.textBox_CheckModeScan.Name = "textBox_CheckModeScan";
             this.textBox_CheckModeScan.Size = new System.Drawing.Size(453, 28);
             this.textBox_CheckModeScan.TabIndex = 14;
+            this.textBox_CheckModeScan.MouseClick += new System.Windows.Forms.MouseEventHandler(this.textBox_CheckModeScan_MouseClick);
             this.textBox_CheckModeScan.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBox_CheckModeScan_KeyUp);
             // 
             // label138
@@ -5501,6 +5506,7 @@ namespace Welling_Motor_Debug_Tool
             this.label_ServerStatus.Name = "label_ServerStatus";
             this.label_ServerStatus.Size = new System.Drawing.Size(15, 15);
             this.label_ServerStatus.TabIndex = 19;
+            this.label_ServerStatus.MouseHover += new System.EventHandler(this.label_ServerStatus_MouseHover);
             // 
             // label_PortStatus
             // 
@@ -6264,6 +6270,28 @@ namespace Welling_Motor_Debug_Tool
             this.pictureBox2.TabIndex = 16;
             this.pictureBox2.TabStop = false;
             // 
+            // uART协议ToolStripMenuItem
+            // 
+            this.uART协议ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.协议类型ToolStripMenuItem});
+            this.uART协议ToolStripMenuItem.Name = "uART协议ToolStripMenuItem";
+            this.uART协议ToolStripMenuItem.Size = new System.Drawing.Size(192, 26);
+            this.uART协议ToolStripMenuItem.Text = "UART协议";
+            // 
+            // 协议类型ToolStripMenuItem
+            // 
+            this.协议类型ToolStripMenuItem.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.协议类型ToolStripMenuItem.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.协议类型ToolStripMenuItem.Items.AddRange(new object[] {
+            "5S标准",
+            "锂电2号",
+            "八方",
+            "金米特5S",
+            "JLCD"});
+            this.协议类型ToolStripMenuItem.Name = "协议类型ToolStripMenuItem";
+            this.协议类型ToolStripMenuItem.Size = new System.Drawing.Size(180, 29);
+            this.协议类型ToolStripMenuItem.SelectedIndexChanged += new System.EventHandler(this.协议类型ToolStripMenuItem_SelectedIndexChanged);
+            // 
             // mainForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 21F);
@@ -6917,5 +6945,7 @@ namespace Welling_Motor_Debug_Tool
         private Label label80;
         private Label label79;
         private Label label78;
+        private ToolStripMenuItem uART协议ToolStripMenuItem;
+        private ToolStripComboBox 协议类型ToolStripMenuItem;
     }
 }

+ 444 - 242
Welling_Motor_Debug_Tool/mainForm.cs

@@ -23,7 +23,7 @@ namespace Welling_Motor_Debug_Tool
     {
         #region 变量定义
         //版本号
-        public static string Version = "2.1.6";
+        public static string Version = "2.1.7";
         //串口实例
         Serial_Process mySerialProcess = new Serial_Process();
         string PortNumSave = "";
@@ -131,6 +131,120 @@ namespace Welling_Motor_Debug_Tool
 
         #endregion
 
+        #region 屏幕缩放比例获取
+        public class PrimaryScreen
+        {
+            #region Win32 API  
+            [DllImport("user32.dll")]
+            static extern IntPtr GetDC(IntPtr ptr);
+            [DllImport("gdi32.dll")]
+            static extern int GetDeviceCaps(
+            IntPtr hdc, // handle to DC  
+            int nIndex // index of capability  
+            );
+            [DllImport("user32.dll", EntryPoint = "ReleaseDC")]
+            static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDc);
+            #endregion
+            #region DeviceCaps常量  
+            const int HORZRES = 8;
+            const int VERTRES = 10;
+            const int LOGPIXELSX = 88;
+            const int LOGPIXELSY = 90;
+            const int DESKTOPVERTRES = 117;
+            const int DESKTOPHORZRES = 118;
+            #endregion
+
+            #region 属性  
+            /// <summary>  
+            /// 获取屏幕分辨率当前物理大小  
+            /// </summary>  
+            public static Size WorkingArea
+            {
+                get
+                {
+                    IntPtr hdc = GetDC(IntPtr.Zero);
+                    Size size = new Size();
+                    size.Width = GetDeviceCaps(hdc, HORZRES);
+                    size.Height = GetDeviceCaps(hdc, VERTRES);
+                    ReleaseDC(IntPtr.Zero, hdc);
+                    return size;
+                }
+            }
+            /// <summary>  
+            /// 当前系统DPI_X 大小 一般为96  
+            /// </summary>  
+            public static int DpiX
+            {
+                get
+                {
+                    IntPtr hdc = GetDC(IntPtr.Zero);
+                    int DpiX = GetDeviceCaps(hdc, LOGPIXELSX);
+                    ReleaseDC(IntPtr.Zero, hdc);
+                    return DpiX;
+                }
+            }
+            /// <summary>  
+            /// 当前系统DPI_Y 大小 一般为96  
+            /// </summary>  
+            public static int DpiY
+            {
+                get
+                {
+                    IntPtr hdc = GetDC(IntPtr.Zero);
+                    int DpiX = GetDeviceCaps(hdc, LOGPIXELSY);
+                    ReleaseDC(IntPtr.Zero, hdc);
+                    return DpiX;
+                }
+            }
+            /// <summary>  
+            /// 获取真实设置的桌面分辨率大小  
+            /// </summary>  
+            public static Size DESKTOP
+            {
+                get
+                {
+                    IntPtr hdc = GetDC(IntPtr.Zero);
+                    Size size = new Size();
+                    size.Width = GetDeviceCaps(hdc, DESKTOPHORZRES);
+                    size.Height = GetDeviceCaps(hdc, DESKTOPVERTRES);
+                    ReleaseDC(IntPtr.Zero, hdc);
+                    return size;
+                }
+            }
+
+            /// <summary>  
+            /// 获取宽度缩放百分比  
+            /// </summary>  
+            public static float ScaleX
+            {
+                get
+                {
+                    IntPtr hdc = GetDC(IntPtr.Zero);
+                    int t = GetDeviceCaps(hdc, DESKTOPHORZRES);
+                    int d = GetDeviceCaps(hdc, HORZRES);
+                    float ScaleX = (float)GetDeviceCaps(hdc, DESKTOPHORZRES) / (float)GetDeviceCaps(hdc, HORZRES);
+                    ReleaseDC(IntPtr.Zero, hdc);
+                    return ScaleX;
+                }
+            }
+            /// <summary>  
+            /// 获取高度缩放百分比  
+            /// </summary>  
+            public static float ScaleY
+            {
+                get
+                {
+                    IntPtr hdc = GetDC(IntPtr.Zero);
+                    float ScaleY = (float)(float)GetDeviceCaps(hdc, DESKTOPVERTRES) / (float)GetDeviceCaps(hdc, VERTRES);
+                    ReleaseDC(IntPtr.Zero, hdc);
+                    return ScaleY;
+                }
+            }
+            #endregion
+        }
+
+        #endregion
+
         public mainForm()
         {
             InitializeComponent();
@@ -252,213 +366,231 @@ namespace Welling_Motor_Debug_Tool
             }
 
             //系统登录
-            EnterForm1.ShowDialog();
-            try
-            {
-                if (EnterForm1.textBox_Passwd.Text == EnterForm1.UserAccount[EnterForm1.comboBox_User.Text])//检验模式所有用户支持
+            do
+            {                
+                EnterForm1.ShowDialog();
+                try
                 {
-                    if (EnterForm1.comboBox_User.Text.Contains("量产"))
+                    if (EnterForm1.textBox_Passwd.Text == EnterForm1.UserAccount[EnterForm1.comboBox_User.Text])//检验模式所有用户支持
                     {
-                        //隐藏设置项
-                        其它配置项ToolStripMenuItem.Visible = false;
-                        写入存储ToolStripMenuItem.Visible = false;
-                        离线使用ToolStripMenuItem.Visible = false;
-                        服务器配置ToolStripMenuItem.Visible = false;
-                        判断阈值ToolStripMenuItem.Visible = false;
-                        力矩传感器检验ToolStripMenuItem.Visible = false;
-                        //显示生产信息
-                        生产信息ToolStripMenuItem.Visible = true;
-                        //显示电机类型,但不可编辑
-                        电机类型ToolStripMenuItem.Visible = true;
-                        中置电机ToolStripMenuItem.Enabled = false;
-                        轮毂电机ToolStripMenuItem.Enabled = false;
-                        //隐藏研发调试界面
-                        tabPage_MotorParam.Parent = null;
-                        tabPage_BikeParam.Parent = null;
-                        tabPage_ControlParam.Parent = null;
-                        tabPage_SensorParam.Parent = null;
-                        tabPage_AssistParam.Parent = null;
-                        tabPage_DebugParam.Parent = null;
-                        tabPage_RecordInfo.Parent = null;
-                        tabPage_OtherInfo.Parent = null;
-                        tabPage_OBC.Parent = null;
-                        tabPage_RAMorFLASH.Parent = null;
-                        tabPage_FactoryMode.Parent = null;
-                        tabPage_DebugInfo.Parent = null;
-                        //显示运行信息
-                        tabPage_RunInfo.Parent = tabControl2;
-                        //根据电机类型修改生产信息和电机类型
-                        if (EnterForm1.comboBox_User.Text.Contains("中置"))
+                        if (EnterForm1.comboBox_User.Text.Contains("量产"))
+                        {
+                            //隐藏设置项
+                            其它配置项ToolStripMenuItem.Visible = false;
+                            写入存储ToolStripMenuItem.Visible = false;
+                            离线使用ToolStripMenuItem.Visible = false;
+                            服务器配置ToolStripMenuItem.Visible = false;
+                            判断阈值ToolStripMenuItem.Visible = false;
+                            力矩传感器检验ToolStripMenuItem.Visible = false;
+                            //显示生产信息
+                            生产信息ToolStripMenuItem.Visible = true;
+                            //显示电机类型,但不可编辑
+                            电机类型ToolStripMenuItem.Visible = true;
+                            中置电机ToolStripMenuItem.Enabled = false;
+                            轮毂电机ToolStripMenuItem.Enabled = false;
+                            //隐藏研发调试界面
+                            tabPage_MotorParam.Parent = null;
+                            tabPage_BikeParam.Parent = null;
+                            tabPage_ControlParam.Parent = null;
+                            tabPage_SensorParam.Parent = null;
+                            tabPage_AssistParam.Parent = null;
+                            tabPage_DebugParam.Parent = null;
+                            tabPage_RecordInfo.Parent = null;
+                            tabPage_OtherInfo.Parent = null;
+                            tabPage_OBC.Parent = null;
+                            tabPage_RAMorFLASH.Parent = null;
+                            tabPage_FactoryMode.Parent = null;
+                            tabPage_DebugInfo.Parent = null;
+                            //显示运行信息
+                            tabPage_RunInfo.Parent = tabControl2;
+                            //根据电机类型修改生产信息和电机类型
+                            if (EnterForm1.comboBox_User.Text.Contains("中置"))
+                            {
+                                中置电机ToolStripMenuItem.Checked = true;
+                                轮毂电机ToolStripMenuItem.Checked = false;
+                                toolStripTextBox_MACPD.Text = "MM_MC1";
+                                toolStripTextBox_ServerPath.Text = "MIGIC_TEST";
+                                ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                            }
+                            else if (EnterForm1.comboBox_User.Text.Contains("轮毂"))
+                            {
+                                中置电机ToolStripMenuItem.Checked = false;
+                                轮毂电机ToolStripMenuItem.Checked = true;
+                                toolStripTextBox_MACPD.Text = "GF_250_1";
+                                toolStripTextBox_ServerPath.Text = "HUB_Control_TEST";
+                                ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                            }
+                            //显示对应生产测试界面
+                            if (EnterForm1.comboBox_User.Text.Contains("写入"))
+                            {
+                                tabPage_ProductMode_Write.Parent = tabControl1;
+                                tabPage_ProductMode_Write.Select();
+                                tabPage_ProductMode_Read.Parent = null;
+                            }
+                            else if (EnterForm1.comboBox_User.Text.Contains("检验"))
+                            {
+                                tabPage_ProductMode_Read.Parent = tabControl1;
+                                tabPage_ProductMode_Read.Select();
+                                tabPage_ProductMode_Write.Parent = null;
+                            }
+                            //应答指令不提示
+                            ACK_DisFlag = false;
+                            //退出登录
+                            break;
+                        }
+                        else if (EnterForm1.comboBox_User.Text == "工程参数配置")
                         {
-                            中置电机ToolStripMenuItem.Checked = true;
-                            轮毂电机ToolStripMenuItem.Checked = false;
-                            toolStripTextBox_MACPD.Text = "MM_MC1";
-                            toolStripTextBox_ServerPath.Text = "MIGIC_TEST";
-                            ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                            //隐藏工作台内容,新建窗口完成配置
+                            groupBox1.Visible = false;
+                            groupBox3.Visible = false;
+                            tabControl2.Visible = false;
+                            //隐藏提示信息
+                            label_StarInfo.Visible = false;
+                            //打开参数配置框
+                            //MessageBox.Show("开发中", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                            GenerateParamsForm.ShowDialog();
+                            System.Environment.Exit(0);
+                            //退出登录
+                            break;
                         }
-                        else if (EnterForm1.comboBox_User.Text.Contains("轮毂"))
+                        else if (EnterForm1.comboBox_User.Text.Contains("样机"))
                         {
-                            中置电机ToolStripMenuItem.Checked = false;
-                            轮毂电机ToolStripMenuItem.Checked = true;
-                            toolStripTextBox_MACPD.Text = "GF_250_1";
-                            toolStripTextBox_ServerPath.Text = "HUB_Control_TEST";
-                            ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                            //隐藏量产界面
+                            tabPage_ProductMode_Read.Parent = null;
+                            tabPage_ProductMode_Write.Parent = null;
+                            //隐藏配置项
+                            其它配置项ToolStripMenuItem.Visible = false;
+                            离线使用ToolStripMenuItem.Visible = false;
+                            服务器配置ToolStripMenuItem.Visible = false;
+                            判断阈值ToolStripMenuItem.Visible = false;
+                            力矩传感器检验ToolStripMenuItem.Visible = false;
+                            //显示生产信息
+                            生产信息ToolStripMenuItem.Visible = true;
+                            //显示电机类型,但不可编辑
+                            电机类型ToolStripMenuItem.Visible = true;
+                            中置电机ToolStripMenuItem.Enabled = true;
+                            轮毂电机ToolStripMenuItem.Enabled = true;
+
+                            if (EnterForm1.comboBox_User.Text.Contains("中置"))
+                            {
+                                中置电机ToolStripMenuItem.Checked = true;
+                                轮毂电机ToolStripMenuItem.Checked = false;
+                                toolStripTextBox_MACPD.Text = "MM_MC1";
+                                toolStripTextBox_ServerPath.Text = "MIGIC_TEST";
+                                ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                            }
+                            else if (EnterForm1.comboBox_User.Text.Contains("轮毂"))
+                            {
+                                中置电机ToolStripMenuItem.Checked = false;
+                                轮毂电机ToolStripMenuItem.Checked = true;
+                                toolStripTextBox_MACPD.Text = "GF_250_1";
+                                toolStripTextBox_ServerPath.Text = "HUB_Control_TEST";
+                                ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                            }
+                            //退出登录
+                            break;
                         }
-                        //显示对应生产测试界面
-                        if (EnterForm1.comboBox_User.Text.Contains("写入"))
+                        else if (EnterForm1.comboBox_User.Text == "FCT治具测试")
                         {
+                            //隐藏设置项
+                            其它配置项ToolStripMenuItem.Visible = false;
+                            写入存储ToolStripMenuItem.Visible = false;
+                            离线使用ToolStripMenuItem.Visible = false;
+                            服务器配置ToolStripMenuItem.Visible = false;
+                            判断阈值ToolStripMenuItem.Visible = false;
+                            力矩传感器检验ToolStripMenuItem.Visible = false;
+                            //显示生产信息
+                            生产信息ToolStripMenuItem.Visible = true;
+                            //显示电机类型,但不可编辑
+                            电机类型ToolStripMenuItem.Visible = true;
+                            中置电机ToolStripMenuItem.Enabled = true;
+                            轮毂电机ToolStripMenuItem.Enabled = true;
+                            //隐藏研发调试界面
+                            tabPage_MotorParam.Parent = null;
+                            tabPage_BikeParam.Parent = null;
+                            tabPage_ControlParam.Parent = null;
+                            tabPage_SensorParam.Parent = null;
+                            tabPage_AssistParam.Parent = null;
+                            tabPage_DebugParam.Parent = null;
+                            tabPage_RecordInfo.Parent = null;
+                            tabPage_OtherInfo.Parent = null;
+                            tabPage_OBC.Parent = null;
+                            tabPage_RAMorFLASH.Parent = null;
+                            tabPage_FactoryMode.Parent = null;
+                            tabPage_DebugInfo.Parent = null;
+                            //显示运行信息
+                            tabPage_RunInfo.Parent = tabControl2;
+                            //根据电机类型修改生产信息和电机类型
+                            if (EnterForm1.comboBox_User.Text.Contains("中置"))
+                            {
+                                中置电机ToolStripMenuItem.Checked = true;
+                                轮毂电机ToolStripMenuItem.Checked = false;
+                                toolStripTextBox_MACPD.Text = "MM_MC1";
+                                toolStripTextBox_ServerPath.Text = "MIGIC_TEST";
+                                ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                            }
+                            else if (EnterForm1.comboBox_User.Text.Contains("轮毂"))
+                            {
+                                中置电机ToolStripMenuItem.Checked = false;
+                                轮毂电机ToolStripMenuItem.Checked = true;
+                                toolStripTextBox_MACPD.Text = "GF_250_1";
+                                toolStripTextBox_ServerPath.Text = "HUB_Control_TEST";
+                                ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                            }
+                            //显示量产测试界面
                             tabPage_ProductMode_Write.Parent = tabControl1;
                             tabPage_ProductMode_Write.Select();
                             tabPage_ProductMode_Read.Parent = null;
+                            //允许离线使用
+                            允许ToolStripMenuItem.Checked = true;
+                            不允许ToolStripMenuItem.Checked = false;
+                            checkBox_OffLineFacMode.Checked = true;
+                            checkBox_OffLineFacMode.Enabled = true;
+                            checkBox_OffLineCheckMode.Checked = true;
+                            checkBox_OffLineCheckMode.Enabled = true;
+                            //应答指令不提示
+                            ACK_DisFlag = false;
+                            //退出登录
+                            break;
                         }
-                        else if (EnterForm1.comboBox_User.Text.Contains("检验"))
+                        else if (EnterForm1.comboBox_User.Text == "研发调试")
                         {
-                            tabPage_ProductMode_Read.Parent = tabControl1;
-                            tabPage_ProductMode_Read.Select();
+                            //隐藏量产界面
+                            tabPage_ProductMode_Read.Parent = null;
                             tabPage_ProductMode_Write.Parent = null;
+                            判断阈值ToolStripMenuItem.Visible = false;
+                            力矩传感器检验ToolStripMenuItem.Visible = false;
+                            服务器配置ToolStripMenuItem.Visible = false;
+                            //退出登录
+                            break;
                         }
-                        //应答指令不提示
-                        ACK_DisFlag = false;
-                    }
-                    else if (EnterForm1.comboBox_User.Text == "工程参数配置")
-                    {
-                        //隐藏工作台内容,新建窗口完成配置
-                        groupBox1.Visible = false;
-                        groupBox3.Visible = false;
-                        tabControl2.Visible = false;
-                        //隐藏提示信息
-                        label_StarInfo.Visible = false;
-                        //打开参数配置框
-                        //MessageBox.Show("开发中", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                        GenerateParamsForm.ShowDialog();
-                        System.Environment.Exit(0);
-                    }
-                    else if (EnterForm1.comboBox_User.Text.Contains("样机"))
-                    {
-                        //隐藏量产界面
-                        tabPage_ProductMode_Read.Parent = null;
-                        tabPage_ProductMode_Write.Parent = null;
-                        //隐藏配置项
-                        其它配置项ToolStripMenuItem.Visible = false;
-                        离线使用ToolStripMenuItem.Visible = false;
-                        服务器配置ToolStripMenuItem.Visible = false;
-                        判断阈值ToolStripMenuItem.Visible = false;
-                        力矩传感器检验ToolStripMenuItem.Visible = false;
-                        //显示生产信息
-                        生产信息ToolStripMenuItem.Visible = true;
-                        //显示电机类型,但不可编辑
-                        电机类型ToolStripMenuItem.Visible = true;
-                        中置电机ToolStripMenuItem.Enabled = true;
-                        轮毂电机ToolStripMenuItem.Enabled = true;
-
-                        if (EnterForm1.comboBox_User.Text.Contains("中置"))
-                        {
-                            中置电机ToolStripMenuItem.Checked = true;
-                            轮毂电机ToolStripMenuItem.Checked = false;
-                            toolStripTextBox_MACPD.Text = "MM_MC1";
-                            toolStripTextBox_ServerPath.Text = "MIGIC_TEST";
-                            ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
-                        }
-                        else if (EnterForm1.comboBox_User.Text.Contains("轮毂"))
-                        {
-                            中置电机ToolStripMenuItem.Checked = false;
-                            轮毂电机ToolStripMenuItem.Checked = true;
-                            toolStripTextBox_MACPD.Text = "GF_250_1";
-                            toolStripTextBox_ServerPath.Text = "HUB_Control_TEST";
-                            ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
-                        }
-                    }
-                    else if (EnterForm1.comboBox_User.Text == "FCT治具测试")
-                    {
-                        //隐藏设置项
-                        其它配置项ToolStripMenuItem.Visible = false;
-                        写入存储ToolStripMenuItem.Visible = false;
-                        离线使用ToolStripMenuItem.Visible = false;
-                        服务器配置ToolStripMenuItem.Visible = false;
-                        判断阈值ToolStripMenuItem.Visible = false;
-                        力矩传感器检验ToolStripMenuItem.Visible = false;
-                        //显示生产信息
-                        生产信息ToolStripMenuItem.Visible = true;
-                        //显示电机类型,但不可编辑
-                        电机类型ToolStripMenuItem.Visible = true;
-                        中置电机ToolStripMenuItem.Enabled = true;
-                        轮毂电机ToolStripMenuItem.Enabled = true;
-                        //隐藏研发调试界面
-                        tabPage_MotorParam.Parent = null;
-                        tabPage_BikeParam.Parent = null;
-                        tabPage_ControlParam.Parent = null;
-                        tabPage_SensorParam.Parent = null;
-                        tabPage_AssistParam.Parent = null;
-                        tabPage_DebugParam.Parent = null;
-                        tabPage_RecordInfo.Parent = null;
-                        tabPage_OtherInfo.Parent = null;
-                        tabPage_OBC.Parent = null;
-                        tabPage_RAMorFLASH.Parent = null;
-                        tabPage_FactoryMode.Parent = null;
-                        tabPage_DebugInfo.Parent = null;
-                        //显示运行信息
-                        tabPage_RunInfo.Parent = tabControl2;
-                        //根据电机类型修改生产信息和电机类型
-                        if (EnterForm1.comboBox_User.Text.Contains("中置"))
+                        else if (EnterForm1.comboBox_User.Text == "管理员")
                         {
-                            中置电机ToolStripMenuItem.Checked = true;
-                            轮毂电机ToolStripMenuItem.Checked = false;
-                            toolStripTextBox_MACPD.Text = "MM_MC1";
-                            toolStripTextBox_ServerPath.Text = "MIGIC_TEST";
-                            ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                            //不隐藏任何界面
+                            //...
+                            //退出登录
+                            break;
                         }
-                        else if (EnterForm1.comboBox_User.Text.Contains("轮毂"))
+                        else
                         {
-                            中置电机ToolStripMenuItem.Checked = false;
-                            轮毂电机ToolStripMenuItem.Checked = true;
-                            toolStripTextBox_MACPD.Text = "GF_250_1";
-                            toolStripTextBox_ServerPath.Text = "HUB_Control_TEST";
-                            ConfigFileSave(false, localInfo.LocalPath + localInfo.ConfigFileName);
+                            MessageBox.Show("权限不支持", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                            //重新登录
+                            continue;
                         }
-                        //显示量产测试界面
-                        tabPage_ProductMode_Write.Parent = tabControl1;
-                        tabPage_ProductMode_Write.Select();
-                        tabPage_ProductMode_Read.Parent = null;
-                        //允许离线使用
-                        允许ToolStripMenuItem.Checked = true;
-                        不允许ToolStripMenuItem.Checked = false;
-                        checkBox_OffLineFacMode.Checked = true;
-                        checkBox_OffLineFacMode.Enabled = true ;
-                        checkBox_OffLineCheckMode.Checked = true;
-                        checkBox_OffLineCheckMode.Enabled = true;
-                        //应答指令不提示
-                        ACK_DisFlag = false;
-                    }
-                    else if (EnterForm1.comboBox_User.Text == "研发调试")
-                    {
-                        //隐藏量产界面
-                        tabPage_ProductMode_Read.Parent = null;
-                        tabPage_ProductMode_Write.Parent = null;
-                        判断阈值ToolStripMenuItem.Visible = false;
-                        力矩传感器检验ToolStripMenuItem.Visible = false;
-                        服务器配置ToolStripMenuItem.Visible = false;
-                    }
-                    else if (EnterForm1.comboBox_User.Text == "管理员")
-                    {
-                        //不隐藏任何界面
                     }
                     else
                     {
-                        MessageBox.Show("权限不支持", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                        System.Environment.Exit(0);
+                        MessageBox.Show("密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                        //重新登录
+                        continue;
                     }
                 }
-                else
+                catch (Exception)
                 {
-                    MessageBox.Show("密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
+                    MessageBox.Show("用户不存在或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                     System.Environment.Exit(0);
                 }
-            }
-            catch (Exception)
-            {
-                MessageBox.Show("用户不存在或密码错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
-                System.Environment.Exit(0);
-            }
+            } while (true);            
 
             //端口自动连接           
             if ((PortNumSave != string.Empty) && (PortBaudrateSave != string.Empty)) //有数值时采用上次使用的值
@@ -489,43 +621,56 @@ namespace Welling_Motor_Debug_Tool
         /// </summary>        
         private void NetworkCheck()
         {
-            //初始化第一次连接FTP服务器
-            bool Result = myFtp.CheckFtp();
-            if (Result == true)//服务器连接成功
+            //允许离线使用,直接退出
+            if (允许ToolStripMenuItem.Checked == true) //允许离线使用
             {
-                myFtp.IsNetConnected = true;
+                timer_1s.Enabled = false;
+                MessageBox.Show("离线使用,不检测网络状态!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                timer_1s.Enabled = true;
+                return;
             }
-            else//服务器连接失败
+            //不允许离线使用,实时监测网络状态
+            else
             {
-                myFtp.IsNetConnected = false;
-                if (允许ToolStripMenuItem.Checked == false) ///不允许离线使用,自动关闭 
+                //初始化第一次连接FTP服务器
+                bool Result = myFtp.CheckFtp();
+                if (Result == true)//服务器连接成功
                 {
+                    myFtp.IsNetConnected = true;
+                }
+                else//服务器连接失败
+                {
+                    myFtp.IsNetConnected = false;
                     if ((EnterForm1.comboBox_User.Text != "管理员") && (EnterForm1.comboBox_User.Text != "FCT治具测试"))
                     {
                         timer_1s.Enabled = false;
                         MessageBox.Show("网络断开,将自动关闭!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                         timer_1s.Enabled = true;
                         this.Close();
-                    }                      
+                    }                    
                 }
-                else //离线使用
+
+                //创建定时器,定时30s检查网络
+                System.Timers.Timer timer_CheckNet = new System.Timers.Timer();
+                timer_CheckNet.Enabled = true;
+                timer_CheckNet.Interval = 10000;
+                timer_CheckNet.Elapsed += new System.Timers.ElapsedEventHandler(this.timer_CheckNet_Tick);
+                timer_CheckNet.Start();
+                while (true)
                 {
-                    timer_1s.Enabled = false;
-                    MessageBox.Show("网络断开,离线使用!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
-                    timer_1s.Enabled = true;
+                    Thread.Sleep(1);
+                    if (myFtp.IsNetConnected == false)
+                    {
+                        label_Server_ComStatus.Text = "网络已断开";
+                        label_ServerStatus.BackColor = Color.Red;
+                    }
+                    else
+                    {
+                        label_Server_ComStatus.Text = "网络已连接";
+                        label_ServerStatus.BackColor = Color.Green;
+                    }
                 }
-            }
-
-            //创建定时器,定时30s检查网络
-            System.Timers.Timer timer_CheckNet = new System.Timers.Timer();
-            timer_CheckNet.Enabled = true;
-            timer_CheckNet.Interval = 30000;
-            timer_CheckNet.Elapsed += new System.Timers.ElapsedEventHandler(this.timer_CheckNet_Tick);
-            timer_CheckNet.Start();
-            while (true)
-            {
-                Thread.Sleep(1);
-            }
+            }          
         }
 
         /// <summary>
@@ -540,25 +685,24 @@ namespace Welling_Motor_Debug_Tool
             if (Result == true)//服务器连接成功
             {
                 myFtp.IsNetConnected = true;
+                //允许使用
+                groupBox1.Enabled = true;
+                groupBox3.Enabled = true;
+                tabControl2.Enabled = true;
             }
             else//服务器连接失败
             {
                 myFtp.IsNetConnected = false;
-                if (允许ToolStripMenuItem.Checked == false) ///不允许离线使用,自动关闭 
-                {
-                    if ((EnterForm1.comboBox_User.Text != "管理员") && (EnterForm1.comboBox_User.Text != "FCT治具测试"))
-                    {
-                        timer_1s.Enabled = false;
-                        MessageBox.Show("网络断开,将自动关闭!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
-                        timer_1s.Enabled = true;
-                        System.Environment.Exit(0);
-                    }
-                }
-                else //离线使用
+                if ((EnterForm1.comboBox_User.Text != "管理员") && (EnterForm1.comboBox_User.Text != "FCT治具测试"))
                 {
                     timer_1s.Enabled = false;
-                    MessageBox.Show("网络断开,离线使用!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
+                    MessageBox.Show("网络断开, 请检查网络!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     timer_1s.Enabled = true;
+                    //禁止使用
+                    groupBox1.Enabled = false;
+                    groupBox3.Enabled = false;
+                    tabControl2.Enabled = false;
+                    
                 }
             }            
         }
@@ -2141,22 +2285,6 @@ namespace Welling_Motor_Debug_Tool
             //写入参数等待计时
             ACK_WaitCnt++;
 
-            //更新网络状态
-            if (myFtp.IsNetConnected == true)
-            {
-                label_Server_ComStatus.Text = "网络已连接";
-                label_ServerStatus.BackColor = Color.Green;
-                label_Server_ComStatus.Text= "网络已连接";
-                label_ServerStatus.BackColor = Color.Green;
-            }
-            else
-            {
-                label_Server_ComStatus.Text = "网络已断开";
-                label_ServerStatus.BackColor = Color.Red;
-                label_Server_ComStatus.Text = "网络已断开";
-                label_ServerStatus.BackColor = Color.Red;
-            }
-
         }
 
         /// <summary>
@@ -4228,9 +4356,13 @@ namespace Welling_Motor_Debug_Tool
 
                 //保存页面
                 string PIC_SaveFileName = "";
-                Bitmap bit = new Bitmap(this.Width, this.Height);//实例化一个和窗体一样大的bitmap
+                Double scaleX = PrimaryScreen.ScaleX;
+                Double scaleY = PrimaryScreen.ScaleY;
+
+                //保存页面
+                Bitmap bit = new Bitmap((int)(this.Width * scaleX), (int)(this.Height * scaleY));//实例化一个和窗体一样大的bitmap
                 Graphics g = Graphics.FromImage(bit);
-                g.CopyFromScreen(this.Left, this.Top, 0, 0, new Size(this.Width, this.Height));//保存整个窗体为图片
+                g.CopyFromScreen((int)(this.Left * scaleX), (int)(this.Top * scaleY), 0, 0, new Size((int)(this.Width * scaleX), (int)(this.Height * scaleY)));//保存整个窗体为图片
                 PIC_SaveFileName = Save_Path + "\\" + textBox_FacModeName.Text + "_" + textBox_FacModeNum.Text + "_测试页面" + ".png";
                 bit.Save(PIC_SaveFileName);
 
@@ -4370,10 +4502,13 @@ namespace Welling_Motor_Debug_Tool
         /// <param name="e"></param>
         private void 页面保存ToolStripMenuItem_Click(object sender, EventArgs e)
         {
+            Double scaleX = PrimaryScreen.ScaleX;
+            Double scaleY = PrimaryScreen.ScaleY;
+
             //保存页面
-            Bitmap bit = new Bitmap(this.Width, this.Height);//实例化一个和窗体一样大的bitmap
+            Bitmap bit = new Bitmap((int)(this.Width * scaleX), (int)(this.Height * scaleY));//实例化一个和窗体一样大的bitmap
             Graphics g = Graphics.FromImage(bit);
-            g.CopyFromScreen(this.Left, this.Top, 0, 0, new Size(this.Width, this.Height));//保存整个窗体为图片       
+            g.CopyFromScreen((int)(this.Left * scaleX), (int)(this.Top * scaleY), 0, 0, new Size((int)(this.Width * scaleX), (int)(this.Height * scaleY)));//保存整个窗体为图片       
             SaveFileDialog sf = new SaveFileDialog();
             sf.Title = "页面保存";
             sf.FileName = "MotorInfo_" + textBox_FacModeName.Text + "_" + textBox_FacModeNum.Text + "_" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace("/", "-").Replace(":", string.Empty).Replace(" ", "_") + ".png";
@@ -5341,9 +5476,11 @@ namespace Welling_Motor_Debug_Tool
                 Directory.CreateDirectory(LogSavePath);
             }
             //测试页面
-            Bitmap bit = new Bitmap(this.Width, this.Height);//实例化一个和窗体一样大的bitmap
+            Double scaleX = PrimaryScreen.ScaleX;
+            Double scaleY = PrimaryScreen.ScaleY;
+            Bitmap bit = new Bitmap((int)(this.Width * scaleX), (int)(this.Height * scaleY));//实例化一个和窗体一样大的bitmap
             Graphics g = Graphics.FromImage(bit);
-            g.CopyFromScreen(this.Left, this.Top, 0, 0, new Size(this.Width, this.Height));//保存整个窗体为图片  
+            g.CopyFromScreen((int)(this.Left * scaleX), (int)(this.Top * scaleY), 0, 0, new Size((int)(this.Width * scaleX), (int)(this.Height * scaleY)));//保存整个窗体为图片           
             LogSaveFileName = LogSavePath + "\\" + ProductInfo + "_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + "_测试页面" + ".png";
             bit.Save(LogSaveFileName);
             //上传测试页面到服务器
@@ -5395,6 +5532,8 @@ namespace Welling_Motor_Debug_Tool
                 richTextBox_FacModeLog.Text += DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "服务器断开" + "\r\n";
             }
 
+            //扫码框清空
+            textBox_FacModeScan.Text = "";
         }
 
         /// <summary>
@@ -6676,9 +6815,11 @@ namespace Welling_Motor_Debug_Tool
                 Directory.CreateDirectory(LogSavePath);
             }
             //测试页面
-            Bitmap bit = new Bitmap(this.Width, this.Height);//实例化一个和窗体一样大的bitmap
+            Double scaleX = PrimaryScreen.ScaleX;
+            Double scaleY = PrimaryScreen.ScaleY;
+            Bitmap bit = new Bitmap((int)(this.Width * scaleX), (int)(this.Height * scaleY));//实例化一个和窗体一样大的bitmap
             Graphics g = Graphics.FromImage(bit);
-            g.CopyFromScreen(this.Left, this.Top, 0, 0, new Size(this.Width, this.Height));//保存整个窗体为图片  
+            g.CopyFromScreen((int)(this.Left * scaleX), (int)(this.Top * scaleY), 0, 0, new Size((int)(this.Width * scaleX), (int)(this.Height * scaleY)));//保存整个窗体为图片
             LogSaveFileName = LogSavePath + "\\" + ProductInfo + "_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + "_测试页面" + ".png";
             bit.Save(LogSaveFileName);
             //上传测试页面到服务器
@@ -6722,6 +6863,8 @@ namespace Welling_Motor_Debug_Tool
                     richTextBox_CheckModeLog.Text += DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "->" + "测试记录上传服务器成功" + "\r\n";
             }
 
+            //扫码框清空
+            textBox_CheckModeScan.Text = "";
         }
 
         /// <summary>
@@ -7599,5 +7742,64 @@ namespace Welling_Motor_Debug_Tool
                 MessageBox.Show("数据填写不完整!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
+
+        /// <summary>
+        /// 测试模式点击文本框自动全选
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void textBox_FacModeScan_MouseClick(object sender, MouseEventArgs e)
+        {
+            textBox_FacModeScan.SelectAll();
+        }
+
+        /// <summary>
+        /// 检验模式点击文本框自动全选
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void textBox_CheckModeScan_MouseClick(object sender, MouseEventArgs e)
+        {
+            textBox_CheckModeScan.SelectAll();
+        }
+
+        /// <summary>
+        /// 鼠标放置显示连接服务器信息
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void label_ServerStatus_MouseHover(object sender, EventArgs e)
+        {
+            // 创建the ToolTip 
+            ToolTip toolTip1 = new ToolTip();
+
+            // 设置显示样式
+            toolTip1.AutoPopDelay = 30000;//提示信息的可见时间
+            toolTip1.InitialDelay = 50;//事件触发多久后出现提示
+            toolTip1.ReshowDelay = 50;//指针从一个控件移向另一个控件时,经过多久才会显示下一个提示框
+            toolTip1.ShowAlways = true;//是否显示提示框            
+           
+            if (myFtp.IsNetConnected)
+            {
+                toolTip1.SetToolTip(this.label_ServerStatus, "IP: " + toolStripTextBox_ServerIP.Text);//设置故障内容显示
+            }
+            else
+            {
+                toolTip1.SetToolTip(this.label_ServerStatus, "网络断开");//设置故障内容显示
+            }
+        }
+
+        /// <summary>
+        /// UART协议类型修改
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void 协议类型ToolStripMenuItem_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            var Code = new byte[2];
+            Code[0] = (byte)协议类型ToolStripMenuItem.SelectedIndex;
+            Code[1] = 0x00;
+            mySerialProcess.SendCmd((ushort)0x7FF, (byte)0x16, (ushort)0x7702, Code);
+        }
     }
 }

+ 1 - 1
Welling_Motor_Debug_Tool/mainForm.resx

@@ -127,7 +127,7 @@
     <value>275, 17</value>
   </metadata>
   <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>57</value>
+    <value>49</value>
   </metadata>
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

BIN=BIN
Welling_Motor_Debug_Tool/obj/Debug/DesignTimeResolveAssemblyReferences.cache


BIN=BIN
Welling_Motor_Debug_Tool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


+ 1 - 1
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
-fab47e48233bb4900cc596418576f8daac14a179
+8a674c7d77b6f0034a665ef7b4d1a4159c31d964766e277831f268fc135f7ba3

+ 0 - 1
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.FileListAbsolute.txt

@@ -72,7 +72,6 @@ D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.exe
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\bin\Debug\Welling_Motor_Debug_Tool.pdb
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.AssemblyReference.cache
-D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.csproj.SuggestedBindingRedirects.cache
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.GenerateParams.resources
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.Login.resources
 D:\笔记本20221223\zhouxiong9\Documents\Tools\motor-debug\Welling_Motor_Debug_Tool\obj\Debug\Welling_Motor_Debug_Tool.mainForm.resources

BIN=BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.GenerateResource.cache


+ 0 - 0
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.csproj.SuggestedBindingRedirects.cache


BIN=BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.exe


BIN=BIN
Welling_Motor_Debug_Tool/obj/Debug/Welling_Motor_Debug_Tool.pdb