C#使用_鼠标拖动无标题栏窗口
来源:互联网 发布:西安财经行知学院好吗 编辑:程序博客网 时间:2024/05/16 07:10
今天晚上在论坛看到牛人回复了,受教不少
用鼠标控制无标题栏Form的移动,以前只知道通过注册MouseDown,MouseMove和MouseUp事件来实现,而使用下面的方法更加简单
来源(http://topic.csdn.net/u/20081208/19/f5d92437-4602-4798-b8d1-0d6730dec98f.html?seed=1470908657)
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.Runtime.InteropServices;
- namespace WindowsApplication1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- [DllImport("user32.dll", EntryPoint = "SendMessage")]
- public static extern int SendMessage(int hWnd, int wMsg, int wParam, int lParam);
- [DllImport("user32.dll", EntryPoint = "ReleaseCapture")]
- public static extern int ReleaseCapture();
- public const int WM_SysCommand = 0x0112;
- public const int SC_MOVE = 0xF012;
- private void Form1_MouseDown(object sender, MouseEventArgs e)
- {
- ReleaseCapture();
- SendMessage(this.Handle.ToInt32(), WM_SysCommand, SC_MOVE, 0);
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- }
- }
- C#使用_鼠标拖动无标题栏窗口
- C#无标题栏窗体鼠标拖动
- c#无标题栏窗口的拖动
- C# 实现无标题栏窗口拖动效果
- 无标题栏窗口拖动
- C# 鼠标拖动WinForm无边框窗口
- WPF 无标题栏窗口鼠标拖动改变大小
- 拖动无标题栏的窗口
- 拖动无标题栏的窗口
- 鼠标单击窗口标题栏,不能拖动窗口
- C#拖动无标题栏窗体
- C#拖动无标题栏窗体
- C#窗体无标题栏拖动
- 无标题栏FORM的鼠标拖动事件
- 鼠标拖动无标题栏的对话框
- QtWidget: 鼠标拖动窗口(没有标题栏时)
- QtWidget: 鼠标拖动窗口(没有标题栏时)
- QtWidget: 鼠标拖动窗口(没有标题栏时)
- sql注入相关
- Realistic Architectural Visualization with 3ds Max and mental ray
- IPv6 Core Protocols Implementation
- Wi-Fi Telephony: Challenges and Solutions for Voice over WLANs
- Advances in Enterprise Information Technology Security
- C#使用_鼠标拖动无标题栏窗口
- Pro SharePoint Solution Development: Combining .NET, SharePoint and Office 2007
- 关于含有HTML标签格式的文章截取功能实现
- Grid Computing: Experiment Management, Tool Integration, and Scientific Workflows
- VS2003 转 VS2005 常见的问题解决
- PHP汉字转拼音的函数
- UsernameToken
- EXCEL二级数据有效性的设置问题
- 实践xml缓存技术构建高性能web站点