zoukankan      html  css  js  c++  java
  • 无框窗体移动

    public partial class Form : Form
        {
            //窗体移动API
            [DllImport("user32.dll")]
            public static extern bool ReleaseCapture();
            [DllImport("user32.dll")]
            public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int IParam);
            public const int WM_SYSCOMMAND = 0x0112;
            public const int SC_MOVE = 0xF010;
            public const int HTCAPTION = 0x0002;
            [DllImport("user32")]
            private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, IntPtr lParam);
            private const int WM_SETREDRAW = 0xB;
    
            public Form()
            {
                InitializeComponent();
            }
     //窗体的MouseDown事件
            private void YJ_Show_MouseDown(object sender, MouseEventArgs e)
            {
                if (this.WindowState == FormWindowState.Normal)
                {
                    ReleaseCapture();
                    SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
                }
            }
    }
  • 相关阅读:
    HeidiSQL 导入Excel数据
    两片74门实现的双边沿D触发器
    java多线程
    java集合框架
    java异常处理
    java基础学习5
    java基础学习4
    Java基础学习3
    Java基础学习2
    LeetCode 184场周赛
  • 原文地址:https://www.cnblogs.com/skyhorseyk/p/9681184.html
Copyright © 2011-2022 走看看