日期:2014-05-17  浏览次数:20906 次

帖中贴(帮人)
http://topic.csdn.net/u/20120829/21/bae10b29-2777-4e34-b55a-5c0a9c8322b2.html
问题见于6楼
见谅 我分分散完了

------解决方案--------------------
加上边框,在主窗体的构造函数中加
C# code

Win32单元
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int SetWindowLong(IntPtr hWnd, int Index, int Value);
        public const int WS_SYSMENU = 0x80000;
        public const int WS_SIZEBOX = 0x40000;

        public const int WS_MAXIMIZEBOX = 0x10000;

        public const int WS_MINIMIZEBOX = 0x20000;

        public const int SM_CXFRAME = 0x20;
        public const int WS_THICKFRAME = 0x40000;


        private void SetFormStyle(Form form)
        {
            int i = Win32.GetSystemMetrics(Win32.SM_CXFRAME);            
            this.FormBorderStyle = FormBorderStyle.None;
            int windowLong = (Win32.GetWindowLong(form.Handle, -16));
            OperatingSystem osinfo = Environment.OSVersion;
            if (osinfo.Platform == PlatformID.Win32NT)
            {
                if (osinfo.Version.Major == 6)
                {
                    this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width + i, Screen.PrimaryScreen.WorkingArea.Height);
                    Win32.SetWindowLong(form.Handle, -16, windowLong | Win32.WS_MAXIMIZEBOX | Win32.WS_MINIMIZEBOX);
                }
                else
                {
                    this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width + i, Screen.PrimaryScreen.WorkingArea.Height + i);
                    Win32.SetWindowLong(form.Handle, -16, windowLong | Win32.WS_SYSMENU | Win32.WS_THICKFRAME | Win32.WS_MAXIMIZEBOX | Win32.WS_MINIMIZEBOX);
                }
            }            
        }