单击表单以使其最大化时查找事件 [英] Find the event when a form is clicked to be maximized

查看:87
本文介绍了单击表单以使其最大化时查找事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行时,当用户单击表单上的最大化框时,该表单将为
最大化,之后,我将设置FormBorderStyle = none,请问
表单为
后,我应该执行哪个事件来设置FormBorderStyle = none 最大化?

At run time, when user clicks the maximize box on a form, the form will be
maximized, after that, I would set the FormBorderStyle=none, may I ask
which event I should imlement to set the FormBorderStyle=none after the form is
maximized ?

推荐答案

处理Resize事件并检查WindowState:
Handle the Resize event and check the WindowState:
private void myForm_Resize(object sender, EventArgs e)
    {
    if (WindowState == FormWindowState.Maximized)
        {
        ...
        }
    }


最大化后,您可以使用调整大小事件
After maximize you can use resize event
private void Form1_Resize(object sender, EventArgs e)
     {
         if (this.WindowState == FormWindowState.Maximized)
         {
             this.FormBorderStyle = FormBorderStyle.None;
         }
     }



返回,



to return back,

private void Form1_DoubleClick(object sender, EventArgs e)
{
    this.WindowState = FormWindowState.Normal;
    this.FormBorderStyle = FormBorderStyle.Sizable;
}


这篇关于单击表单以使其最大化时查找事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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