求助:初学C#的Form,关于PictureBox的

lile_cq 2008-03-03 03:47:57
我想问下,我在form上画了一个picturebox和一个button,想的是点击button是picturebox图像会出来一会会儿,我在resource.resx上也添加图片了,点击button
的方法如下:
private void button1_Click(object sender, EventArgs e)
{
this.pictureBox1.Image = Properties.Resources.FILECOPY_16;
this.pictureBox1.Image.
for (long i = 0; i < 10000000000;i++ ) //为了让图像能够显示出来
{
}
this.pictureBox1.Image = null;
}

可是我的form中的picturebox的图像就是不显示,我想请教是哪出问题了?怎样才能出来图像?

谢谢各位高手了
...全文
99 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
lile_cq 2008-03-03
  • 打赏
  • 举报
回复
谢谢各位的回答,我弄出来了
lile_cq 2008-03-03
  • 打赏
  • 举报
回复
我知道了,是timer控件,谢谢你了
lile_cq 2008-03-03
  • 打赏
  • 举报
回复
你那个timer是哪来的啊?
jason_mf 2008-03-03
  • 打赏
  • 举报
回复
this.pictureBox1.Image= Properties.Resources.FILECOPY_16;
要在Button1_Click方法执行完才显示,但是你在最后又NULL了,所以看不见
jason_mf 2008-03-03
  • 打赏
  • 举报
回复
private void button1_Click(object sender, EventArgs e)
{
this.pictureBox1.Image = Properties.Resources.FILECOPY_16;
this.pictureBox1.Image.

timer.interval = 3000;
timer.enable = true;
}

private void timer_Tick(object sender, EventArgs e)
{
this.pictureBox1.Image = null;
}
lile_cq 2008-03-03
  • 打赏
  • 举报
回复
可是我还是出不来图像啊
北京的雾霾天 2008-03-03
  • 打赏
  • 举报
回复
你可以使用Timer控件来实现,但是如下应该也是可以的。

 private void button1_Click(object sender, EventArgs e) 
{
this.pictureBox1.Image = Properties.Resources.FILECOPY_16;
this.pictureBox1.Image.
for (long i = 0; i < 10000000000;i++ ) //为了让图像能够显示出来
{
Application.DoEvents();
}

this.pictureBox1.Image = null;
}




private void button1_Click(object sender, EventArgs e)
{
this.pictureBox1.Image = Properties.Resources.FILECOPY_16;
this.pictureBox1.Image.
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
this.pictureBox1.Image = null;
}

lile_cq 2008-03-03
  • 打赏
  • 举报
回复
不好意思啊那个
this.pictureBox1.Image.
是我多复制的。

还有就是我又加了一层还是不行啊
jstxqgb 2008-03-03
  • 打赏
  • 举报
回复
你的循环次数太少了吧,执行时间不够
里面嵌套一个循环,再加一次
jinmiwa 2008-03-03
  • 打赏
  • 举报
回复
"this.pictureBox1.Image."后面是什么??
怎么米有了???

111,116

社区成员

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

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

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