diff --git a/Bin/SunnyUI.dll b/Bin/SunnyUI.dll index f9de4f4f..b474690f 100644 Binary files a/Bin/SunnyUI.dll and b/Bin/SunnyUI.dll differ diff --git a/Bin/SunnyUI.pdb b/Bin/SunnyUI.pdb index 5afe6dfd..9a80610e 100644 Binary files a/Bin/SunnyUI.pdb and b/Bin/SunnyUI.pdb differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe index 86dda6e0..7106839e 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.Demo.exe and b/SunnyUI.Demo/Bin/SunnyUI.Demo.exe differ diff --git a/SunnyUI.Demo/Bin/SunnyUI.dll b/SunnyUI.Demo/Bin/SunnyUI.dll index f9de4f4f..b474690f 100644 Binary files a/SunnyUI.Demo/Bin/SunnyUI.dll and b/SunnyUI.Demo/Bin/SunnyUI.dll differ diff --git a/SunnyUI.Demo/FMain.cs b/SunnyUI.Demo/FMain.cs index b59388d7..248d2699 100644 --- a/SunnyUI.Demo/FMain.cs +++ b/SunnyUI.Demo/FMain.cs @@ -11,7 +11,7 @@ namespace Sunny.UI.Demo int pageIndex = 1000; Header.SetNodePageIndex(Header.Nodes[0], pageIndex); - Header.SetNodeSymbol(Header.Nodes[0], 61451, 24); + Header.SetNodeSymbol(Header.Nodes[0], 61451); TreeNode parent = Aside.CreateNode("Controls", 61451, 24, pageIndex); Aside.CreateChildNode(parent, 61640, 24, AddPage(new FButton(), ++pageIndex)); Aside.CreateChildNode(parent, 61490, 24, AddPage(new FLabel(), ++pageIndex)); @@ -33,7 +33,7 @@ namespace Sunny.UI.Demo pageIndex = 2000; Header.SetNodePageIndex(Header.Nodes[1], pageIndex); - Header.SetNodeSymbol(Header.Nodes[1], 61818, 24); + Header.SetNodeSymbol(Header.Nodes[1], 61818); parent = Aside.CreateNode("Forms", 61818, 24, pageIndex); Aside.CreateChildNode(parent, 62160, 24, AddPage(new FDialogs(), ++pageIndex)); Aside.CreateChildNode(parent, 61508, 24, AddPage(new FEditor(), ++pageIndex)); diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index e26298ab..5de45961 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -58,7 +58,6 @@ namespace Sunny.UI FormBorderStyle = FormBorderStyle.None; StartPosition = FormStartPosition.CenterScreen; Version = UIGlobal.Version; - AddMousePressMove(this); } public void ShowStatus(string title, string desc, int max = 100, int value = 0) @@ -431,37 +430,85 @@ namespace Sunny.UI } private Point MousePos; + private bool FormMoveMouseDown; + private Point FormLocation; //form的location + private Point mouseOffset; //鼠标的按下位置 + + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + if (InControlBox || InMaxBox || InMinBox) return; + if (!ShowTitle) return; + if (e.Y > Padding.Top) return; + if (windowState == FormWindowState.Maximized) return; + + if (e.Button == MouseButtons.Left) + { + FormMoveMouseDown = true; + FormLocation = Location; + mouseOffset = MousePosition; + } + } + + protected override void OnMouseDoubleClick(MouseEventArgs e) + { + base.OnMouseDoubleClick(e); + + if (!MaximizeBox) return; + if (InControlBox || InMaxBox || InMinBox) return; + if (!ShowTitle) return; + if (e.Y > Padding.Top) return; + + ShowMaximize(); + } + + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); + FormMoveMouseDown = false; + } protected override void OnMouseMove(MouseEventArgs e) { MousePos = PointToScreen(e.Location); - if (FormBorderStyle == FormBorderStyle.None) + if (FormMoveMouseDown) { - bool inControlBox = e.Location.InRect(ControlBoxRect); - if (inControlBox != InControlBox) - { - InControlBox = inControlBox; - Invalidate(); - } - - bool inMaxBox = e.Location.InRect(MaximizeBoxRect); - if (inMaxBox != InMaxBox) - { - InMaxBox = inMaxBox; - Invalidate(); - } - - bool inMinBox = e.Location.InRect(MinimizeBoxRect); - if (inMinBox != InMinBox) - { - InMinBox = inMinBox; - Invalidate(); - } + Point pt = MousePosition; + int offsetX = mouseOffset.X - pt.X; + int offsetY = mouseOffset.Y - pt.Y; + Location = new Point(FormLocation.X - offsetX, FormLocation.Y - offsetY); } else { - InControlBox = InMaxBox = InMinBox = false; + if (FormBorderStyle == FormBorderStyle.None) + { + bool inControlBox = e.Location.InRect(ControlBoxRect); + if (inControlBox != InControlBox) + { + InControlBox = inControlBox; + Invalidate(); + } + + bool inMaxBox = e.Location.InRect(MaximizeBoxRect); + if (inMaxBox != InMaxBox) + { + InMaxBox = inMaxBox; + Invalidate(); + } + + bool inMinBox = e.Location.InRect(MinimizeBoxRect); + if (inMinBox != InMinBox) + { + InMinBox = inMinBox; + Invalidate(); + } + } + else + { + InControlBox = InMaxBox = InMinBox = false; + } } } diff --git a/Updates.txt b/Updates.txt index 2790f675..c4951059 100644 --- a/Updates.txt +++ b/Updates.txt @@ -1,17 +1,23 @@ + ӣ - ɾ * ޸ +2020.05.28 +* UIForm˵ƶķԼ˫/ + 2020.05.27 -* UIListBoxϢBug -* ҳMain̳йϵΪPrivate̳кʱɾDesign.csMain -+ UINavMenuͼʾ -* UIFormֶ֧ +* UIListBoxϢBug +* UIMainFrameҳMain̳йϵΪPrivate̳кʱɾDesign.csMain ++ UINavMenuͼʾ +* UIFormֶ֧ ++ UITextboxkeypress keydown keyup¼ +* UIDatePickerͼ ++ MessageTipDemo 2020.05.26 * ҳMainŴ 2020.05.25 -+ UITextBoxWatermarkˮӡ -+ ULocalize.csӶ ++ UITextBoxWatermarkˮӡ ++ ULocalize.csӶ 2020.05.23 V2.2.5 * ޸ͼһBug