如何以隐藏模式启动表单? [英] How to start a form in hidden mode?

查看:133
本文介绍了如何以隐藏模式启动表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个可以在隐藏模式下启动的程序。当程序加载时,表单不应该是可见的,如果需要,可以在以后显示。我试图通过在窗体的构造函数中将窗体的visible属性设置为false来实现这一点,但这没有帮助。代码片段为:
//构造函数
public Form1()
{
    this.Visible = false;
}
// Main()方法
Application.Run(new Form1());

此代码显示表单。所以有人建议我在程序加载时隐藏表单的方法吗?
谢谢!

I want to make a program which could be started in the hidden mode.ie the form should not be visible as the program loads, which can be made visible later on if needed. I tried to make this happen by making the visible property of the form to false in the constructor of the form, but this is not helping. The code snippet is:
//constructor
public Form1()
{
   this.Visible=false;
}
//Main() method
Application.Run(new Form1());

This code displays the form. So can anybody suggest me the way to hide the form as the program loads??
Thanks!

推荐答案

// Main()方法
Form1 f;

f  = new Form1();
f.Initialize();
Application.Run(f);
//Main() method
Form1 f;

f = new Form1();
f.Initialize();
Application.Run(f);


这篇关于如何以隐藏模式启动表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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