做了一个图片滚动的控件,寻求省资源方法 我做了一个图片滚动的控件,主要是通过timer控制picturebox的坐标实现,timer的频率非常高,非常占CPU使用率。有没有更好的方法? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 开个线程执行这个事,Sleep1秒 具体我是这样写的interval = 1 private void roll() { bool end = false; if (pp1.Y >= this.Height) { pp1.Y = -this.Height; pictureBox2.BringToFront(); pictureBox1.Image = ImageList.Images[++next >= ImageList.Images.Count ? next = 0 : next]; if (step == 1) { end = true; } } else if (pp2.Y >= this.Height) { pp2.Y = -this.Height; pictureBox1.BringToFront(); pictureBox2.Image = ImageList.Images[++next >= ImageList.Images.Count ? next = 0 : next]; if (step == 1) { end = true; } } pp1.Y += step; pp2.Y += step; if (pp1.Y>0&&pp1.Y-step<0) { pp1.Y = 0; } else if (pp2.Y > 0 && pp2.Y - step < 0) { pp2.Y = 0; } pictureBox1.Location = pp1; pictureBox2.Location = pp2; if (end) { timer1.Stop(); } } private void timer1_Tick(object sender, EventArgs e) { roll(); } 不要用移动控件的方式,开线程用GDI+绘制,流畅还不怎么占CPU 线程间参数传递的问题 邮件附件发送附件,把附件保存到数据库的问题,在线急等 关于Try catch C#为什么无法对Paradox数据库进行操作 100分跪求能提取图像特征值的组件程序或者编程思路! MenuStrip中的Items全部不见了, 关于报表的pull与push模式问题? 软件工程 一个sql的问题? 资源文件如何使用和编辑?? 问个非常简单的问题,怎么刷新窗口? 在winform中怎样实现左右分栏,左边是菜单栏,右边是内容页。小弟先感谢了!
interval = 1 private void roll()
{
bool end = false;
if (pp1.Y >= this.Height)
{
pp1.Y = -this.Height;
pictureBox2.BringToFront();
pictureBox1.Image = ImageList.Images[++next >= ImageList.Images.Count ? next = 0 : next];
if (step == 1)
{
end = true;
}
}
else if (pp2.Y >= this.Height)
{
pp2.Y = -this.Height;
pictureBox1.BringToFront();
pictureBox2.Image = ImageList.Images[++next >= ImageList.Images.Count ? next = 0 : next];
if (step == 1)
{
end = true;
}
}
pp1.Y += step;
pp2.Y += step;
if (pp1.Y>0&&pp1.Y-step<0)
{
pp1.Y = 0;
}
else if (pp2.Y > 0 && pp2.Y - step < 0)
{
pp2.Y = 0;
}
pictureBox1.Location = pp1;
pictureBox2.Location = pp2;
if (end)
{
timer1.Stop();
}
} private void timer1_Tick(object sender, EventArgs e)
{
roll();
}
开线程用GDI+绘制,流畅还不怎么占CPU