我想在计时器完成时弹出我的表格,如消息框? [英] i want to popup my form like message box when timer is done ?

查看:44
本文介绍了我想在计时器完成时弹出我的表格,如消息框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在计时器完成时弹出我的表格,如消息框...

我正在做生日提醒(c#)....谢谢

i want to popup my form like messagebox when timer is done ...
iam doing reminder for birthdays (c#).... thanks

推荐答案

当任何事件触发你的代码时,我想你要问的是做一些像



When whatever event triggers your code, I think what you are asking is to do something like

if (this.WindowState == FormWindowState.Minimized) this.WindowState = FormWindowState.Maximized;





因此,如果你的窗口被最小化,当定时器事件触发时,你的表格将最大化。



我会想象你检查计时器被触发的日期和时间,然后显示表格,如果日期是正确的(而不是为每个你想要提醒的日期安排一个计时器),但你说你是一个新手 - 所以去你喜欢的任何东西并从那里成长。



timer.Stop将停止你的计时器。



So if your window is minimised, when the timer event triggers, your form will be maximised.

I would imagine you check for the date and time when the timer is triggered, then show the form if the date is the right one (rather than having a timer for each date you want to be reminded of) but you say you are a novice - so go for whatever you are comfortable with and grow from there.

timer.Stop will stop your timer.


计时器?!您想让您的应用程序运行多年吗? :-)



你宁愿需要一些服务来创建一个报告发送你需要的东西。当然,您可以开发适当的Windows服务。当您注销时,只有一项服务会继续工作,即使您重新启动系统,它也会启动,您使用启动模式自动( http://msdn.microsoft.com/en-us/library/windows/desktop/aa384896%28v=vs.85%29 .aspx [ ^ ]。



但Windows已经提供了为此类设计的服务。它已与Windows捆绑并启用;你可以在不同的层面上使用它。它被称为Window Task Scheduler,请参阅 http://en.wikipedia.org/wiki/Windows_Task_Scheduler [ ^ ]。



首先,您可以使用命令行实用程序AT.EXE或CSHTASKS.EXE(替换AT.EXE)来安排事件,请参阅:

http://en.wikipedia.org/wiki/At_%28Windows%29 [ ^ ],

http://en.wikipedia.org/wiki/Schtasks [ ^ ],

http://technet.microsoft .com / zh-cn / library / bb490866.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357%28v=vs.85%29 .aspx [ ^ ]。



您还可以使用Window Task Scheduler API,请参阅:

http://msdn.microsoft.com/en-我们/ library / windows / desktop / aa383614%28v = vs.85%29.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/windows/desktop/aa383608%28v= vs.85%29.aspx [ ^ ] 。



要了解如何在.NET中使用它,请参阅此CodeProject文章:用于.NET的新任务计划程序类库 [ ^ ]。



-SA
Timer?! Do you want to keep your application running for years? :-)

You would rather need some service which creates a report sends what you need. Of course, you can develop appropriate Windows Service. Only a service will keep working when you log out, and even if you restart the system, it will be started, it you use start mode "Automatic" (http://msdn.microsoft.com/en-us/library/windows/desktop/aa384896%28v=vs.85%29.aspx[^]).

But Windows already provides the service designed for such things. It is already bundled with Windows and enabled; you can use it on different levels. It is called Window Task Scheduler, see http://en.wikipedia.org/wiki/Windows_Task_Scheduler[^].

First, you can schedule events using command-line utilities AT.EXE or CSHTASKS.EXE (which is replacing AT.EXE), see:
http://en.wikipedia.org/wiki/At_%28Windows%29[^],
http://en.wikipedia.org/wiki/Schtasks[^],
http://technet.microsoft.com/en-us/library/bb490866.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357%28v=vs.85%29.aspx[^].

And you also can use Window Task Scheduler API, please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383608%28v=vs.85%29.aspx[^].

To see how can you use it with .NET, see this CodeProject article: A New Task Scheduler Class Library for .NET[^].

—SA


到显示屏幕的表单中心,在构造函数中的设计计时器on上将Forms StartPosition属性设置为 CenterScreen
To display your Form center of the screen, set the Forms StartPosition property as CenterScreen on design timer on in your constructor.


这篇关于我想在计时器完成时弹出我的表格,如消息框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆