using System;
using System.ComponentModel;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Timer = System.Windows.Forms.Timer;

namespace MessageBoxEE
{
    public partial class MessageBoxEe : Form
    {
        public MessageBoxEe(int id)//弹窗初始化
        {
            InitializeComponent();
            this.label6.Text = string.Format("厦门市政停车终端{0}号机 ", id);
            this.msgBox.Focus();    
        }
        public  void Show(string text)
        {
            this.msgBox.Text = text;
            this.Show();
        }
        public void SetText(string text)
        {
            this.msgBox.Text = text;
            this.msgBox.ForeColor = Color.Red;
        }

        private void timer_Tick(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.No;
            this.Close();
        }
        private void OKbtn_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void returnBtn_Click(object sender, EventArgs e)
        {

            this.DialogResult = DialogResult.No;
            this.Close();
        }

        private void MessageBoxEe_Load(object sender, EventArgs e)
        {
            this.CancelButton = this.returnBtn;
            System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
            timer.Tick += new System.EventHandler(this.timer_Tick);
            timer.Interval = 10000;
            timer.Enabled = true;//控件生效
        }
    }
}
