UIForm:更新了点击标题栏移动的方法,以及双击最大化/正常

This commit is contained in:
sunny 2020-05-28 13:46:45 +08:00
parent 431e863caa
commit d329c33d29
7 changed files with 84 additions and 31 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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));

View File

@ -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;
}
}
}

View File

@ -1,17 +1,23 @@
+ 增加; - 删除; * 修改
2020.05.28
* UIForm更新了点击标题栏移动的方法以及双击最大化/正常
2020.05.27
* 更新UIListBox消息处理Bug
* 更新页面框架Main命名继承关系为Private。继承后编译时删除Design.cs里面Main部分
+ UINavMenu增加字体图标显示
* UIForm最大化支持多屏
* UIListBox更新消息处理Bug
* UIMainFrame更新页面框架Main命名继承关系为Private。继承后编译时删除Design.cs里面Main部分
+ UINavMenu增加字体图标显示
* UIForm最大化支持多屏
+ UITextbox增加keypress keydown keyup事件
* UIDatePicker更改图标
+ MessageTip增加Demo
2020.05.26
* 更新页面框架Main叠放次序
2020.05.25
+ UITextBox增加Watermark水印属性
+ ULocalize.cs增加多语帮助类
+ UITextBox增加Watermark水印属性
+ ULocalize.cs增加多语帮助类
2020.05.23 V2.2.5
* 修复字体图标一处Bug