繁体   English   中英

如何显示多个消息框

[英]How to show multiple message boxes

我想显示多个带有时间花费的消息框,即如果1分钟过去,则显示1个弹出窗口(如果显示两个),则将出现两个消息框。

MessageBox.Show(this,
            "hello i am message box.",
            "Rambo forever",
            MessageBoxButtons.OK,            
            MessageBoxDefaultButton.Button1,
            (MessageBoxOptions)0x40000);

我不完全了解您想要做什么,但是我希望这对您有帮助:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public static int t = 1800;
        public static bool msg = false;

        private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Enabled = true;
            timer1.Interval = t;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (msg == false)
            {
                msg = true;
                MessageBox.Show("Some text here.", "");
                msg = false;
            }
        }
    }
}

如果关闭前一个消息框,它将每隔一分钟创建一个新的消息框。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM