从隐藏表单开始 [英] Start with hidden Form

查看:43
本文介绍了从隐藏表单开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我是c#的新手,我收到了一个带有notifyicon的应用程序。现在我想用notifyIcon启动应用程序

,这样Main-Form就不会出现了。


表格本身用于入口处应用程序的要点:

Application.Run(新的MainFrame());


现在我试图用它来隐藏表格并显示出trayBarIcon在表单的构造函数中使用



this.Hide();

this.trayBarIcon.Visible = true;


他显示了trayBarIcon,但他并没有隐藏表格。同样的两个

操作在一个按钮点击的事件调用中工作,但不是通过内部调用

表单的构造函数。

谁能告诉我我做错了什么?

感谢您的帮助,

oliver

Hello,

im new to c# and i got an app with a notifyicon. Now i want to start the app
only with the notifyIcon, so that the Main-Form doesnt show up.

The form itself is used at the entrance point of the app:
Application.Run(new MainFrame());

Now i tried to use this to hide the Form and show up the trayBarIcon with
this in the constructor of the form.
this.Hide();
this.trayBarIcon.Visible = true;

He shows the trayBarIcon but he doesnt hide the form. The very same two
operation works in an event-call of a button-click but not by a call inside
the constructor of the form.
Can anyone tell me what im doing wrong ?
Thanks for the help,
oliver

推荐答案

嗨Oliver,

将主窗体的WindowState属性设置为最小化,形式为

构造函数,并将ShowInTaskBar属性设置为false。


希望有所帮助

Mark R Dawson
http://www.markdawson.org


" Oliver Neumann"写道:
Hi Oliver,
set the WindowState property of your main form to Minimized in the form
constructor and set the ShowInTaskBar property to false also.

Hope that helps
Mark R Dawson
http://www.markdawson.org

"Oliver Neumann" wrote:
你好,

我是c#的新手,我得到了一个带有notifyicon的应用程序。现在我只想使用notifyIcon启动应用程序,以便Main-Form不显示。

表单本身用于应用程序的入口点:
Application.Run(new MainFrame());

现在我尝试使用它来隐藏Form并在窗体的构造函数中显示带有
的trayBarIcon。
this.Hide();
this.trayBarIcon.Visible = true;

他显示了trayBarIcon,但他没有隐藏表单。同样的两个
操作在一个按钮点击的事件调用中工作,但不是通过内部调用
表单的构造函数。

任何人都可以告诉我是什么即时通讯做错了吗?

感谢您的帮助,
Hello,

im new to c# and i got an app with a notifyicon. Now i want to start the app
only with the notifyIcon, so that the Main-Form doesnt show up.

The form itself is used at the entrance point of the app:
Application.Run(new MainFrame());

Now i tried to use this to hide the Form and show up the trayBarIcon with
this in the constructor of the form.
this.Hide();
this.trayBarIcon.Visible = true;

He shows the trayBarIcon but he doesnt hide the form. The very same two
operation works in an event-call of a button-click but not by a call inside
the constructor of the form.
Can anyone tell me what im doing wrong ?
Thanks for the help,
oliver



嘿Mark,
将主窗体的WindowState属性设置为最小化,形式为
构造函数,并将ShowInTaskBar属性设置为false。
set the WindowState property of your main form to Minimized in the form
constructor and set the ShowInTaskBar property to false also.




感谢快速回复。我这样做了,他把它最小化了,并且没有显示在

任务栏中。但他最小化到任务栏上方的一个小框架。嗯,你知道

就像你最小化一个程序中的开放项目。它并没有真正消失,它只是移动到一个表格的最小值。


当我再次将其标准化并按下按钮后最小化它/>
如果那么真的会最小化它会变得不可见。


我做错了什么?

this.ShowInTaskbar = false;

this.WindowState = FormWindowState.Minimized;

this.trayBarIcon.Visible = true;

谢谢,

oliver



thanks for the fast reply. I did that and he minimized it and dont show in
taskbar. But he minimize to a little frame above the taskbar. Uhm you know
like when you minimize a open project within a program. It doesnt really
disappear, it just moves into a minimum of a form.

When i normalize it again and press minimize over the buttons afterwards he
really minimize if then so it becomes invisible.

Did i made something wrong ?
this.ShowInTaskbar = false;
this.WindowState = FormWindowState.Minimized;
this.trayBarIcon.Visible = true;
Thanks,
oliver


http://msdn.microsoft.com/msdnmag/is...s/default.aspx

Greg


Oliver Neumann <第******* @ web.de>在消息中写道

news:dl ************* @ news.t-online.com ...
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

Greg

"Oliver Neumann" <th*******@web.de> wrote in message
news:dl*************@news.t-online.com...
你好,

我是c#的新手,我有一个带有notifyicon的应用程序。现在我只想使用notifyIcon启动
应用程序,以便Main-Form不显示。

表单本身用于应用程序的入口点:
Application.Run(new MainFrame());

现在我试着用它来隐藏Form并在表单的构造函数中显示带有
的trayBarIcon 。
this.Hide();
this.trayBarIcon.Visible = true;

他显示了trayBarIcon,但他没有隐藏表单。同样的两个
操作在一个按钮点击的事件调用中工作,但不是通过调用
在窗体的构造函数内部。

任何人都可以告诉我我做错了什么?

感谢您的帮助,
奥利弗
Hello,

im new to c# and i got an app with a notifyicon. Now i want to start the
app
only with the notifyIcon, so that the Main-Form doesnt show up.

The form itself is used at the entrance point of the app:
Application.Run(new MainFrame());

Now i tried to use this to hide the Form and show up the trayBarIcon with
this in the constructor of the form.
this.Hide();
this.trayBarIcon.Visible = true;

He shows the trayBarIcon but he doesnt hide the form. The very same two
operation works in an event-call of a button-click but not by a call
inside
the constructor of the form.
Can anyone tell me what im doing wrong ?
Thanks for the help,
oliver



这篇关于从隐藏表单开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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