''' <summary> ''' 函数返回Key,添加的新的标签页控件的哈希值,不能够跨线程添加控件 ''' Dynamics add a tabpage control on the form ''' </summary> ''' <returns></returns> ''' <remarks></remarks> Public Function Add(Control As Control) As Integer Dim Panel As PagePanel = New PagePanel ControlToAdd = Panel SyncLock ControlToAdd Call _InternalForm.Invoke(New MethodInvoker(AddressOf AddControlInvoke)) ControlAddToPanel = Control SyncLock ControlAddToPanel Call ControlToAdd.Invoke(New MethodInvoker(AddressOf PanelAddControlInvoke)) ' !!! The code stuck running at here. End SyncLock End SyncLock Call Panel.Controls.Add(Control) Control.Dock = DockStyle.Fill Dim Key As Integer = Panel.GetHashCode() Call Add(Key, Panel) Call [Select](Panel) Return Key End Function Dim ControlToAdd As PagePanel Dim ControlAddToPanel As Control Private Sub PanelAddControlInvoke() Call ControlToAdd.Controls.Add(ControlAddToPanel) End Sub Private Sub AddControlInvoke() Call _InternalForm.Controls.Add(ControlToAdd) End Sub
control.BeginInvoke(...);
control.Dispatcher.BeginInvoke(...);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)