473,385 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

override Size property form a User Control?

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

Nov 16 '05 #1
2 7723
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Michel Walsh" <vanderghast@VirusAreFunnierThanSpam> wrote in message
news:OG**************@TK2MSFTNGP09.phx.gbl...
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

Nov 16 '05 #2
Hi,
That sounds good, indeed. Thanks.
Vanderghast, Access MVP
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2***************@tk2msftngp13.phx.gbl...
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kelly Domalik | last post by:
I would like to override the "disabled" property of a hidden field. When disabled is set to "true", it would call a function to disable 2 other text fields on the form. When disabled is set to...
3
by: Richard | last post by:
I have a requirement to put a GDI style circle or rectangle border around the selected row of a datagrid/ It will overlap into the row above and below the selected row. Doing this in a the OnPaint...
4
by: JMUApache | last post by:
Hi, A have a problem with Inhreit Control. I try to Change its Size in Construct Function, And it works. Code Here: -------------------------------------------------- public class...
4
by: Zuel | last post by:
Hi Folks. So I have a small problem. My DoPostBack function is not writen to the HTML page nor are the asp:buttons calling the DoPostBack. My Goal is to create a totaly dynamic web page where...
3
by: John Hughes | last post by:
I'm trying to add a user control to a form via the pages render method and I get the following error : "Control 'Button1' of type 'Button' must be placed inside a form tag with runat=server" ...
2
by: David Veeneman | last post by:
I'm having trouble implementing a UserControl base property in a user control that I am writing. My user control wraps a group box that contains several radio buttons. I want to wire the user...
14
by: Galen Somerville | last post by:
My current screen resolution is set to 1024 x 768. My form size always comes up as 1032 x 748. I have tried the help sample ' Retrieve the working rectangle from the Screen class ' using the...
1
by: Joshua | last post by:
I'm creating a web control that has an image and a text box. I would like to then override the Visible and Text property of the usercontrol, so when you reference the visible property of the user...
4
by: Hamed | last post by:
Hello I have a UserControl sized to 100; 200 When I drop it in my form the initial size is 100;200 (as I prefer). Then I decided to change the size of my UserControl to 200;200 but although I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.