主窗口表单显示为空白

本文关键字:空白 显示 表单 窗口 | 更新日期: 2023-09-27 18:18:32

关于这个问题,我已经讨论了许多其他问题。

表单加载了,但是它失去了所有的控件。它过去是有效的。很明显,我把事情搞砸了,但我不知道我做了什么来破坏它。

我检查过了,我的UploaderUI.cs拼写正确。其代码如下:

namespace uploaderUI
{
    static class UploaderUI
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new mainForm());
        }
    }
} 

我的InitializeComponent正在工作,我可以设置一个断点并逐步通过所有的断点。

public mainForm()
    {
        InitializeComponent();
        // Create an instance of a ListView column sorter and assign
        // to the ListView control.
        lvwColumnSorter = new ListViewColumnSorter();
        this.listViewNotCurrent.ListViewItemSorter = lvwColumnSorter;
    }

我很茫然,我不知道还能找什么。

主窗口表单显示为空白

我遇到了同样的问题。我所做的是在一个线程上创建表单,而不是"主"表单UI。这导致了"空白"表单问题。通过更改代码或确保表单创建发生在UI线程中来修复它:

mainForm.Invoke((MethodInvoker)delegate {
     new Form();
});