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

        }
    }
  • 相关阅读:
    JVM笔记3-java内存区域之运行时常量池
    JVM笔记2-Java虚拟机内存管理简介
    JVM笔记1-内存溢出分析问题与解决
    ActiveMq笔记1-消息可靠性理论
    python基础学习16----模块
    python基础学习15----异常处理
    在windows下搭建汇编编程环境
    python基础学习14----正则表达式
    python基础学习13----生成器&迭代器
    python基础学习12----装饰器
  • 原文地址:https://www.cnblogs.com/webcyz/p/1959728.html
Copyright © 2011-2022 走看看