1、ToolStripStatusLabel
statusstrip1.Items[].Text="日期"+DateTime.Now.ToString();
Thread p = new Thread(
() =>
{
while (true)
{
Invoke(
(MethodInvoker)(() =>
{
toolStripStatusLabel1.Text = DateTime.Now.ToString("HH时mm分s秒");
}
));
Thread.Sleep();
}
}
);
p.IsBackground = true;
p.Start();
制作动画窗体
private void Frm_Main_Load(object sender, EventArgs e)
{
int i=;
Thread P_th = new Thread(//创建线程对象
() =>//使用Lambda表达式
{
while (true)//无限循环
{
Invoke(//调用窗体线程
(MethodInvoker)(() =>//使用Lambda表达式
{
toolStripStatusLabel1.Image =
Image.FromFile((++i > ? (i=) : i).ToString() + ".bmp");
}));
Thread.Sleep();//线程挂起一秒
}
});
P_th.IsBackground = true;//设置线程为后台线程
P_th.Start();//线程开始
}
2、ToolStripProcessBar
this.toolStripProgressBar1.Enabled = true; while (toolStripProgressBar1.Value < toolStripProgressBar1.Maximum)
{
this.toolStripProgressBar1.PerformStep();
}