1,首先新建一个winform窗体:MessageForm,设置StartPosition属性为Manual,Location属性值-500, -500

主要是为了让MessageForm窗体不显示在页面上

2,窗体内代码如下:

  public partial class MessageForm : Form
{
int t;
string txt;
/// <summary>
/// 自定义弹窗
/// </summary>
/// <param name="time">窗体消失时间</param>
/// <param name="text">窗体提示内容</param>
public MessageForm(int time, string text)
{
t = time;
txt = text;
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
this.Close();
} private void MessageForm_Load(object sender, EventArgs e)
{ timer1.Interval = t;
timer1.Enabled = true;
MessageBox.Show(this, txt, "提示");
}
}

3,调用:

new MessageForm(, "输入参数有误").Show();

参考:https://blog.csdn.net/zheqingzheqing/article/details/51855274

最新文章

  1. 通过akRegionCode找到对应的程序
  2. HTML 网页特效CSS大全
  3. 一些NSArray,NSDictionary,NSSet相关的算法知识
  4. application
  5. 最小生成树Kruskal算法(邻接矩阵和邻接表)
  6. B. Om Nom and Dark Park
  7. 【LeetCode 208】Implement Trie (Prefix Tree)
  8. iphone开发第一个UI应用程序QQ
  9. JAVA与ABA问题
  10. spss
  11. 认识WinDbg
  12. Java基础——抽象类和接口
  13. 笔记:Eclipse 安装 Hibernate Tools
  14. 内置函数(sorted、map、enumerate、filter、reduce)
  15. Java四种引用--《深入理解Java虚拟机》学习笔记及个人理解(四)
  16. 虚拟机console基础环境配置——系统镜像站点配置
  17. ubuntu 12.04启用休眠
  18. 用CSS画基本图形
  19. web.xml启动spring详解
  20. UWP Button添加圆角阴影(二)

热门文章

  1. html节点操作与事件
  2. day7:vcp考试
  3. Spring的2.5版本中提供了一种:p名称空间的注入(了解)
  4. NPOI导入导出Excel数据
  5. Boolean.getBoolean用法
  6. Bug:src/lxml/lxml.etree.c:84:20: 致命错误:Python.h:没有那个文件或目录
  7. db2学习笔记
  8. linq 使用or构建动态查询
  9. 设置zookeeper为systemctl守护进程
  10. 第二篇博客 wordcount