簡體   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