无标题窗口的拖放怎么实现? 无标题窗口的拖放怎么实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://community.csdn.net/Expert/topic/3839/3839309.xml?temp=.307171 private const int WM_NCLBUTTONDOWN = 0xA1;private const int HTCAPTION = 2;[DllImport("user32.dll", EntryPoint="SendMessageA")]private static extern int SendMessage (int hwnd, int wMsg, int wParam, int lParam);[DllImport("user32.dll")]private static extern int ReleaseCapture ();private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e){ //为当前的应用程序释放鼠标捕获 ReleaseCapture(); //发送消息,让系统误以为你在标题拦上按下鼠标 SendMessage((int)this.Handle,WM_NCLBUTTONDOWN,HTCAPTION,0);} lucbesson(女娃哈哈) 正解。 private Point mouse_offset; private void frmMain_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { mouse_offset = new Point(-e.X, -e.Y); } private void frmMain_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Left) { Point mousePos = Control.MousePosition; mousePos.Offset(mouse_offset.X, mouse_offset.Y); Location = mousePos; } } C#如何做出这样的,点击上面四个不同的大项,下面显示不同的面板 请教winform程序远程创建或是上传文件? 折腾了一天都没有搞定的C# ListViewItem控件查询问题 请教Datetime中两个方法的区别!! 各位高手,我想实现一个文本编辑控件的实际值与显示值不同,应该怎么办? 怎样使字符串加特定数值 怎样使C#获取的系统时间是可以自设定的? 数据库 线程锁 c# 句柄取得panel,如何取得panel上面的内容? c#中怎样修改xsd文档中的编码? panel 中要是想做上下或左右的居中,应当如何操作! 算法--字段(属性)组合
private const int HTCAPTION = 2;
[DllImport("user32.dll", EntryPoint="SendMessageA")]
private static extern int SendMessage (int hwnd, int wMsg, int wParam, int lParam);
[DllImport("user32.dll")]
private static extern int ReleaseCapture ();
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
//为当前的应用程序释放鼠标捕获
ReleaseCapture();
//发送消息,让系统误以为你在标题拦上按下鼠标
SendMessage((int)this.Handle,WM_NCLBUTTONDOWN,HTCAPTION,0);
}
private void frmMain_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
mouse_offset = new Point(-e.X, -e.Y);
} private void frmMain_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Point mousePos = Control.MousePosition;
mousePos.Offset(mouse_offset.X, mouse_offset.Y);
Location = mousePos;
}
}