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

stretching components upon a user-window-resize action

In a Windows Form application, when a user resizes the window, I typically
want different components in the form to take different actions. For
example, a text box in the middle should grow with the window; a button
panel at the bottom should remain the same height but re-center
horizontally; etc.

What I have settled on as a technique for managing this is to start witha
table container (dock=fill), then by combining rowspans, columnspans, and
absolute vs percentage row/column sizes, I can achieve fine control over
layout when the form is resized. I am just wondering if that is considered
a good approach or if there is a different Best Practice for this?
Nov 13 '06 #1
4 2435
"michael sorens" <m_********@community.nospamwrote in
news:op***************@spo-cont-2-dt.itron.com:
What I have settled on as a technique for managing this is to start
with a table container (dock=fill), then by combining rowspans,
columnspans, and absolute vs percentage row/column sizes, I can
achieve fine control over layout when the form is resized. I am just
wondering if that is considered a good approach or if there is a
different Best Practice for this?
Have you tried using anchors + docks?
Nov 13 '06 #2
No, I had not tried anchors. I can see they provide some good tools for
this as well.
Nov 14 '06 #3
Hi Michael,

I think your solution of using TableLayoutPanel control is perfect. In
fact, TableLayout is a new control shipped with VS 2005 and is designed to
rearrange the controls on the form when the form is resized.

Before the TableLayoutPanel control is available, we usually make use of
the Anchor or Dock property of the control to rearrange it when the form is
resized.

Anchoring a control to its parent control ensures that the anchored edges
remain in the same position relative to the edges of the parent control
when the parent control is resized. In your scenario, you could set the
Anchor property of the textbox to Left and Right.

Control's Dock property gets or sets which control borders are docked to
its parent control and determines how a control is resized with its parent.

Use the Dock property to define how a control is automatically resized as
its parent control is resized. For example, setting Dock to DockStyle.Left
causes the control to align itself with the left edges of its parent
control and to resize as the parent control is resized.

Note that the Anchor and Dock properties are mutually exclusive. Only one
can be set at a time, and the last one set takes precedence.

Hope this helps.
If you have anything unclear, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 14 '06 #4
Thank you, Linda, for some good pointers!
Nov 17 '06 #5

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

Similar topics

0
by: tzellman | last post by:
Before I ask for help, let me give you my situation, including what I HAVE been able to do. I am trying to show an image (large, say the whole screen), and allow for instantaneous visual results...
22
by: Kim Scarborough | last post by:
Say I wanted to put a couple lines of asterisks between paragraphs, and have it stretch the spaces so that it spanned 100% of the text-width, like this: * * * * * ...
2
by: John | last post by:
Hi, I have a data driven application which has some generalized components. So, for reuse, I am building the components so they can be reused in other projects ... it takes almost no extra...
3
by: yawnmoth | last post by:
in firefox, long strings without spaces cause a horozontal scrollbar to appear at the bottom of any given textarea. for example, if your textarea supports 50 characters, and 100 consecutive...
1
by: Ellis Yu | last post by:
Dear all, I write my own components for my project and add them in "My User Control" under the toolbar. Some time later, I make some other new components into it and want to use them in my...
1
by: Dave | last post by:
When I create a new form a private member System.ComponentModel.Container components is created, and appears to be passed to the constructors of various things like timers. Can someone explain to...
0
by: Mike | last post by:
I have a detailview, with several template columns in it. It's setup so that a user views info from a datagrid, and if they want to add another row, they click a button. The button causes a...
4
by: Arthur Dent | last post by:
Hello all... i have a really frsutrating problem here... This is only happening in IE (6 & 7b2), Mozilla and Netscape are both OK. I have a top-level table with a width of 760px, so it should be...
14
by: rsearing | last post by:
I am new to HTML and will have to beg if this is obvious, but I am trying to design a table that looks like: ******************************** *----A------*------------------------*...
5
Ali Rizwan
by: Ali Rizwan | last post by:
Hi all, I m stretching my form and i want if i stretch its position after stretching must be in middle of screen or i want to stretch centerly. Thanx >> ALI <<
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.