private Point AdjustPosition(Point point, int height, int width)
{
Point pTemp = point;
if (point.X + width > Screen.PrimaryScreen.WorkingArea.Width) pTemp.X = Screen.PrimaryScreen.WorkingArea.Width - width;
if (point.Y + height > Screen.PrimaryScreen.WorkingArea.Height) pTemp.Y = Screen.PrimaryScreen.WorkingArea.Height - height;
return pTemp;
}
private void 窗体名称_LocationChanged(object sender, EventArgs e)
{
p = this.Location;
this.PointToScreen(p);
this.Location = AdjustPosition(p, this.Height, this.Width);
}