### 2021-12-14更新

------
#### TimeClock    V1.0.2112.1401
- *.[改进]针对多显示器进行便笺靠边隐藏功能的改进。
This commit is contained in:
鑫Intel 2021-12-14 16:20:03 +08:00
parent c60446a281
commit 6c1b3349ca
11 changed files with 94 additions and 23 deletions

Binary file not shown.

View File

@ -1,2 +1,2 @@
[TimeClock]
hwnd=4594100
hwnd=2563002

View File

@ -1,3 +1,3 @@
<root>
<list id="LastUpdateTime" Value="2021/10/18 14:39:31" />
<list id="LastUpdateTime" Value="2021/12/14 16:17:11" />
</root>

View File

@ -1,4 +1,9 @@
### 2021-10-18更新
### 2021-12-14更新
------
#### TimeClock V1.0.2112.1401
- *.[改进]针对多显示器进行便笺靠边隐藏功能的改进。
### 2021-10-18更新
------
#### TimeClock V1.0.2110.1801
- *.[新增]便笺窗体圆角显示。

View File

@ -0,0 +1,16 @@
{
"Version": 1,
"ProjectMap": {
"e546af59-27bb-4699-aa99-a6d7e738cc9d": {
"ProjectGuid": "e546af59-27bb-4699-aa99-a6d7e738cc9d",
"DisplayName": "MyTimeClock",
"ColorIndex": 0
},
"62b5c3e8-4af1-4a7f-a40b-a6186f83dbd2": {
"ProjectGuid": "62b5c3e8-4af1-4a7f-a40b-a6186f83dbd2",
"DisplayName": "TimeClock",
"ColorIndex": 1
}
},
"NextColorIndex": 2
}

View File

@ -493,8 +493,15 @@ namespace TimeClock.DbOp
mStor.SetAttrValue("StickyBackColor", ColorTranslator.ToHtml(StickyBackColor));
mStor.SetAttrValue("Left", this.Left);
mStor.SetAttrValue("Top", this.Top);
mStor.SetAttrValue("Width", this.Width);
mStor.SetAttrValue("Height", this. Height);
if (!IsMini)
{
mStor.SetAttrValue("Width", this.Width);
mStor.SetAttrValue("Height", this.Height);
}
else
{
}
mStor.SetAttrValue("TopMost", this.TopMost);
mStor.SetAttrValue("Opacity", this.Opacity);
mStor.SetAttrValue("PullOverHide", this.ToolStripMenuItem.Checked);
@ -554,6 +561,8 @@ namespace TimeClock.DbOp
mStor.SelectNodeBySet();
this.Location = new Point(mStor.GetAttrValue("Left", 0), mStor.GetAttrValue("Top", 0));
this.Size = new Size(mStor.GetAttrValue("Width", 0), mStor.GetAttrValue("Height", 0));
if (this.Height < 50) { this.Height = 300; }
if (this.Width < 50) { this.Width = 200; }
if (this.Top < 0) { this.Top = 0; }
if (this.Left < 0) { this.Left = 0; }
var screen = Screen.GetWorkingArea(this);
@ -608,6 +617,14 @@ namespace TimeClock.DbOp
dt_change = DateTime.Now;
isChange = true;
}
private int NormalWidth = 0;
private int NormalHeight = 0;
private bool IsMini = false;
private void SaveSize()
{
NormalWidth = this.Width;
NormalHeight = this.Height;
}
[DllImport("User32.dll")]
private static extern bool PtInRect(ref Rectangle Rects, Point lpPoint);
private void Timer1_Tick(object sender, EventArgs e)
@ -653,24 +670,54 @@ namespace TimeClock.DbOp
System.Drawing.Point cursorPoint = new Point(Cursor.Position.X, Cursor.Position.Y);//获取鼠标在屏幕的坐标点
Rectangle Rects = new Rectangle(this.Left, this.Top, this.Left + this.Width, this.Top + this.Height);//存储当前窗体在屏幕的所在区域
bool prInRect = PtInRect(ref Rects, cursorPoint);
var cur_screen = Screen.FromControl(this);
if (prInRect)
{//当鼠标在当前窗体内
if (this.Top < 0)//窗体的Top属性小于0
this.Top = 0;
else if (this.Left < 0)//窗体的Left属性小于0
this.Left = 0;
else if (this.Right > Screen.PrimaryScreen.WorkingArea.Width)//窗体的Right属性大于屏幕宽度
this.Left = Screen.PrimaryScreen.WorkingArea.Width - this.Width;
if (IsMini)
{
IsMini = false;
this.Size = new Size(NormalWidth, NormalHeight);
if (this.Top <= 0)//窗体的Top属性小于0
{
this.Top = 0;
}
else if (this.Left <= 0)//窗体的Left属性小于0
{
this.Left = 0;
}
else if (this.Right > cur_screen.WorkingArea.Width)//窗体的Right属性大于屏幕宽度
{
this.Left = cur_screen.WorkingArea.Width - this.Width;
}
}
}
else
{
int space = 8;
if (this.Top < 5) //当窗体的上边框与屏幕的顶端的距离小于5时
this.Top = 7 - this.Height + space; //将窗体隐藏到屏幕的顶端
else if (this.Left < 5) //当窗体的左边框与屏幕的左端的距离小于5时
this.Left = 5 - this.Width + space; //将窗体隐藏到屏幕的左端
else if (this.Right > Screen.PrimaryScreen.WorkingArea.Width - 5)//当窗体的右边框与屏幕的右端的距离小于5时
this.Left = Screen.PrimaryScreen.WorkingArea.Width - 5 - space;//将窗体隐藏到屏幕的右端
//int space = 8;
if (!IsMini)
{
if (this.Top < cur_screen.WorkingArea.Top+ 5) //当窗体的上边框与屏幕的顶端的距离小于5时
{
SaveSize(); SaveSticky(); IsMini = true;
this.Height = 8;
this.Top = 0;
//this.Top = 7 - this.Height + space; //将窗体隐藏到屏幕的顶端
}
else if (this.Left < cur_screen.WorkingArea.Left+ 5) //当窗体的左边框与屏幕的左端的距离小于5时
{
// this.Left = 5 - this.Width + space; //将窗体隐藏到屏幕的左端
SaveSize(); SaveSticky(); IsMini = true;
this.Width = 8;
this.Left = 0;
}
else if (this.Right > cur_screen.WorkingArea.Right - 5)//当窗体的右边框与屏幕的右端的距离小于5时
{
//this.Left = cur_screen.WorkingArea.Width - 5 - space;//将窗体隐藏到屏幕的右端
SaveSize(); SaveSticky(); IsMini = true;
this.Width = 8;
this.Left = cur_screen.WorkingArea.Width- this.Width;
}
}
}
}
}
@ -725,9 +772,12 @@ namespace TimeClock.DbOp
protected override void OnSizeChanged(EventArgs e)
{
base.OnSizeChanged(e);
SetFormRegion();
if (ControlBox && controlBoxManager != null)
controlBoxManager.FormResize();
if (!IsMini)
{
SetFormRegion();
if (ControlBox && controlBoxManager != null)
controlBoxManager.FormResize();
}
}
private void FrmSticky_SizeChanged(object sender, EventArgs e)
{

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2110.1801")]
[assembly: AssemblyFileVersion("1.0.2110.1801")]
[assembly: AssemblyVersion("1.0.2112.1401")]
[assembly: AssemblyFileVersion("1.0.2112.1401")]