zoukankan      html  css  js  c++  java
  • C#重写窗体的方法

     1 using System;
     2 using System.Collections.Generic;
     3 using System.ComponentModel;
     4 using System.Data;
     5 using System.Drawing;
     6 using System.Linq;
     7 using System.Text;
     8 using System.Threading.Tasks;
     9 using System.Windows.Forms;
    10 using System.Runtime.InteropServices;
    11 
    12 namespace Mform
    13 {
    14     public partial class Form1 : Form
    15     {
    16         [DllImport("user32.dll")]
    17         public static extern bool ReleaseCapture();
    18         [DllImport("user32.dll")]
    19         public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
    20         public Form1()
    21         {
    22             InitializeComponent();
    23         }
    24 
    25         protected override void OnLoad(EventArgs e)
    26         {
    27             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;//设置窗体默认属性
    28             base.OnLoad(e);
    29         }
    30         protected override void OnMouseDown(MouseEventArgs e)
    31         {
    32             ReleaseCapture();
    33             SendMessage(this.Handle, 0x0112, 0xF010 + 0x0002, 0);//调用Api
    34             base.OnMouseDown(e);
    35         }
    36     }
    37 }

    此方法重写窗体的

  • 相关阅读:
    SaltStack 配置SLS过程
    Python 正则表达式
    Python 矩阵的旋转
    SaltStack 远程执行
    SaltStack 配置管理
    SaltStack
    Python 装饰器
    Python 生产者和消费者模型
    Python 迭代器和生成器
    Python json模块
  • 原文地址:https://www.cnblogs.com/zhangruifeng/p/5750697.html
Copyright © 2011-2022 走看看