读书人

帮看看这段代码什么意思小弟我看了几

发布时间: 2012-08-13 13:21:53 作者: rapoo

帮看看这段代码什么意思,我看了几天不明白

VB.NET code
 ....这个类以上内容无关   Private fModule As ControlPublic ReadOnly Property TModule() As Control            Get                If Me.fModule Is Nothing Then                    Dim constructorInfoObj As ConstructorInfo = fType.GetConstructor(Type.EmptyTypes)                    If constructorInfoObj Is Nothing Then                        Throw New ApplicationException(fType.FullName + " doesn't have public constructor with empty parameters")                    End If                    Me.fModule = constructorInfoObj.Invoke(Nothing)                End If                Return Me.fModule            End Get        End Property    End Class

这个方法是什么意思,这是devexpress中的一个demo中的代码

VB.NET code
  //后面的例子中。。调用它的地方我打了红色Public Shared Sub ShowModule(ByVal container As Control, ByVal fName As String)            Dim item As ModuleInfo = ModulesInfo.GetItem(fName)            Dim currentCursor As Cursor = Cursor.Current            Cursor.Current = Cursors.WaitCursor            If Not container.Parent Is Nothing Then                container.Parent.SuspendLayout()            End If            container.SuspendLayout()            Try                Dim oldModule As Control = Nothing                If Not Instance.CurrentModuleBase Is Nothing Then                    oldModule = [color=#FF0000]Instance.CurrentModuleBase.TModule[/color]                End If                Dim fModule As Control = IIf(TypeOf item.TModule Is Control, CType(item.TModule, Control), Nothing)                fModule.Bounds = container.DisplayRectangle                Instance.CurrentModuleBase = item                fModule.Visible = False                container.Controls.Add(fModule)                fModule.Dock = DockStyle.Fill                fModule.Visible = True                If Not oldModule Is Nothing Then                    oldModule.Visible = False                End If            Finally                container.ResumeLayout(True)                If Not container.Parent Is Nothing Then                    container.Parent.ResumeLayout(True)                End If                Cursor.Current = currentCursor            End Try            Instance.RaiseCurrentModuleChanged()        End Sub




[解决办法]
探讨

GetConstructor
搜索其参数与指定数组中的类型匹配的公共实例构造函数
判断是否有没有空参数的公共构造函数

读书人网 >VB Dotnet

热点推荐