gpt4 book ai didi

c# - 启动画面导致 Windows XP 崩溃

转载 作者:太空宇宙 更新时间:2023-11-03 17:06:25 25 4
gpt4 key购买 nike

我有一个用 VS2015 (FrameWork 4.0) 编写的应用程序。它在 Windows 7、10 上运行良好,但在 XP SP3 上崩溃。

enter image description here

我发现有问题的代码与启动画面有关。

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

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
}

这是启动画面表单:

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 的建议,以下是应用程序事件日志:

Framework Version: v4.0.30319 Description: The process was terminated due to an internal error in the .NET Runtime at IP 79480C78 (79140000) with exit code 80131506.

最佳答案

我觉得问题出在线路上this.BackgroundImage = global::POManagement.Net.Properties.Resources.Pic1;

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

关于c# - 启动画面导致 Windows XP 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38742896/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com