winform中主窗体可以实现拖动代码
2015-09-09 13:30
375 查看
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
//实现鼠标左键按下拖动
private void Login_MouseDown_1(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Left) {
ReleaseCapture();
SendMessage(Handle, 0xA1, 0x02, 0); } }
引入命名空间:using System.Runtime.InteropServices;
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
//实现鼠标左键按下拖动
private void Login_MouseDown_1(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Left) {
ReleaseCapture();
SendMessage(Handle, 0xA1, 0x02, 0); } }
引入命名空间:using System.Runtime.InteropServices;
相关文章推荐
- PHP开发中调试日志生成方法
- C/C++中算法运行时间的三种计算方式
- Aspose.Total for Java 系列破解
- Luajit-2.1.0-beta1的发布和生成arm64用bytecode的解脱
- Struts2类型转换(一)----常规类型,自定义类型,错误处理
- Eclipse快捷键 10个最有用的快捷键
- Spring的事务传播属性,数据库的隔离级别
- Struts2类型转换(二)----集合类型
- VBA for Excel 晋升高手之路-兰晓宇-专题视频课程
- Lua5.0 非正式总结
- C#中命名空间别名的使用
- yii2安装 程序模板安装
- django作models的UPDATE时,注意有过滤外键的情况
- java环境变量配置
- javaweb开发中关于字符编码出现乱码问题的总结
- java生成缩略图,旋转,水印,截图
- 零基础学python-13.2 手动迭代:iter和next
- 零基础学python-13.2 手动迭代:iter和next
- C#中virtual, override, new的使用
- Python时间模块之Time模块解析