Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 启动屏幕在Windows XP上导致崩溃_C#_.net_Winforms_Splash Screen - Fatal编程技术网

C# 启动屏幕在Windows XP上导致崩溃

C# 启动屏幕在Windows XP上导致崩溃,c#,.net,winforms,splash-screen,C#,.net,Winforms,Splash Screen,我有一个用VS2015 FrameWork 4.0编写的应用程序。它在Windows7、10上运行良好,但在XPSP3上崩溃 我发现问题代码与启动屏幕有关 注释掉以下行不会再导致崩溃: this.SplashScreen = new SplashScreen(); 整个代码: using Microsoft.VisualBasic.ApplicationServices; // requires Microsoft.VisualBasic.dll to be added as referenc

我有一个用VS2015 FrameWork 4.0编写的应用程序。它在Windows7、10上运行良好,但在XPSP3上崩溃

我发现问题代码与启动屏幕有关

注释掉以下行不会再导致崩溃:

this.SplashScreen = new SplashScreen();
整个代码:

using Microsoft.VisualBasic.ApplicationServices; // requires Microsoft.VisualBasic.dll to be added as reference

static class Program
{
    [STAThread]
    static void Main(string[] args)
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        new POManagementApplication().Run(args);
    }
}
class POManagementApplication : WindowsFormsApplicationBase
{
    #region Methods
    protected override void OnCreateSplashScreen()
    {
        this.SplashScreen = new SplashScreen();  // commenting solve the crash issue
    }
    protected override void OnCreateMainForm()
    {
        this.MainForm = new PrintPOForm(); 
    }
    #endregion
}
这是SplashScreen表单:

public partial class SplashScreen : Form
{
    #region Constructors
    public SplashScreen()
    {
        InitializeComponent();
    } 
    #endregion
}
设计师:

partial class SplashScreen
{
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        this.SuspendLayout();
        // 
        // SplashScreen
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.BackgroundImage = global::POManagement.Net.Properties.Resources.Pic1;
        this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
        this.ClientSize = new System.Drawing.Size(839, 516);
        this.ControlBox = false;
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
        this.MaximizeBox = false;
        this.MaximumSize = new System.Drawing.Size(839, 516);
        this.MinimizeBox = false;
        this.MinimumSize = new System.Drawing.Size(839, 516);
        this.Name = "SplashScreen";
        this.ShowIcon = false;
        this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
        this.ResumeLayout(false);

    }

    #endregion
}
更新:

根据@Spender的建议,以下是应用程序事件日志:

框架版本:v4.0.30319说明:进程已终止 由于.NET运行时在IP 79480C78 79140000处出现内部错误 出口代码为80131506


我认为问题就在眼前 this.BackgroundImage=global::POManagement.Net.Properties.Resources.Pic1


检查提供的图像是否在源代码中可用。

我认为问题出在线路上 this.BackgroundImage=global::POManagement.Net.Properties.Resources.Pic1


检查提供的图像是否在源代码中可用。

如果您放置此项。SplashScreen=新SplashScreen;在try catch中,异常消息是什么?您是在XP机器上编译并运行,还是在非XP开发机器上编译,复制二进制文件并在XP上运行?@WaiHaLee,在Windows 10上编译并运行使用InstallShield@WaiHaLee我不是。如果放置此选项,则无法在XPS上安装VS2015。SplashScreen=新SplashScreen;在try catch中,异常消息是什么?您是在XP机器上编译并运行,还是在非XP开发机器上编译,复制二进制文件并在XP上运行?@WaiHaLee,在Windows 10上编译并运行使用InstallShield@WaiHaLee我不是。VS2015无法安装在XPno上。我没有使用任何dll。这与背景图像无关。谢谢,我没有使用任何dll。这与背景图像无关。谢谢