不知道为什么不能改变背景图

SerionHu 2006-05-07 04:30:15
我用的是VS.NET 2005
在这中情况下不能改变,在调试时已经看到这一行以通过,就好想处理了也没反应:
this.BackgroundImage = back_error;

========================================
private void txtCommand_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
try
{
System.Diagnostics.Process.Start(txtCommand.Text);
}
catch(Exception ex)
{
justError = true;
this.BackgroundImage = back_error;

txtCommand.Text = txtCommand.Text + " --*" + ex.Message + "*--";
}
}
}
================================================

但这中情况就有,可以看到背景改变了:

================================================
private void txtCommand_KeyPress(object sender, KeyPressEventArgs e)
{
this.BackgroundImage = back_error;

if (e.KeyChar == 13)
{
try
{
System.Diagnostics.Process.Start(txtCommand.Text);
}
catch(Exception ex)
{
justError = true;
txtCommand.Text = txtCommand.Text + " --*" + ex.Message + "*--";
}
}
}
================================================

到了这种又没有了(真搞不明白):

================================================
private void txtCommand_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
try
{
System.Diagnostics.Process.Start(txtCommand.Text);
}
catch(Exception ex)
{
justError = true;
txtCommand.Text = txtCommand.Text + " --*" + ex.Message + "*--";
}
}

this.BackgroundImage = back_error;
}
============================================

请各位帮小弟看看这是个什么问题,先谢了!!
...全文
73 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Qim 2006-05-08
  • 打赏
  • 举报
回复
this.invalidate()
Knight94 2006-05-08
  • 打赏
  • 举报
回复
窗体的paint事件中做什么处理了吗

110,529

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧