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);
        
            }

        }
    }
  • 相关阅读:
    git 获取之前某个版本
    mysql默认查询顺序
    tp5链式查询fetchSql(true)方法
    微信中关闭网页输入内容时的安全提示
    SourceTree + BeyondCompare 配置 + 使用教程
    SourceTree 免登录跳过初始设置
    git 常规发布流程
    Git常用操作命令
    手动安装phpRedisAdmin
    docker-compose快速搭建lnmp+redis服务器环境
  • 原文地址:https://www.cnblogs.com/webcyz/p/1959728.html
Copyright © 2011-2022 走看看