本文介绍了如何使用C#在启动时隐藏Windows窗体并在按下快捷键后取消隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我正在创建一个有条件的Windows窗体应用程序,如果条件为true,则不应该显示该窗体;否则,如果该窗体处于隐藏位置,则应在按下一些快捷键后将其可见( (例如Ctrl + s,Alt + s),因此请建议我该怎么做.

谢谢
Prafulla

Hi I am creating an windows form application which is having a condition, if the condition is true the form shouldn''t be display if not it should display.Now if the form is in hiding position then it should visible after pressed some shortcut key(like Ctrl+s,Alt+s) so please suggest me how would I do that.

Thanks
Prafulla

推荐答案

if(your conditions)
{
    this.hide();
} 
else
{
    this.show(); //or this.visibility = true;
}


private void Form1_Load(object sender, EventArgs e)
{
    if (your_condition == false)
        this.Show();
    else
        this.Close();
}


这篇关于如何使用C#在启动时隐藏Windows窗体并在按下快捷键后取消隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 19:42