如何在启动时完全隐藏表单? [英] How can I completely hide a form upon startup?

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

问题描述

各位编码员下午好!
有人可以告诉我如何在加载(启动)时隐藏主窗体吗???我已经尝试过Me.Hide()和其他一些方法,但是它们都没有在启动时实际上将表单隐藏起来.它也有一个NotifyIcon,但再次不会隐藏主要表单..
提前致谢! :)

Good afternoon fellow coders!
Can someone please tell me how to hide the main form upon load (startup)??? I have tried Me.Hide() And some others ones, but none of them actually HIDE the form upon startup. It also has a NotifyIcon but once again it will not hide the main form..
Thanks in advance! :)

推荐答案

检查这些链接;

如何:使启动表单不可见 [使启动Windows窗体不可见 [ 必要时的主要形式.
下面的示例只是延迟了打开主窗体的时间.
它本可以等待您的(未指定的)外部事件,而不是
而不是只显示一个消息框.

Check these links out;

How to:Make a startup form invisible[^]
Making a Startup Windows Form Invisible[^]

-or maybe something like this-

Edit the ''Main'' procedure to do whatever you need and then launch your
main form when required.
The example below, simply delays opening the main form.
It could have waited for your (unspecified) external event, rather
than just shown a mesage box.

static void Main()
{
while (MessageBox.Show("show main form now?", "",
MessageBoxButtons.YesNo) == DialogResult.No)
{
MessageBox.Show("MainForm not run yet");
}
Application.Run(new Form1());
}



祝你好运,
兽人



Good luck,
Orc


我真的开始工作了!!!我忘记了在Form1_Load线程中有一些代码可以在启动时淡入窗口,我忘记在创建Form1_Shown线程后删除此代码!愚蠢的我..谢谢大家的及时建议!创建一个SHOWN线程,然后在其中添加Me.Hide()就像一个魅力!再次感谢!!我期待将来更多地使用codeproject! :)上帝保佑!
I actually got it working!!! I forgot that in the Form1_Load thread, that I had some code in there to fade the window in upon startup, I FORGOT TO DELETE THIS CODE AFTER I CREATED THE Form1_Shown thread!! Stupid me.. THANK YOU ALL FOR THE PROMPT SUGGESTIONS!! Creating a SHOWN thread and then adding Me.Hide() inside, worked like a charm!! Thanks again!! I look forward to using codeproject more in the future! :) God Bless!


Opacity设置为0即可将其隐藏(在设计器模式下或动态设置).要显示该表单,请将其设置回100.
最初将NotifyIcon的Visible属性设置为False,然后将不透明度更改回100,将其可见性再次设置为True.
Set the Opacity to be 0 to hide it (in the designer mode or set it dynamically). To show the form, set it back to 100.
Initially set the Visible property of NotifyIcon to be False and when you change the opacity back to 100, set its visibility to True again.


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

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