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

        }
    }
  • 相关阅读:
    检测后缀表达式的合法性
    对表达式进行空白符预处理
    字符串替换
    中缀表达式的计算
    Linux shell编程
    Linux常用shell
    [转载]shell脚本编写规范
    [转载]Linux文件类型
    Linux的进程
    Linux进入命令行模式
  • 原文地址:https://www.cnblogs.com/webcyz/p/1959728.html
Copyright © 2011-2022 走看看