diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index 7237ce1a..9c652a34 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index d90ae631..2fd0c499 100644 Binary files a/Bin/SunnyUI.pdb and b/Bin/SunnyUI.pdb differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll index 7237ce1a..9c652a34 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI/Controls/UIDataGridView.cs b/SunnyUI/Controls/UIDataGridView.cs index 6f873ccd..1906c1b7 100644 --- a/SunnyUI/Controls/UIDataGridView.cs +++ b/SunnyUI/Controls/UIDataGridView.cs @@ -447,5 +447,11 @@ namespace Sunny.UI column.Width = width; return column; } + + public static DataGridViewColumn SetSortMode(this DataGridViewColumn column, DataGridViewColumnSortMode sortMode = DataGridViewColumnSortMode.Automatic) + { + column.SortMode = sortMode; + return column; + } } } \ No newline at end of file diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index 1ef42074..e26298ab 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -388,14 +388,25 @@ namespace Sunny.UI private void ShowMaximize() { + int screenIndex = 0; + for (int i = 0; i < Screen.AllScreens.Length; i++) + { + if (MousePos.InRect(Screen.AllScreens[i].Bounds)) + { + screenIndex = i; + break; + } + } + + Screen screen = Screen.AllScreens[screenIndex]; if (windowState == FormWindowState.Normal) { size = Size; - Width = ShowFullScreen ? Screen.PrimaryScreen.Bounds.Width : Screen.PrimaryScreen.WorkingArea.Width; - Height = ShowFullScreen ? Screen.PrimaryScreen.Bounds.Height : Screen.PrimaryScreen.WorkingArea.Height; - Left = 0; - Top = 0; + Width = ShowFullScreen ? screen.Bounds.Width : screen.WorkingArea.Width; + Height = ShowFullScreen ? screen.Bounds.Height : screen.WorkingArea.Height; + Left = screen.Bounds.Left; + Top = screen.Bounds.Top; StartPosition = FormStartPosition.Manual; SetFormRoundRectRegion(this, 0); @@ -409,8 +420,8 @@ namespace Sunny.UI } Size = size; - Left = Screen.PrimaryScreen.WorkingArea.Width / 2 - Size.Width / 2; - Top = Screen.PrimaryScreen.WorkingArea.Height / 2 - Size.Height / 2; + Left = screen.Bounds.Left + screen.WorkingArea.Width / 2 - Size.Width / 2; + Top = screen.Bounds.Top + screen.WorkingArea.Height / 2 - Size.Height / 2; StartPosition = FormStartPosition.CenterScreen; SetFormRoundRectRegion(this, ShowRadius ? 5 : 0); windowState = FormWindowState.Normal; @@ -419,8 +430,12 @@ namespace Sunny.UI Invalidate(); } + private Point MousePos; + protected override void OnMouseMove(MouseEventArgs e) { + MousePos = PointToScreen(e.Location); + if (FormBorderStyle == FormBorderStyle.None) { bool inControlBox = e.Location.InRect(ControlBoxRect); diff --git a/Updates.txt b/Updates.txt index c49eed0d..2790f675 100644 --- a/Updates.txt +++ b/Updates.txt @@ -4,6 +4,7 @@ * 更新UIListBox消息处理Bug * 更新页面框架Main命名,继承关系为Private。继承后编译时删除Design.cs里面Main部分 + UINavMenu增加字体图标显示 +* UIForm最大化支持多屏 2020.05.26 * 更新页面框架Main叠放次序