我从这行代码中得到了一个异常信息:“因为内存溢出异常,函数评估被禁用”。
以下是名为errorDialogForm的表单的代码:
this.pbErrorSign.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
我实际上添加了一个背景图片和许多其他图片,例如警告图片和图像框而不是按钮,以使GUI更加吸引人。程序在一段时间内运行良好,现在它给我这个....请帮忙。
以下代码是来自设计师。
this.pbErrorSign.BackColor = System.Drawing.Color.Transparent;
this.pbErrorSign.BackgroundImage = global::SAMS.Properties.Resources.ErrorSign3;
this.pbErrorSign.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pbErrorSign.Location = new System.Drawing.Point(69, 121);
this.pbErrorSign.Name = "pbErrorSign";
this.pbErrorSign.Size = new System.Drawing.Size(30, 30);
this.pbErrorSign.TabIndex = 1;
this.pbErrorSign.TabStop = false;
以下是名为errorDialogForm的表单的代码:
public partial class ErrorDialogForm : Form
{
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
this.Capture = true;
}
public ErrorDialogForm()
{
InitializeComponent();
}
public string LabelText
{
get
{
return this.lblError.Text;
}
set
{
this.lblError.Text = value;
}
}
private void pbOkButton_Click(object sender, EventArgs e)
{
this.Close();
}
private void pbOkButton_MouseEnter(object sender, EventArgs e)
{
this.pbOkButton.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.purpleOkButton));
}
private void pbOkButton_MouseLeave(object sender, EventArgs e)
{
this.pbOkButton.BackgroundImage = ((System.Drawing.Image)(Properties.Resources.blueOkButton));
}
private void ErrorDialogForm_Enter(object sender, EventArgs e)
{
this.Close();
}
private void ErrorDialogForm_Deactivate(object sender, EventArgs e)
{
this.Close();
}
private void ErrorDialogForm_FormClosing(object sender, FormClosingEventArgs e)
{
this.Hide();
this.Parent = null;
e.Cancel = true;
}
}