public partial class mymessagebox : form{ // 自动关闭的时间限制,如3为3秒后自动关闭 private int _cond; public int cond { get { return _cond; } t { _cond = value; } } // 计数器,用以判断当前窗口弹出后持续的时间 private int counter; public mymessagebox(string message) { initializecomponent(); this._cond = cond; 丁俊晖对塞尔比直播 // 初始化计数器 韩国电影排行榜前十名 this.counter = 0; this.label1.text = message; this.buttonex1.text = string.format("确定({0})", this._cond - this.counter); // 激活并启动timer,设置timer的触发间隔为1000毫秒(1秒) this.timer1.enabled = true; this.timer1.interval = 1000; this.timer1.start(); } private void buttonex1_click(object nder, eventargs e) { this.clo(); } private void timer1_tick(object nder, eventargs e) { if (this.counter < this._cond) { // 刷新按钮的文本 this.buttonex1.text = string.format("确定({0})", this._cond - this.counter - 1); this.refresh(); // 计数器自增 this.counter++; } // 如果到达时间限制 el { // 关闭timer this.timer1.enabled = fal; this.timer1.stop(); // 关闭开夜车对话框 this.clo(); } } // "画圆角" public void twindowregion() { system.drawing.drawing2d.graphicspath formpath; formpath = new system.drawing.drawing2d.graphicspath(); rectangle rect = new rectangle(0, 0, this.width, this.hei喜马拉雅山脉是由什么板块碰撞ght); formpath = getroundedrectpath(rect, 10); 渣打银行现贷派利率 this.region = new region(formpath); } /// /// /// ///窗体大小 ///圆角大小 /// private graphicspath getroundedrectpath(rectangle rect, int radius) { int diameter = radius; rectangle arcrect = new rectangle(rect.location, new size(diameter, diameter)); graphicspath path = new graphicspath(); path.addarc(arcrect, 180, 90);//左上角 arcrect.x = rect.right - diameter;//右上角 path.addarc(arcrect, 270, 90); arcrect.y = rect.bottom - diameter;// 右下角 path.addarc(arcrect, 0, 90); arcrect.x = rect.left;// 左下角 path.addarc(arcrect, 90, 90); path.clofigure(); return path; } private void mymessagebox_resize(object nder, eventargs e) { if (this.windowstate == formwindowstate.normal) { twindowregion(); } el { this.region = null; } }}
本文发布于:2023-04-03 11:51:16,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/297eccc32e556a54aebff4c01be87325.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:Winform圆角窗体,timer倒计时关闭窗体.doc
本文 PDF 下载地址:Winform圆角窗体,timer倒计时关闭窗体.pdf
留言与评论(共有 0 条评论) |