本文整理匯總了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