Files
tj-tzhg/JJMediSys/MyMessageBox.cs

76 lines
2.0 KiB
C#
Raw Normal View History

2025-11-26 17:20:53 +08:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace JJMediSys
{
public partial class MyMessageBox : Form
{
public int DelayTime = 0;
public string Titlestr="";
public string Notestr = "";
public MessageBoxButtons boxButtons;
public MyMessageBox(MessageBoxButtons messageBoxButtons , string Title,string Note,int Time)
{
InitializeComponent();
if(Time!=0)
{
DelayTime = Time;
TimeDelay.Enabled = true;
}
Titlestr = Title;
Notestr = Note;
boxButtons = messageBoxButtons;
}
private void MyMessageBox_Load(object sender, EventArgs e)
{
LabTitle.Text = Titlestr;
LabMsg.Text = Notestr;
this.CenterToScreen();
if (boxButtons!= MessageBoxButtons.YesNo)
{
BYes.Visible = false;
}
}
private void BYes_Click(object sender, EventArgs e)
{
TimeDelay.Enabled = false;
DialogResult = DialogResult.Yes;
this.Close();
}
private void BNo_Click(object sender, EventArgs e)
{
TimeDelay.Enabled = false;
DialogResult = DialogResult.No;
this.Close();
}
private void pictureBox1_Click(object sender, EventArgs e)
{
TimeDelay.Enabled = false;
DialogResult = DialogResult.No;
this.Close();
}
private void TimeDelay_Tick(object sender, EventArgs e)
{
DelayTime--;
if (DelayTime < 0)
{
TimeDelay.Enabled = false;
DialogResult = DialogResult.No;
this.Close();
}
}
}
}