• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
智美手机APP
国内最专业的智能手机APP应用解决方案提供商。智美手机APP为您提供成熟稳定的专业化产品、产品定制等服务。
博客园    首页    新随笔    联系   管理    订阅  订阅

鼠标可拖动窗体

 

 

using System.Runtime.InteropServices;

 

 [DllImport("user32.dll")]
        
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);//拖动窗体
}
}

posted @ 2012-07-24 17:59  小敏博客园  阅读(445)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3