override Size property form a User Control?

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
 
N

Nicholas Paldino [.NET/C# 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top