473,396 Members | 1,933 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,396 software developers and data experts.

Sizing problem for controls

Hi guys,

here is another freaky thing that kind of bugs a lot. Maybe someone has
ideas to this. We have a sort of a "dynamic" interface builder that will
take a control schema and place the controls into a TableLayoutPanel control
with pre-created rows and columns. All row and columns styles are set to
AutorSize SizeType.

What happens is even though the TableLayoutPanel AutoSize property is set to
true and its AutoSizeMode to GrowAndShrink, it will not grow enough to show
the full control inside a cell.

The whole thing looks bit messy: a Panel with a couple of cells with
TabbedControl, then TableLayoutPanel inside of it with a few GroupBox
controls that will contain TableLayoutPanels as well.

What I tried to do is this bit of code:

protected void setSize(Control ctrl)
{
if (!ctrl.Created)
{
ctrl.CreateControl();
}
foreach(Control cc in ctrl.Controls)
{
if (!cc.Created)
{
cc.CreateControl();
}
if (cc.Controls.Count > 0)
{
cc.AutoSize = false;
cc.Size = cc.PreferredSize;
}
setSize(cc);
}
}

A simple recursion that will run through all the controls all try to set
their Size property to equal PrefferedSize property.

The funny thing, again, is that once this is executed:

cc.Size = cc.PreferredSize;

the Size will not change to equal the PrefferedSize property.

How can this be possible? Can it be something like the parent control sort
of "holding" the children size and change it back once it was changed
somewhere?

Please advide, I am about to run into a wall and nock myself out.
Link
Nov 17 '05 #1
0 1269

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

Similar topics

53
by: Andrew Poulos | last post by:
I've got some CSS that looks like this: body { margin: 0; font-family: Arial, Helvetica, sans-serif; font-size: 140.01%; color: #000000; } but IE won't apply the font size to text in table...
2
by: ichor | last post by:
hi i am developing a c# app and i want that when i size the form the controls should also be automatically sized. thanx
4
by: Tim Marsden | last post by:
Hi I would like to add controls to my page at runtime. What containers can I use to host the controls? I know I can add them to the form controls collection, but I need to have control on where...
9
by: Max | last post by:
Hello, Using VB.NET, I can activate an application by entering: AppActivate(intProcessID), where intProcessID is the process ID of a running application. Is it possible to set the size and...
2
by: Sean | last post by:
Is there a way to determine the size of the useable area of a tab control? I'm trying to create a Panel on the fly to place controls in (so it is scrollable), but the Tab Pages are all created on...
1
by: Alan M Dunsmuir | last post by:
I have a VB.NET Windows Forms application which uses as a splash screen a Form which I want to cover, exactly and entirely, with a specified ..jpg PictureBox. So I specified the Form, the...
4
by: kaosyeti | last post by:
what's the best way to get a form to always open at a specific size. i've sized and saved the forms, changed the borders and had popup on and off all over but can't seem to get it to stay one way...
5
by: lamxing | last post by:
Hi, I've come across a strange problem with the WinForm's sizing. I've designed a WinForm and it runs fine on my computer and some other PCs. But when I was trying to run the app under some PCs...
2
by: John B | last post by:
Hi all, I want to prevent the user being able to vertically size a control, in the same manner that single line textbox and autosize labels do. I can override SetBoundsCore which prevents the...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.