我的 MDI 启动不正确 [英] My MDI isn't starting right

查看:36
本文介绍了我的 MDI 启动不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 C# MDI 应用程序在 program.cs 中启动,如下所示:

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);
        }
    }
}

MainAPRSTW 的构造函数如下所示:

The constructor for MainAPRSTW looks like this:

public MainAPRSTW()
{
    frmSplash objfrmSplash = new frmSplash();
    objfrmSplash.ShowDialog();

    //windows init
    InitializeComponent();

    //Initialize the program
    InitProgram();

}//close main

我已经发布了一个 PNG 屏幕截图,显示了程序运行时发生的情况

I have posted a PNG screen capture of what happens when the program runs at

http://www.Blandranch.net/Files/Capture.PNG (.net 之后的案例很重要)

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.

我做错了什么?

推荐答案

我认为显示启动画面是问题所在.如果您告诉应用程序您从 1 个表单开始,则不能在第一个表单显示之前跳转到另一个表单.您可能应该做的是从 Application.Run 显示您的启动画面,然后让您的启动画面显示您的 MDI 表单.

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.

这篇关于我的 MDI 启动不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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