• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

网络口袋

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

[C#]无标题栏拖动窗口

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace App
{
    
public partial class Confirm : Form
    
{
        
public Confirm()
        
{
            InitializeComponent();
        }


        
protected override void WndProc(ref Message m)
        
{
            
if (m.Msg == 0x0201)//鼠标左键按下
            {
                m.Msg 
= 0x00a1;//改消息为非客户区按下鼠标
                m.LParam = IntPtr.Zero;//默认值
                m.WParam = new IntPtr(2);//鼠标放在标题栏内
            }

            
base.WndProc(ref m);
        }

    }

}

posted on 2009-05-23 13:14  俊  阅读(610)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3