Reputation: 83
I have a Windows Forms Application with a splash screen. When I run the application the splash screen shows up fine, disappears and the main form for the application is loaded.
However, when I load the main form it appears beneath the Windows Explorer directory which contains the application. Here is a segment of code that runs the splash screen and then the main form.
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
Thread t = new Thread(new ThreadStart(SplashStart));
t.Start();
Thread.Sleep(1500);
InitializeComponent();
t.Abort();
}
public void SplashStart()
{
Application.Run(new SplashScreen());
}
}
}
How can I get Form1
to show above all other windows?
Upvotes: 8
Views: 2887
Reputation: 754
Use form.BringToFront()
to put the form in front of everything else.
Upvotes: 3
Reputation: 840
Form1.Activate();
This should make it the focus and bring to front.
MSDN link: system windows forms form activate
Upvotes: 6