Based on my understanding of your problem, you could probably implement the ISupportInitialize interface on your custom control.
This would allow your control code to be called by the InitializeComponent() method of your Form.
For example, this simple user control deriving from Button:
class MyButton : Button, ISupportInitialize
{
public void BeginInit()
{
var parent = this.TopLevelControl;
}
public void EndInit()
{
var parent = this.TopLevelControl;
}
}
When placed on a Form, the designer code will look like this:
private void InitializeComponent()
{
this.myButton1 = new Quartz1.MyButton();
((System.ComponentModel.ISupportInitialize)(this.myButton1)).BeginInit();
this.SuspendLayout();
//
// myButton1
//
this.myButton1.Location = new System.Drawing.Point(371, 338);
this.myButton1.Name = "myButton1";
this.myButton1.Size = new System.Drawing.Size(75, 23);
this.myButton1.TabIndex = 4;
this.myButton1.Text = "myButton1";
this.myButton1.UseVisualStyleBackColor = true;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1012, 440);
this.Controls.Add(this.myButton1);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.myButton1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
As you can see, once the Form initialization is done, EndInit() is called on your control. At this point this.TopLevelControl
will not be null.
I'm not sure whether this is what you're looking for, if not please don't hesitate to add more context to your question.
Cheers