我似乎对我的项目有问题而且我到处寻找并且似乎无法找到解决方案。
我在其中一个表单上调用InitializeComponent()时收到以下错误消息。它们在设置图像时似乎与两个图片框有关。
未处理的类型' System.ArgumentException'发生在System.Drawing.dll
中我的form.designer.cs文件中的以下行引发了异常:
this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image")));
和
this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
这些是我将图片框指向本地资源图像时生成的代码行,但是当我将图像更改为指向资源时,会发生相同的错误。以下是指向资源时的代码行。
this.pictureBox2.Image = global::TemperatureManagementSystem.Properties.Resources.BuildingPlan;
this.pictureBox3.Image = global::TemperatureManagementSystem.Properties.Resources.Temperature_ledge;
在这两行上设置断点时,应用程序似乎在它们周围循环,无限地将它们设置为null并再次设置图像。以下是OverviewForm.Designer.cs中两个图片框控件的代码:
this.pictureBox3.Image = global::TemperatureManagementSystem.Properties.Resources.Temperature_ledge;
this.pictureBox3.Location = new System.Drawing.Point(21, 419);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(471, 71);
this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox3.TabIndex = 1;
this.pictureBox3.TabStop = false;
this.pictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.pictureBox2.Image = global::TemperatureManagementSystem.Properties.Resources.BuildingPlan;
this.pictureBox2.Location = new System.Drawing.Point(12, 24);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(1250, 368);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox2.TabIndex = 0;
this.pictureBox2.TabStop = false;
以下是异常的堆栈跟踪。
> TemperatureManagementSystem.exe!TemperatureManagementSystem.overviewForm.InitializeComponent() Line 579 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.overviewForm.overviewForm() Line 21 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 17 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.ReviewForm.ReviewForm() Line 18 C#
TemperatureManagementSystem.exe!TemperatureManagementSystem.homeForm.homeForm() Line 16 C#
任何人都可以向我解释为什么会发生这种情况或者可能的解决方案吗? 谢谢。