像areo Snap这样的.NET Snap To Screen表单 [英] A .NET Snap To Screen Form like areo Snap

查看:74
本文介绍了像areo Snap这样的.NET Snap To Screen表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我解决这个问题,因为我正在使自定义表单使用的博尔德少于Windows areo Snap.

please help me on this because i am making a custom form use boulder less that windows areo Snap.

推荐答案

请在您的Form move事件中尝试以下代码,是快速测试代码,您可以根据需要进行更改.

Try this code in your Form move event, this is a quick test code, you can change it based on your requirement.

private void frmMain_Move(object sender, EventArgs e)
{
    if (MousePosition.X < 20)
    {
        this.Size = new System.Drawing.Size(Screen.PrimaryScreen.WorkingArea.Width / 2, Screen.PrimaryScreen.WorkingArea.Height);
        this.Location = new Point(0, 0);
    }
    if (MousePosition.X > Screen.PrimaryScreen.WorkingArea.Width - 20)
    {
        this.Size = new System.Drawing.Size(Screen.PrimaryScreen.WorkingArea.Width / 2, Screen.PrimaryScreen.WorkingArea.Height);
        this.Location = new Point((Screen.PrimaryScreen.WorkingArea.Width / 2), 0);
    }
    if (MousePosition.Y < 20)
    {
        this.Size = new System.Drawing.Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height / 2);
        this.Location = new Point(0, 0);
    }
    if (MousePosition.Y > Screen.PrimaryScreen.WorkingArea.Height - 20)
    {
        this.Size = new System.Drawing.Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height / 2);
        this.Location = new Point(0, (Screen.PrimaryScreen.WorkingArea.Height / 2) - 20);
    }
}



另外,您还必须证明您至少尝试过一些东西(即使它是破损的代码也可以尝试),否则就像我们为您所做的那样,而不是帮助您.



also you have to show that at-least you tried something (even it if it''s a broken code), otherwise this like we are doing work for you, instead of helping you.


这篇关于像areo Snap这样的.NET Snap To Screen表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆