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

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



C# Programming
03-30-2009, 07:00 AM
I'm building a custom control inherited from a picturebox control, and I would like it to automatically resize to the dimensions of the container control to which it is added(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?

modified on Sunday, March 29, 2009 10:43 PM