The parent's InitializeComponent
should be called by having your constructor call base()
like this:
public YourFormName() : base()
{
// ...
}
(Your parent Form should have a call to InitializeComponent
in its constructor. You didn't take that out, did you?)
However, the road you're going down isn't one that will play nicely with the designer, as you aren't going to be able to get it to instantiate your form at design time with those parameters (you'll have to provide a parameterless constructor for it to work). You'll also run into issues where it assigns parent properties for a second time, or assigns them to be different from what you might have wanted if you use your parametered constructor in code.
Stick with just having the properties on the form rather than using a constructor with parameters. For Forms, you'll have yourself a headache.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…