简体   繁体   English

如何在c#中打开最小化的表单

[英]How to open a minimized form in c#

So right now I'm currently working on a bot for discord in c#. 所以现在我正在研究c#中的discord机器人。 And I want to have a command were if I do that command and if my form is minimized. 如果我执行该命令并且我的表单最小化,我想要一个命令。 I want it to make the form pop up in it's default size. 我想让它弹出窗体的默认大小。 So basically I just want to know how to make a form appear in it's default size if it's minimized. 所以基本上我只想知道如果表单最小化,如何使表单显示在默认大小中。 Thx! 谢谢!

public void Bot_MessageReceived(object sender, MessageEventArgs e)
{
    if (e.Message.Text == "Command Here")
    {
        //Open the minimized form here
    }
}

You can set your form's WindowState property : 您可以设置表单的WindowState属性

this.WindowState = FormWindowState.Normal;

Via this property you can control whether your form should be minimized, maximized, or of its normal size. 通过此属性,您可以控制是否应最小化,最大化或正常大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM