我有一个表单,它基于我拥有的另一种标准表单(支持透明度的表单),它在运行时通过自己的类型标识自己。然而,在设计器中,我设置了一些消息框输出,它们在设计时显示它在设计器控件堆栈的顶部标识为父类型。
示例代码
Public Class SpecificForm
Inherits GenericForm
Implements IUsefulInterface
...
End Class
Public Class GenericForm
Inherits System.Windows.Forms.Form
...
End Class
我在表单上有控件,可以让他们的父母知道如何正确绘制。在运行时它可以正常工作,因为特定类型实现了一个携带绘图信息的接口。骑自行车穿过父母产量
"Control1" As System.Windows.Forms.Control, parented by
"MainForm1" As SpecificForm, parented by
Nothing
作为设计时间,尽管在父母之间循环会产生
"Control1" As System.Windows.Forms.Control, parented by
"MainForm1" As GenericForm, parented by
"" As System.Windows.Forms.Design.DesignerFrame+OverlayControl, parented by
"" As System.Windows.Forms.Design.DesignerFrame, parented by
"" As System.Windows.Forms.Control, parented by
Nothing
在运行时 MainForm 标识为 SpecificForm 类型,在设计时由设计器托管是可以理解的,但它现在标识为 GenericType。