Pārlūkot izejas kodu

解决分辨率显示问题

章政 8 gadi atpakaļ
vecāks
revīzija
ae988e2b55

+ 4 - 0
UAS-MES/Entity/SystemInf.cs

@@ -40,5 +40,9 @@ namespace UAS_MES.Entity
         /// 检测音频是否可用
         /// </summary>
         public static bool CheckAudioEnable=true;
+        /// <summary>
+        /// 导航宽度
+        /// </summary>
+        public static int NavWidth = 0;
     }
 }

+ 29 - 1
UAS-MES/Main.cs

@@ -45,7 +45,7 @@ namespace UAS_MES
             DoubleBuffered = true;
             SetStyle(ControlStyles.UserPaint, true);
             SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
-            SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲         
+            SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲
         }
 
         /// <summary>
@@ -103,6 +103,8 @@ namespace UAS_MES
             Width = ScreenArea.Width;
             Height = ScreenArea.Height;
             SetForm();
+            //设置导航栏宽度
+            SystemInf.NavWidth = Menu.Width;
         }
 
         private void RefreshDB(object sender, EventArgs e)
@@ -234,5 +236,31 @@ namespace UAS_MES
             }
             catch (Exception) { }
         }
+
+        private void LoginOut_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
+        {
+            string logout_confirm = MessageBox.Show(this.ParentForm, "退出登录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+            if (logout_confirm == "Yes")
+            {
+                //注销的时候切换回默认数据库
+                SystemInf.ConnectionString = Properties.Settings.Default.Properties["MES"].DefaultValue.ToString();
+                DataHelper.DBConnectionString = SystemInf.ConnectionString;
+                //清除上个用户的权限信息
+                SystemInf.Caller.Clear();
+                //清除已经打开过的窗口的信息
+                AccordionMenu.OpenedFormName.Clear();
+                //注销的时候将除了登陆窗口之外的全部窗口关闭
+                for (int i = 0; i < Application.OpenForms.Count; i++)
+                {
+                    if (Application.OpenForms[i].Name != "Login")
+                        Application.OpenForms[i].Close();
+                }
+                this.Hide();
+                Login login = new Login();
+                login.ShowDialog();
+                RefreshDBConnect.Stop();
+                this.Close();
+            }
+        }
     }
 }

+ 3 - 0
UAS-MES/PublicMethod/AutoSizeFormClass.cs

@@ -2,6 +2,7 @@
 using System.Windows.Forms;
 using UAS_MES.CustomControl.ButtonUtil;
 using UAS_MES.CustomControl.Pagination;
+using UAS_MES.Entity;
 
 namespace UAS_MES.PublicMethod
 {
@@ -25,6 +26,8 @@ namespace UAS_MES.PublicMethod
         public void controllInitializeSize(Control mForm)
         {
             controlRect cR;
+            mForm.Width = Screen.PrimaryScreen.WorkingArea.Width - SystemInf.NavWidth;
+            mForm.Height = Screen.PrimaryScreen.WorkingArea.Height - 100;
             cR.Left = mForm.Left; cR.Top = mForm.Top; cR.Width = mForm.Width; cR.Height = mForm.Height;
             oldCtrl.Add(cR);//第一个为"窗体本身",只加入一次即可
             AddControl(mForm);//窗体内其余控件还可能嵌套控件(比如panel),要单独抽出,因为要递归调用