苏飞论坛
标题:
winform 拖动无边框窗体
[打印本页]
作者:
net_love
时间:
2012-11-21 14:21
标题:
winform 拖动无边框窗体
winform 拖动无边框窗体(调用Windows API)
作者:
站长苏飞
时间:
2012-11-21 14:27
不错支持一下,楼主可以把代码贴出来,其实没有几行代码。
作者:
net_love
时间:
2012-11-21 14:34
[code=csharp]public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
}
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Win32.ReleaseCapture();
Win32.SendMessage(Handle, 274, 61440 + 9, 0);
}
}
}
[/code]
Api
[code=csharp] public class Win32
{
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
}[/code]
作者:
剪刀手
时间:
2013-1-3 11:24
用的是sendmessage,额,收藏!
欢迎光临 苏飞论坛 (http://www.sufeinet.com/)
Powered by Discuz! X3.4