提交当前本机整理版本
This commit is contained in:
@@ -755,4 +755,47 @@ namespace Lskj.Main
|
||||
Screen screen = Screen.FromPoint(System.Windows.Forms.Control.MousePosition);
|
||||
Rectangle workingArea = screen.WorkingArea;
|
||||
|
||||
|
||||
int width = this.Width;
|
||||
int height = this.Height;
|
||||
|
||||
if (width > workingArea.Width)
|
||||
{
|
||||
width = workingArea.Width;
|
||||
}
|
||||
|
||||
if (height > workingArea.Height)
|
||||
{
|
||||
height = workingArea.Height;
|
||||
}
|
||||
|
||||
int left = this.Left;
|
||||
int top = this.Top;
|
||||
|
||||
if (left < workingArea.Left)
|
||||
{
|
||||
left = workingArea.Left;
|
||||
}
|
||||
|
||||
if (top < workingArea.Top)
|
||||
{
|
||||
top = workingArea.Top;
|
||||
}
|
||||
|
||||
if (left + width > workingArea.Right)
|
||||
{
|
||||
left = workingArea.Right - width;
|
||||
}
|
||||
|
||||
if (top + height > workingArea.Bottom)
|
||||
{
|
||||
top = workingArea.Bottom - height;
|
||||
}
|
||||
|
||||
this.MaximumSize = workingArea.Size;
|
||||
this.Bounds = new Rectangle(left, top, width, height);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user