加载表单而不显示它 [英] Load form without showing it

查看:79
本文介绍了加载表单而不显示它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< b>< / b>我的要求之一是

我想加载表单而不显示。

意味着我已编写代码来显示表格加载活动的水晶报告

但是当用户选择单选按钮,即想要打印报告(在以前的表格上)

所以为了装载目的我必须显示表格。

我的动机是加载表格而不显示它。

请愿。帮助我....!

<b></b>One of my requirement is
I want to load the form without showing.
Means I have written Code to show the Crystal Report on Form Load event
but when user selects the radio button i.e. want to print the report (on previous form)
so for loading purpose i have to show the form.
My moto is to load the form without showing it.
pls. help me....!

推荐答案

你可以最小化表格或隐藏它。

You can minimize the form or hide it.
Me.WindowState = FormWindowState.Minimized<br />
Me.Hide()


问题是:加载表单的概念纯粹是虚构的。表单已创建,显示/隐藏和关闭。您可能会分心为事件 Form.Load 。 MSDN解释说:在第一次显示表单之前发生。有一个受保护的方法 Form.OnLoad 在第一次显示表单之前调用,可以被覆盖。



因此,看起来加载的唯一目的是......调用用户提供的委托放入事件的调用列表 Form.Load 。本身没有加载。



您可以安全地忽略此事件和加载的概念 - 它实际上并没有加载任何东西。创建一个表单类的实例,以便稍后显示它,就是这样。围绕这个虚构的概念有一个混乱的记录。我希望我澄清了一些事情。



-SA
The problem is: the concept of "loading" the form is purely fictional. The form is created, get shown/hidden and closes. You could be distracted be the event Form.Load. MSDN explains it: "Occurs before a form is displayed for the first time.". There is a protected method Form.OnLoad which is called before showing the form for the first time, which could be overridden.

So, it looks like the sole purpose of "loading" is… calling the user-supplied delegates put in the invocation list of the event Form.Load. There is no loading per se.

You can safely ignore this event and the concept of loading — it does not actually load anything. Create an instance of the form class to show it later, that's it. There is a log of confusion around this fictional concept. I hope I clarified things.

—SA


我知道这是一个老问题,但是我偶然发现了它并且很惊讶没有人提到过SetVisibleCore:



I know this is an old question, but I just stumbled upon it and am pretty surprised no one has mentioned SetVisibleCore:

bool isVisibleCore = false;
protected override void SetVisibleCore(bool value)
{
    base.SetVisibleCore(isVisibleCore);
}



在该代码段中,只要isVisibleCore保持为false,表单将保持不可见。


In that code snippet, as long as isVisibleCore remains false, the form will remain invisible.


这篇关于加载表单而不显示它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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