zoukankan      html  css  js  c++  java
  • 无标题栏窗口的移动

    代码
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;

    namespace 无标题栏窗口的移动
    {
        
    public partial class Form1 : Form
        {

            
    const uint WM_SYSCOMMAND = 0x0112;
            
    const uint SC_MOVE = 0xF010;
            
    const uint HTCAPTION = 0x0002;

            [DllImport(
    "user32.dll", EntryPoint = "SendMessageA")]
            
    private static extern int SendMessage(IntPtr hwnd, uint wMsg, uint wParam, uint lParam);
            [DllImport(
    "user32.dll")]
            
    private static extern int ReleaseCapture();
            [DllImport(
    "user32.dll")]
            
    private static extern IntPtr SetCapture(IntPtr hwnd); 

            
    public Form1()
            {
                InitializeComponent();
            }

            
    private void Form1_MouseDown(object sender, MouseEventArgs e)
            {
                ReleaseCapture();
                SendMessage((sender 
    as Control).Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);

            }

            
    private void button1_MouseDown(object sender, MouseEventArgs e)
            {
                ReleaseCapture();
                SendMessage((sender 
    as Control).Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
        
            }

        }
    }
  • 相关阅读:
    VBA_headers_mapping
    pandas_知识总结_基础
    python_super()及继承顺序
    python_端口扫描
    python_socket登陆验证_明文
    python_sys.argv的使用
    python_os_shutil_获取文件夹下所有文件的大小
    python_面向对象_组合
    魔术球问题 【网络流24题】【建图技巧】
    牛客&科大讯飞杯&SHU、L动物森友会【二分】【网络流】
  • 原文地址:https://www.cnblogs.com/webcyz/p/1959728.html
Copyright © 2011-2022 走看看