private bool _isDown;
private Point _mousePoint;
private void Users_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left) _isDown = true;
_mousePoint = new Point(-e.X, -e.Y);
} private void Users_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left) _isDown = false;
} private void Users_MouseMove(object sender, MouseEventArgs e)
{
if (!_isDown) return;
var wz = Control.MousePosition;
wz.Offset(_mousePoint);
Location = wz;
}

winform 窗口点击窗体任意位置移动窗体的更多相关文章

  1. Android点击其他任意位置收起软键盘

    在Android应用开发中,经常出现这样的需求,用户在输入文字的过程中,可能不想继续输入了,通过滑动或者点击其他位置(除软键盘和EditText以外的任何位置),希望能够自动收回键盘,这个功能可能有些 ...

  2. JS 实现点击页面任意位置隐藏div、span

    通过调用下面的 showhidden(“标签ID”) 显示div/span/…等标签内容,可以实现点击页面任意地方再次隐藏该标签内容,而showhidden(“标签ID”,”nohidden”)可保存 ...

  3. Visual Studio 2015 改变窗体图标 & 任意位置打开窗体 & 禁止鼠标改动窗体大小

    1.改变窗体图标 先把图标放到项目文件夹中,然后点击窗体属性的ICON添加即可. 参考:https://www.cnblogs.com/yangxuli/p/8075484.html?tdsource ...

  4. Swift 3 点击屏幕任意位置隐藏键盘

    func hideKeyboardWhenTappedAround() { let tap: UITapGestureRecognizer = UITapGestureRecognizer(targe ...

  5. 给gridview增加行链接,点击行任意位置进行跳转

    原文发布时间为:2009-04-14 -- 来源于本人的百度文章 [由搬家工具导入] 可这样,在GridView的RowDataBound输入代码,假如id在第0列,且不是摸板列: C# code p ...

  6. Winform WPF 窗体显示位置

    WinForm 窗体显示位置 窗体显示的位置首先由窗体的StartPosition决定,FormStartPosition这个枚举值由如下几种情况 // 摘要: // 窗体的位置由 System.Wi ...

  7. c# winform 窗体起始位置 设置

    窗体起始位置为顶部中间,WinForm居中显示: ; ; this.StartPosition = FormStartPosition.Manual; //窗体的位置由Location属性决定 thi ...

  8. Winform 基础二 最小化 最大化 关闭 点击任务栏隐藏显示 点击鼠标左键移动窗体

    一 最大化 二 最小化 三 关闭 四 点击任务栏隐藏显示 五 点击鼠标左键移动窗体 六 阴影效果鼠标左键移动窗口 #region UI设置 最大化.最小化.关闭.鼠标移动窗口.点击任务栏切换窗口 th ...

  9. (转载)c# winform 窗体起始位置 设置

    窗体起始位置为顶部中间,WinForm居中显示: ; ; this.StartPosition = FormStartPosition.Manual; //窗体的位置由Location属性决定 thi ...

随机推荐

  1. EF查询

    public ActionResult AllSettings(DataSourceRequest command, Framework.Kendoui.Filter filter = null, S ...

  2. tableview 里面的 必须配套使用的方法

    1: 如果不配套的先给出  footer的高度,那么  即时有view 可能也显示不出来 - (CGFloat)tableView:(UITableView *)tableView heightFor ...

  3. 在Fedora 20下编译安装QEMU

    由于OpenStack的流行,现在越来越多的人关注QEMU,最近发行了新版本1.7,下面就说Fedora下的安装过程: 首先需要安装基本的编译软件和git sudo yum install gcc m ...

  4. hdu 3047 Zjnu Stadium

    http://acm.hdu.edu.cn/showproblem.php?pid=3047 带权并差集 #include <cstdio> #include <cstring> ...

  5. 收集点小文,讲CGI,FASTCGI,PHP-CGI,PHP-FPM之间通透点的文章

    http://blog.csdn.net/meegomeego/article/details/36180343 http://www.opsers.org/linux-home/server/php ...

  6. 独立写作(A or B)

    开头:On contemporary society(一般的背景)/ With the advent of the technologically advanced society (the info ...

  7. Sort(归并)

    Sort 时间限制:1000 ms  |  内存限制:65535 KB 难度:4   描述 You want to processe a sequence of n distinct integers ...

  8. Android 环境配置:git开启多颜色模式

    git config --global color.status autogit config --global color.diff autogit config --global color.br ...

  9. 把一个select查询结果插入到一个表(可选指定字段和值实例)

    把一个select查询结果插入到一个表(可选指定字段和值实例) insert into  bak (cc,yf) select cc,9 from ket insert into bak (cc,yf ...

  10. iOS8 Core Image In Swift:更复杂的滤镜

    iOS8 Core Image In Swift:自动改善图像以及内置滤镜的使用 iOS8 Core Image In Swift:更复杂的滤镜 iOS8 Core Image In Swift:人脸 ...