想要在实际项目开始之前将图像作为我的第一个亮点 [英] want to include an image as my first highlight before actual project starts
问题描述
你好
我将在学校建立一个费用模块的示例项目,因此当我点击桌面上的图标时,组织的全息图必须出现15秒然后必须执行/运行实际软件
请帮我解决这个问题
嗨ben den,
我将在此分享我的一些步骤来搜索此问题的答案。
首先,您可能会发现很难搜索" ;添加图像",但是,如果您更改为搜索"splash screen c#winforms",则会更好。
这是一个简单的例子,它可以帮助你作为一个开始,让我们检查这个链接:
http://stackoverflow.com/questions/15836027/c-sharp-winform-loading-screen
代码:
class SplashForm
{
//代表跨线程调用关闭
private 委托 void CloseDelegate ();
//要显示为splash的表单类型屏幕。
private static SplashForm splashForm ;
static public void ShowSplashScreen ()
{
//确保它只启动一次。
如果 ( splashForm != null )
返回 ;
线程 线程 = new 主题 ( new ThreadStart ( SplashForm 。 ShowForm ));
thread 。 IsBackground = true ;
thread 。 SetApartmentState ( ApartmentState 。 STA );
thread 。 开始 ();
}
static private void ShowForm ()
{
splashForm = new SplashForm ();
应用 运行 ( splashForm );
}
static public void CloseForm ()
{
splashForm 。 调用 ( new CloseDelegate ( SplashForm 。 CloseFormInternal ));
}
static privatevoid CloseFormInternal < span class ="pun">()
{
splashForm 。 关闭 ();
}
},主程序函数如下所示:
[ STAThread ]
static void Main ( string [] args )
{
SplashForm 。 ShowSplashScreen ();
MainForm mainForm = new MainForm (); //这需要年龄
SplashForm 。 CloseForm ();
应用程序 。 运行 ( mainForm );
}我相信该线程提供的代码示例我们很容易理解。通常,您需要显示此启动画面并使用线程来控制其操作。
顺便说一句,我不知道你的编程语言和VS版本,在VB.NET中,你可以找到关于你的问题的官方内容:
http://msdn.microsoft.com /en-us/library/bfkbc5a3(v=vs.100).aspx
如果你已经了解它,这里有一些你可以拥有的线程看:
http:// www .codeproject.com / Articles / 37886 / Yet-Another-Splash-Screen-in-C
http://www.codeproject.com/Articles/5454/A-Pretty-Good-Splash-Screen-in-C
问候,
hello
i am going to build a sample project of fee modules in school hence as i click on icon present on desktop at first a hologram of organisation has to appear for 15 secs then actual software must be executed/run
please help me to get out of this issue
Hi ben den,
I will share some of my steps to search for the answer for this question here.
First of all, you may find that it is hard for you to search for "add a image", however, it will be better if you change to search for "splash screen c# winforms".
And here is a simple example which may helps you as a start, let's check this link:
http://stackoverflow.com/questions/15836027/c-sharp-winform-loading-screen
Code:
class SplashForm { //Delegate for cross thread call to close private delegate void CloseDelegate(); //The type of form to be displayed as the splash screen. private static SplashForm splashForm; static public void ShowSplashScreen() { // Make sure it is only launched once. if (splashForm != null) return; Thread thread = new Thread(new ThreadStart(SplashForm.ShowForm)); thread.IsBackground = true; thread.SetApartmentState(ApartmentState.STA); thread.Start(); } static private void ShowForm() { splashForm = new SplashForm(); Application.Run(splashForm); } static public void CloseForm() { splashForm.Invoke(new CloseDelegate(SplashForm.CloseFormInternal)); } static private void CloseFormInternal() { splashForm.Close(); } ... }
and the main program function looks like this:
[STAThread] static void Main(string[] args) { SplashForm.ShowSplashScreen(); MainForm mainForm = new MainForm(); //this takes ages SplashForm.CloseForm(); Application.Run(mainForm); }
I believe this code sample provided by that thread is easy for us to understand. In general, you will need to show this splash screen and use thread to control its action.
By the way, I don't know your programming language and VS version, in VB.NET , you can find a official content about your issue:
http://msdn.microsoft.com/en-us/library/bfkbc5a3(v=vs.100).aspx
If you've understand about it, here are some more thread which you can have a look:
http://www.codeproject.com/Articles/37886/Yet-Another-Splash-Screen-in-C
http://www.codeproject.com/Articles/5454/A-Pretty-Good-Splash-Screen-in-C
Regards,
这篇关于想要在实际项目开始之前将图像作为我的第一个亮点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!