473,508 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

control Size problem

Hi all,

I faced a weird problem and can't figure if this is a bug in framework 2.0
or I am just doing something totally wrong, maybe you guys can suggest
something.

I have a class inherited from System.Windows.Forms.Panel that adds a control
that has been passed to it to its collection of controls:

class SlidePanel : Panel

{

internal SlidePanel(Control _inner)

{

this.Controls.Add(_inner);

}

}

I figured that once some contolrs are added, they will change their size
(checkBoxList and ListBox) do this. For example, if I create a
checkedListBox with size(160,100), it will appear as (160,85).

Now, what happens is once the _inner is added, it will not reset its Size
attribute to the real size as it is on the form and remain 100. But, when I
put a break somewhere after adding the control to controls collection, and
navigate through the properties etc it will do this and the size will appear
correctly.

What I tried is this:

put a break somewhere after this.Controls.Add(_inner) and in the
intermediate window look at these properties:

_inner.Height (will return 100)

this.Controls[0].Height (I add only one and Controls.Count returns 1, so I
know I am looking at the same thing) will return 85.

I tried getting the Size via int sizeH = this.Controls[0].Height; but this
does not return the proper value anyway.

When I break on this line and browse through properties etc it will reset
the value tho.

Weird thing, does someone has an explanation to this?


Sep 5 '05 #1
0 884

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

Similar topics

13
2055
by: Will Pittenger | last post by:
I have a Control derived class. When the parent of the control changes the control's Location property, the stack overflows. I have not found a way to find out what was on the stack when it does...
13
1170
by: Will Pittenger | last post by:
I have a Control derived class. When the parent of the control changes the control's Location property, the stack overflows. I have not found a way to find out what was on the stack when it does...
13
252
by: Will Pittenger | last post by:
I have a Control derived class. When the parent of the control changes the control's Location property, the stack overflows. I have not found a way to find out what was on the stack when it does...
8
3005
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
15
6474
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
0
7326
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
7385
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...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.