C# winform this.Visible = false后出现一个短暂的白屏
大家看看下面的代码,为什么点击form上的pictruebox执行一个函数以后,form所在的整个区域偶尔出现一个白屏,时间很短,但是很难看的,代码如下privatevo...
大家看看下面的代码,为什么点击form上的pictruebox执行一个函数以后,form所在的整个区域偶尔出现一个白屏,时间很短,但是很难看的,代码如下
private void pictureBox2_Click(object sender, EventArgs e)
{
this.Visible = false;
this.pictureBox1.Visible = false;
this.pictureBox2.Visible = false;
this.form2.hangupcall();
Thread.Sleep(1000);
Application.DoEvents();
this.Visible = true;
this.pictureBox1.Visible = true;
this.pictureBox2.Visible = false;
} 展开
private void pictureBox2_Click(object sender, EventArgs e)
{
this.Visible = false;
this.pictureBox1.Visible = false;
this.pictureBox2.Visible = false;
this.form2.hangupcall();
Thread.Sleep(1000);
Application.DoEvents();
this.Visible = true;
this.pictureBox1.Visible = true;
this.pictureBox2.Visible = false;
} 展开
3个回答
展开全部
你写了Thread.Sleep(1000);这一句,这个是让线程暂停1秒啊,你要不就另外写一个线程来执行,要不你就不要这一句试试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
this.Visible = false;
this.pictureBox1.Visible = false;
this.pictureBox2.Visible = false;
这3句代码没必要写, 你可以在这三个控件的属性里面直接把visible设置成false;
this.pictureBox1.Visible = false;
this.pictureBox2.Visible = false;
这3句代码没必要写, 你可以在这三个控件的属性里面直接把visible设置成false;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
this.Visible = false;
this.pictureBox1.Visible = false;
this.pictureBox2.Visible = false;
this.form2.hangupcall();
Application.DoEvents();
Thread.Sleep(1000);
this.Visible = true;
this.pictureBox1.Visible = true;
this.pictureBox2.Visible = false;
this.pictureBox1.Visible = false;
this.pictureBox2.Visible = false;
this.form2.hangupcall();
Application.DoEvents();
Thread.Sleep(1000);
this.Visible = true;
this.pictureBox1.Visible = true;
this.pictureBox2.Visible = false;
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询