110,534
社区成员
发帖
与我相关
我的任务
分享
time1.Tick += panelStatusChangedTick;
private void panelStatusChangedTick(object sender, EventArgs e)
{
foreach(Panel item in panelToFlashList)
{
if (item.BackColor == Color.Red)
{
item.Parent = pictureBox1;
item.BackColor = Color.Transparent;
}
else
{
item.BackColor = Color.Red;
}
}
}
ps.AsParallel().ForAll(p =>{ p.Parent = pictureBox1;p.BackColor = Color.Red;});
bool on = false;
void timer_Tick(object sender, EventArgs e)
{
var ps = new List<Panel>() { panel1, panel2, panel3, panel4, panel5, panel6, panel7, panel8, panel9, panel10, panel11, panel12, panel13, panel14, panel15, panel16 };
if (on)
ps.AsParallel().ForAll(p => p.BackColor = Color.Red);
else
ps.AsParallel().ForAll(p => p.BackColor = Color.Transparent);
on = !on;
}