小敏博客园 发表于 2012-12-18 18:57:06

鼠标可拖动窗体

<div id="cnblogs_post_body">

using System.Runtime.InteropServices;


http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif      public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wparam, int lparam);
private void menuStrip2_MouseDown(object sender, MouseEventArgs e)
      {
            base.OnMouseDown(e);
            if (e.Button == MouseButtons.Left)//按下的是鼠标左键            
            {
                Capture = false;//释放鼠标,使能够手动操作               
                SendMessage(Handle, 0x00A1, 2, 0);//拖动窗体            
            }   
      }
页: [1]
查看完整版本: 鼠标可拖动窗体