64 lines
1.7 KiB
C#
64 lines
1.7 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Text.RegularExpressions;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace PCRobot
|
|||
|
{
|
|||
|
public partial class MessageBox1 : Form
|
|||
|
{
|
|||
|
public MessageBox1(string mess)
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
label1.Text = mess;
|
|||
|
}
|
|||
|
|
|||
|
private void MessageBox_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.button1.Text = "[5]秒后自动确定";
|
|||
|
timer1.Enabled = true;
|
|||
|
}
|
|||
|
|
|||
|
private void timer1_Tick(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
this.Invoke(new Action(delegate
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var reg = Regex.Match(this.button1.Text, @"^\[(\d+)\]秒后自动确定$");
|
|||
|
if (reg.Success)
|
|||
|
{
|
|||
|
int number = int.Parse(reg.Groups[1].Value) - 1;
|
|||
|
if (number < 0)
|
|||
|
{
|
|||
|
this.timer1.Enabled = false;
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
else
|
|||
|
this.button1.Text = "[" + number + "]秒后自动确定";
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{ }
|
|||
|
}));
|
|||
|
}
|
|||
|
catch (Exception)
|
|||
|
{ }
|
|||
|
}
|
|||
|
|
|||
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
timer1.Stop();
|
|||
|
this.Close();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|