在我的 WinForms 项目(VS2010,.NET 4.0)中,我有一个名为 的用户控件MyView
,它是从System.Windows.Forms.UserControl
. 然后我将此控件修改为通用用户控件:
Partial Class MyView(Of TEntity As {New, Class})
Inherits System.Windows.Forms.UserControl
' source code here
End Class
不幸的是,VS Winforms Designer 自动生成的InitializeComponent()
代码带有 vb.net 语法错误并产生编译错误:
Dim resources As System.ComponentModel.ComponentResourceManager =
New System.ComponentModel.ComponentResourceManager(GetType(MyView))
而不是上面的代码行,应该有:
Dim resources As System.ComponentModel.ComponentResourceManager =
New System.ComponentModel.ComponentResourceManager(GetType(MyView(Of TEntity)))
如何修复 VS2010 WinForms Designer 的这种行为?