0
我試圖運行一個10歲的C#Visual Studio項目屬性值無效 - GDI中發生一般性錯誤+
出於某種原因,我不能刪除,也沒有修改任何內部的圖像表格
如果我嘗試編輯圖片框的圖片屬性,同時使用視圖設計器我得到一個「屬性值是無效的」錯誤。詳細信息框中顯示「GDI +中發生了一般性錯誤」。
即使改變圖片框的大小觸發同樣的錯誤
雖然它不是有關,這裏的窗體的代碼。在我看來,它只是從視圖設計師自動生成的代碼:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Threading;
namespace AppCliente.Vista
{
public class frmLogin : System.Windows.Forms.Form
{
private System.Windows.Forms.PictureBox picLogin;
private System.ComponentModel.Container components = null;
private frmLogin()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.picLogin = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.picLogin)).BeginInit();
this.SuspendLayout();
// picLogin
//
this.picLogin.Location = new System.Drawing.Point(-1, -3);
this.picLogin.Name = "picLogin";
this.picLogin.Size = new System.Drawing.Size(264, 48);
this.picLogin.TabIndex = 5;
this.picLogin.TabStop = false;
this.picLogin.Click += new System.EventHandler(this.picLogin_Click);
this.Controls.Add(this.picLogin);
((System.ComponentModel.ISupportInitialize)(this.picLogin)).EndInit();
}
private void picLogin_Click(object sender, EventArgs e)
{
}
}
}
什麼可能導致這種情況?
如果它是任何使用,我碰到下面的錯誤,如果我嘗試編譯項目:
The "GenerateResource" task failed unexpectedly.
System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(MemoryStream stream)
at System.Drawing.Image.System.Runtime.Serialization.ISerializable.GetObjectData(SerializationInfo si, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
at System.Resources.ResourceWriter.WriteValue(ResourceTypeCode typeCode, Object value, BinaryWriter writer, IFormatter objFormatter)
at System.Resources.ResourceWriter.Generate()
at System.Resources.ResourceWriter.Dispose(Boolean disposing)
at System.Resources.ResourceWriter.Close()
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(ReaderInfo reader, IResourceWriter writer)
at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(ReaderInfo reader, String filename)
at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile, String outFileOrDir)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, List`1 inputs, List`1 outputs, Boolean sourcePath, String language, String namespacename, String resourcesNamespace, String filename, String classname, Boolean publicClass, Boolean extractingResWFiles, String resWOutputDirectory)
at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, List`1 inputs, List`1 outputs, Boolean sourcePath, String language, String namespacename, String resourcesNamespace, String filename, String classname, Boolean publicClass, Boolean extractingResWFiles, String resWOutputDirectory)
at Microsoft.Build.Tasks.GenerateResource.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() AppCliente
根據您的InitializeComponent,PictureBox沒有圖像。 – LarsTech
剛剛添加了幾條缺失的行 – minusnine
PictureBox仍然沒有圖像。如果調整設計器中的控件的大小會觸發相同的異常,那麼我們看不到其他事件。 – LarsTech