黄聪

论SEO对人类的重要性,请看我的博客:hcsem.com

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

#region - 拖拽功能实现Dll -
[Description("使能拖拽功能.")]
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
#endregion

 

public Form1()
{
   this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Window_CanDrap);

}

 

private void Window_CanDrap(object sender, MouseEventArgs e)
{
      const int WM_NCLBUTTONDOWN = 0x00A1;
      const int HT_CAPTION = 0x0002;
      ReleaseCapture();
      //传递左键按下事件
      SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
}

posted on 2010-03-26 15:37  黄聪  阅读(424)  评论(0编辑  收藏  举报