473,395 Members | 1,720 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,395 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 2441
"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 <<
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:
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.