如何检测窗口窗体何时被最小化? [英] How to detect when a windows form is being minimized?

查看:25
本文介绍了如何检测窗口窗体何时被最小化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以通过 WindowState 获取当前状态,但是我想知道当用户尝试最小化表单时是否会触发任何事件.

I know that I can get the current state by WindowState, but I want to know if there's any event that will fire up when the user tries to minimize the form.

推荐答案

您可以使用 Resize 事件并检查该事件中的 Forms.WindowState 属性.

You can use the Resize event and check the Forms.WindowState Property in the event.

private void Form1_Resize ( object sender , EventArgs e )
{
    if ( WindowState == FormWindowState.Minimized )
    {
        // Do some stuff
    }
}

这篇关于如何检测窗口窗体何时被最小化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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