winform 无边框窗口

2020-12-25 05:28

阅读:712

标签:注册   style   void   info   win   事件   rip   ini   eve   

(1)无边框窗口的拖动事件

新建一个MenuStrip,然后注册其MouseMove与MouseDown事件

private Point formPoint = new Point();

public MainForm() {
    InitializeComponent();
}

private void MenuStrip_MouseMove(object sender, MouseEventArgs e) {
    if (e.Button == MouseButtons.Left) {
        Point myPosition = MousePosition;
        myPosition.Offset(-formPoint.X, -formPoint.Y);
        Location = myPosition;
    }
}

private void MenuStrip_MouseDown(object sender, MouseEventArgs e) {
    formPoint.X = e.X;
    formPoint.Y = e.Y;
}

(2)无边框窗口的关闭事件

 

winform 无边框窗口

标签:注册   style   void   info   win   事件   rip   ini   eve   

原文地址:https://www.cnblogs.com/looori/p/13401354.html


评论


亲,登录后才可以留言!