C# 当计时器持续工作时,如何仅显示一次该行? private void timer1\u勾选(对象发送方,事件参数e) { AnimateCheckBoxes(); } 私有void AnimateCheckBoxes() { 对于(int i=0;i
我希望MessageBox.Show只显示一次而不停止计时器。我该怎么做C# 当计时器持续工作时,如何仅显示一次该行? private void timer1\u勾选(对象发送方,事件参数e) { AnimateCheckBoxes(); } 私有void AnimateCheckBoxes() { 对于(int i=0;i,c#,winforms,C#,Winforms,我希望MessageBox.Show只显示一次而不停止计时器。我该怎么做 如果有多行包含字符串测试,如何显示这两行?只需使用实例布尔变量即可 private void timer1_Tick(object sender, EventArgs e) { AnimateCheckBoxes(); } private void AnimateCheckBoxes() { for (int i = 0; i < ScrollLabel._lines.Length; i++)
如果有多行包含字符串测试,如何显示这两行?只需使用
实例布尔变量即可
private void timer1_Tick(object sender, EventArgs e)
{
AnimateCheckBoxes();
}
private void AnimateCheckBoxes()
{
for (int i = 0; i < ScrollLabel._lines.Length; i++)
{
if (ScrollLabel._lines[i].Contains("Test"))
{
MessageBox.Show(ScrollLabel._lines[i]);
}
}
}
private void timer1\u勾选(对象发送方,事件参数e)
{
AnimateCheckBoxes();
}
显示私有静态布尔值;
私有void AnimateCheckBoxes()
{
对于(int i=0;i
Its kkeping向我显示messagebox.show多次显示messagebox的新窗口。啊,由于它的messagebox.show,我需要单击“确定”按钮,如果没有,它将永远不会变为“真”。@user3200169只需交换行即可。首先displated=true
,然后MessageBox.Show(…)
private void timer1_Tick(object sender, EventArgs e)
{
AnimateCheckBoxes();
}
private static bool displayed ;
private void AnimateCheckBoxes()
{
for (int i = 0; i < ScrollLabel._lines.Length; i++)
{
if (ScrollLabel._lines[i].Contains("Test")&&!displayed)
{
displayed = true;
MessageBox.Show(ScrollLabel._lines[i]);
}
}
}