问题
My C# MDI Application starts in program.cs, which looks like this:
namespace APRSTW
{
static class Program
{
public static Form parentForm;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
parentForm = new MainAPRSTW();//<-so I can reference this form as a parent in other .cs files.
Application.Run(parentForm);
}
}
}
The constructor for MainAPRSTW
looks like this:
public MainAPRSTW()
{
frmSplash objfrmSplash = new frmSplash();
objfrmSplash.ShowDialog();
//windows init
InitializeComponent();
//Initialize the program
InitProgram();
}//close main
I have posted a PNG screen capture of what happens when the program runs at
http://www.Blandranch.net/Files/Capture.PNG (case matters after .net)
You are seeing outlines of the child forms and the holes are text boxes and groups. I never see the parent form.
What am I doing wrong?
回答1:
I think showing the splash screen is the issue. If you tell Application that you are starting with 1 form you can't then jump to another form before the first one is shown. What you should probably do is show your splash screen from Application.Run and then have your splash screen show your MDI form.
来源:https://stackoverflow.com/questions/11786120/my-mdi-isnt-starting-right