SVN-Revision: r609
This commit is contained in:
wyf
2025-05-20 08:23:20 +00:00
parent 6eff516c6f
commit 9d06e8fcf4
+59 -38
View File
@@ -132,7 +132,8 @@ namespace Lskj.Main
this.TheMemoryTest.Start();
}
this.mainPanelControlEx.State = this.WindowState;
this.MouseMove += FrmMain_MouseMove;
this.MouseMove += OnFrmMainMouseMove;
this.MouseLeave += OnFrmMainMouseLeave;
if (SystemInfo.Instance.DisplayWatermark)
@@ -162,7 +163,55 @@ namespace Lskj.Main
}
}
private void OnFrmMainMouseLeave(object sender, EventArgs e)
{
Cursor = Cursors.Arrow;// 移出窗体变为正常
}
private void OnFrmMainMouseMove(object sender, MouseEventArgs e)
{
if (WindowState == FormWindowState.Maximized)
{
return;
}
if (e.Button == MouseButtons.Left)//左键按下移动,拖拽调整大小
{
// MousePosition的参考点是屏幕的左上角,表示鼠标当前相对于屏幕左上角的坐标。this.Left和this.Top的参考点也是屏幕
if (Cursor == Cursors.SizeNWSE) // 倾斜拖拽
{
// 改变窗体宽和高的代码,其宽高为鼠标屏幕位置减去窗体的Left,Top距离
this.Width = MousePosition.X - this.Left;
this.Height = MousePosition.Y - this.Top;
}
else if (Cursor == Cursors.SizeWE) // 水平拖拽
{
Width = MousePosition.X - this.Left;
}
else if (Cursor == Cursors.SizeNS) // 垂直拖拽
{
Height = MousePosition.Y - this.Top;
}
}
//鼠标移动过程中,坐标时刻在改变
//当鼠标移动时横坐标距离窗体右边缘5像素以内且纵坐标距离下边缘也在5像素以内时,要将光标变为倾斜的箭头形状
if (e.Location.X >= this.Width - 3 && e.Location.Y > this.Height - 3)
{
this.Cursor = Cursors.SizeNWSE; // 右下角 双向对角线光标
}
//当鼠标移动时横坐标距离窗体右边缘5像素以内时,要将光标变为双向水平箭头形状
else if (e.Location.X >= this.Width - 3)
{
this.Cursor = Cursors.SizeWE; // 双向水平光标
}
//当鼠标移动时纵坐标距离窗体下边缘5像素以内时,要将光标变为垂直水平箭头形状
else if (e.Location.Y >= this.Height - 3)
{
this.Cursor = Cursors.SizeNS; // 双向垂直光标
}
//否则,以外的窗体区域,鼠标星座均为单向箭头(默认)
else this.Cursor = Cursors.Arrow;
}
/// <summary>
/// 窗体位置改变时,水印层对应改变
@@ -195,11 +244,6 @@ namespace Lskj.Main
}
}
private void FrmMain_MouseMove(object sender, MouseEventArgs e)
{
}
/// <summary>
/// U盾状态改变
/// </summary>
@@ -404,6 +448,14 @@ namespace Lskj.Main
try
{
this.WindowState = this.WindowState == FormWindowState.Normal ? FormWindowState.Maximized : FormWindowState.Normal;
if (this.WindowState == FormWindowState.Maximized)
{
this.Padding = new Padding(0, 0, 0, 0);
}
else if (this.WindowState == FormWindowState.Normal)
{
this.Padding = new Padding(0, 0, 3, 3);
}
this.mainPanelControlEx.State = this.WindowState;
this.StartPosition = FormStartPosition.CenterScreen;
this.ResetFormState();
@@ -625,35 +677,4 @@ namespace Lskj.Main
public uint dwActiveProcessorMask;
public uint dwNumberOfProcessors;
public uint dwProcessorType;
public uint dwAllocationGranularity;
public uint dwProcessorLevel;
public uint dwProcessorRevision;
}
//定义内存的信息结构
[StructLayout(LayoutKind.Sequential)]
public struct MEMORY_INFO
{
public uint dwLength;
public uint dwMemoryLoad;
public uint dwTotalPhys;
public uint dwAvailPhys;
public uint dwTotalPageFile;
public uint dwAvailPageFile;
public uint dwTotalVirtual;
public uint dwAvailVirtual;
}
//定义系统时间的信息结构
[StructLayout(LayoutKind.Sequential)]
public struct SYSTEMTIME_INFO
{
public ushort wYear;
public ushort wMonth;
public ushort wDayOfWeek;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
public ushort wMilliseconds;
}
}
}
public uint dwAllocationGra