المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : When Adding A Control, what events fire?



C# Programming
03-30-2009, 03:41 AM
I'm building a custom control inherited from a picturebox control, and I would like it to automatically resize to the dimesions of the container control it is added to (could be any valid container control)

Referencing the Parent of the custom control in its structure definition

Public MycustomePicBox()
{
this.Size=new System.Drawing.Size(this.Parent.Clientrectangle....
}

isn't possible because at the time the code executes, the custom control hasn't been added to the container control yet.

Is there an event that fires for a Control when it has been added to a container?