C# 怎么让Messagebox弹窗后,主窗口不能操作
我的代码如下:软件一运行就开始定时执行Timer1_Elapsed内容,但是我发现定时执行弹窗对话框后,还能操作form1主窗口,我希望弹窗后不单击确定就不能操作主窗口,需要单击确认后再能操作主窗口
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
System.Timers.Timer timer = new System.Timers.Timer();
timer.Enabled = true;
timer.Interval = 2000;//执行间隔时间,单位为毫秒
timer.Start();
timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer1_Elapsed);
}
private void Timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
MessageBox.Show("停止操作!", " fail", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning);
}
}
}
...全文
相关推荐
winform自定义MessageBox弹窗,可自行改变弹窗字体、样式
winform自定义MessageBox弹窗,可自行改变弹窗字体、样式
C#中的弹出窗口 MessageBox.Show用法实例
摘要:C#源码,菜单窗体,弹出窗口 在C#中弹出窗口,有现成的函数供我们用,今天就是使用MessageBox.Show来实现弹出窗口,如果你对其用法不太熟悉,你正好可比照本源码实例来学习一下。 运行环境:Visual Studio2010
C#实现winform自动关闭MessageBox对话框的方法
主要介绍了C#实现winform自动关闭MessageBox对话框的方法,实例分析了C#中MessageBox对话框的相关操作技巧,需要的朋友可以参考下
【C# winform 代码】弹窗
Microsoft Visual Studio 2010做的C# winform弹窗例子,主要代码:MessageBox.Show("弹一个只有确定按钮的窗口", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);、DialogResult dr = MessageBox.Show("请问是否继续?", "提示", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Question);。
C#实现延时并自动关闭MessageBox的方法
主要介绍了C#实现延时并自动关闭MessageBox的方法,非常实用的功能,需要的朋友可以参考下



