本文整理汇总了VB.NET中System.Windows.Forms.MethodInvoker代理的典型用法代码示例。如果您正苦于以下问题:VB.NET MethodInvoker代理的具体用法?VB.NET MethodInvoker怎么用?VB.NET MethodInvoker使用的例子?那么恭喜您, 这里精选的代理代码示例或许可以为您提供帮助。
在下文中一共展示了MethodInvoker代理的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: New
Partial Public Class Form1
Inherits System.Windows.Forms.Form
Public Sub New()
' Create a timer that will call the ShowTime method every second.
Dim timer As System.Threading.Timer = _
New System.Threading.Timer(AddressOf ShowTime, Nothing, 0, 1000)
End Sub
Sub ShowTime(ByVal x As Object)
' Don't do anything if the form's handle hasn't been created
' or the form has been disposed.
If (Not Me.IsHandleCreated OrElse Me.IsDisposed) Then Return
' Create the method invoker.
' The method body shows the current time in the forms title bar.
Dim mi As MethodInvoker = AddressOf UpdateFormText
Me.Invoke(mi)
End Sub
Sub UpdateFormText()
Me.Text = DateTime.Now.ToLongTimeString()
End Sub
End Class