用户计时器

编程入门 行业动态 更新时间:2024-10-27 02:17:56
本文介绍了用户计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好, 我只是想知道如何在课堂上使用System.Windows.Forms.Timer。我知道如何在表格上使用它,但我不知道如何放表格。 类(DLL)中的计时器 Thx !!!

解决方案

"马修" <毫安************* @ videotron.ca> schrieb

我只是想知道如何在类中使用System.Windows.Forms.Timer。我知道如何在表单上使用它,但我不知道如何在类(DLL)中放置一个计时器

背后没有任何神秘感。 :-)表单设计器只为你生成一行 : Private WithEvents MyTimer As New System.Windows.Forms.Timer 在其他课程中你可以自己写这行。 你可能会考虑让你的课成为一个组件,所以组件设计师 将可用,您可以在设计器上放置一个Timer。详细信息: http:// msdn.microsoft/library/en...tAuthoring.asp msdn.microsoft/library/en...essentials.asp 除了为什么你在课堂上需要这样的计时器?计时器应该只在UI(用户界面)上下文中使用。 - Armin www.plig/nnq/nquote。 html wwwmeister /news/learn2quote.html

" Mathieu" <毫安************* @ videotron.ca> schrieb

我只是想知道如何在类中使用System.Windows.Forms.Timer。我知道如何在表单上使用它,但我不知道如何在类(DLL)中放置一个计时器

背后没有任何神秘感。 :-)表单设计器只为你生成一行 : Private WithEvents MyTimer As New System.Windows.Forms.Timer 在其他课程中你可以自己写这行。 你可能会考虑让你的课成为一个组件,所以组件设计师 将可用,您可以在设计器上放置一个Timer。详细信息: http:// msdn.microsoft/library/en...tAuthoring.asp msdn.microsoft/library/en...essentials.asp 除了为什么你在课堂上需要这样的计时器?计时器应该只在UI(用户界面)上下文中使用。 - Armin www.plig/nnq/nquote。 html wwwmeister /news/learn2quote.html

Mathieu, 您可以在班上使用此代码: --------------------------- Private Withevents mTimer as New System.Windows.Forms.Timer 私有子TimerTickedHandler(发件人作为对象,e作为EventArgs)处理 mTimer.Tick ''处理计时器勾选 结束子 ------------------------- - 你需要在课堂上添加代码来启用/禁用计时器。 我建议你看看在其他计时器(System.Timers.Timer和 System.Threading.Timer)因为它们提供的功能比Windows窗体计时器的功能要多一些,但使用时需要一点小心 windows表格,因为他们的活动可以在不同的线程上筹集。 希望这会有所帮助, Trev。 " Mathieu" <毫安************* @ videotron.ca>在消息中写道 新闻:ej ************** @ TK2MSFTNGP10.phx.gbl ...

大家好, 我只是想知道如何在课堂上使用System.Windows.Forms.Timer。我知道如何在表格上使用它,但我不知道如何放表格类中的计时器(DLL) Thx !!!

Hi all, I just want to know how to use a System.Windows.Forms.Timer in class. I know how to use it on a form, but I don''t know how to "put" a timer in a class (DLL) Thx !!!

解决方案

"Mathieu" <ma*************@videotron.ca> schrieb

I just want to know how to use a System.Windows.Forms.Timer in class. I know how to use it on a form, but I don''t know how to "put" a timer in a class (DLL)

There is no mystery behind. :-) The Form designer just generates one line for you: Private WithEvents MyTimer As New System.Windows.Forms.Timer In other classes you can write this line on your own. You might consider make your class a component, so the component designer will be available and you can drop a Timer on the designer. Details: msdn.microsoft/library/en...tAuthoring.asp msdn.microsoft/library/en...essentials.asp Apart from this, why do you need such a timer in a class? The timer should only be used in a UI (user interface) context. -- Armin www.plig/nnq/nquote.html wwwmeister/news/learn2quote.html

"Mathieu" <ma*************@videotron.ca> schrieb

I just want to know how to use a System.Windows.Forms.Timer in class. I know how to use it on a form, but I don''t know how to "put" a timer in a class (DLL)

There is no mystery behind. :-) The Form designer just generates one line for you: Private WithEvents MyTimer As New System.Windows.Forms.Timer In other classes you can write this line on your own. You might consider make your class a component, so the component designer will be available and you can drop a Timer on the designer. Details: msdn.microsoft/library/en...tAuthoring.asp msdn.microsoft/library/en...essentials.asp Apart from this, why do you need such a timer in a class? The timer should only be used in a UI (user interface) context. -- Armin www.plig/nnq/nquote.html wwwmeister/news/learn2quote.html

Mathieu, You can use this code in your class: --------------------------- Private Withevents mTimer as New System.Windows.Forms.Timer Private Sub TimerTickedHandler(sender as object, e as EventArgs) handles mTimer.Tick '' Handle the timer tick End Sub --------------------------- You''ll need to add code to your class to enable/disable the timer. I suggest you have a look at the other timers (System.Timers.Timer and System.Threading.Timer) as they provide a little bit more functionality than the Windows Forms timer, but need a little bit of care when using with windows forms as their events can be raised on different threads. Hope this helps, Trev. "Mathieu" <ma*************@videotron.ca> wrote in message news:ej**************@TK2MSFTNGP10.phx.gbl...

Hi all, I just want to know how to use a System.Windows.Forms.Timer in class. I know how to use it on a form, but I don''t know how to "put" a timer in a class (DLL) Thx !!!

更多推荐

用户计时器

本文发布于:2023-11-09 06:21:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571613.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:计时器   用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!