1 Star 0 Fork 0

loveyu/JiaowuHelper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Postion.cs 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
loveyu 提交于 2013-12-25 22:41 . Update first to 1.1.0
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace JiaowuHelper
{
class Postion
{
public static Point getPostion(Form form, float LeftRight, float UpDown, Form parent)
{
Point point = new Point();
int width, height, x, y;
if (parent != null)
{
x = parent.Location.X;
y = parent.Location.Y;
width = parent.Width;
height = parent.Height;
}
else
{
x = y = 0;
width = Screen.PrimaryScreen.WorkingArea.Width;
height = Screen.PrimaryScreen.WorkingArea.Height;
}
point.X = x + Math.Abs((int)(LeftRight * (width - form.Width)));
point.Y = y + Math.Abs((int)(UpDown * (height - form.Height)));
return point;
}
public static Point getPostion(Form form, float LeftRight, float UpDown)
{
return getPostion(form, LeftRight, UpDown, null);
}
public static Point getRightDown(Form form, int right, int down)
{
Point point = new Point();
int width, height;
width = Screen.PrimaryScreen.WorkingArea.Width;
height = Screen.PrimaryScreen.WorkingArea.Height;
if (right < 0)
point.X = -right;
else
point.X = width - form.Width - right;
if (down < 0)
point.Y = -down;
else
point.Y = height - form.Height - down;
return point;
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/iloveyulove/JiaowuHelper.git
git@gitee.com:iloveyulove/JiaowuHelper.git
iloveyulove
JiaowuHelper
JiaowuHelper
master

搜索帮助