Z
Zürcher See
The Control class has the Parent property that is readonly.
When the control is added to a controls collection of another control the
Parent property refers to that control.
"Who" set the Parent property? How to implement this "mechanism"?
public abstract class MyControl
{
private MyControl parent;
public MyControl Parent{get{return this.parent;}}
private MyControlCollection controls;
public MyControlCollection Controls{get{return controls;}}
}
public class MyControlCollection : ArraList
{
protected new int Add(object value){return base.Add(value);}
public virtual Add(MyControl control)
{
//I think here schould be set the parent property, but how???
return this.Add(control);
}
}
Any help will be appreciated , thanks
When the control is added to a controls collection of another control the
Parent property refers to that control.
"Who" set the Parent property? How to implement this "mechanism"?
public abstract class MyControl
{
private MyControl parent;
public MyControl Parent{get{return this.parent;}}
private MyControlCollection controls;
public MyControlCollection Controls{get{return controls;}}
}
public class MyControlCollection : ArraList
{
protected new int Add(object value){return base.Add(value);}
public virtual Add(MyControl control)
{
//I think here schould be set the parent property, but how???
return this.Add(control);
}
}
Any help will be appreciated , thanks