override Size property form a User Control?

  • Thread starter Thread starter Michel Walsh
  • Start date Start date
M

Michel Walsh

Hi,

In a User Control, where anchoring or docking embedded controls is not
appropriate, is there a way to override Size? My naive approach generates
an infinite loop... well, I imagine since I get a stack overflow:


public new Size Size
{
get
{
return this.Size;
}
set
{

base.Size=value; // trivial problem here.

this.embeddedControl1.Size = ...
...
}
}


I noted that Size is NOT in the overrides... is the problem linked to,
somehow, Size is itself a "computed" property and I should attack another
method/property instead?



Vanderghast, Access MVP
 
Michel,

The method that you want to be called is SetBoundsCore, which is a
protected method. It is called when the size or the location changes. The
BoundsSpecified parameter indicates what has been changed, or is changing.

Hope this helps.
 
Back
Top