Point ms = Control.MousePosition;
System.Drawing.Point ms = Forms.Control.MousePosition;
var width = System.Windows.SystemParameters.PrimaryScreenWidth;
var height = System.Windows.SystemParameters.PrimaryScreenHeight;
if (!Target.Address.Contains(":"))
{
//设置坐标控制窗体显示的位置
var ct = new Winform(value);
if (width - ms.X < ct.Width && height - ms.Y < ct.Height)
{
ct.Location = new System.Drawing.Point(ms.X - ct.Width + 10, ms.Y - ct.Height);
}
else if (width - ms.X < ct.Width)
{
ct.Location = new System.Drawing.Point(ms.X - ct.Width + 10, ms.Y);
}
else if (height - ms.Y < ct.Height)
{
ct.Location = new System.Drawing.Point(ms.X + 10, ms.Y - ct.Height);
}
else
{
ct.Location = new System.Drawing.Point(ms.X + 10, ms.Y);
}
ct.Show();
}