RE: Autosizing and column spanning conundrum
- From: v-lliu@xxxxxxxxxxxxxxxxxxxx (Linda Liu[MSFT])
- Date: Thu, 24 Jul 2008 08:08:19 GMT
Hi Michael,
I performed a test based on your sample code and did see the problem on my
side.
If I set the column span of both the label1 and the label created at run
time to 1, the problem doesn't exist.
To observe results more clearly, I set the BackColor of the label1 to the
color of ActiveCaption and set the Dock property of the label1 to None. To
isolate the problem, I copy the label1 and paste it to the row 1 of the
TableLayoutPanel and the new Label named label2. Attach the label1_Click
event handler to the Click event of the label2 and modify it as follows:
private void label1_Click(object sender, EventArgs e)
{
(sender as Label).Text += ' ' + word[iteration++ % word.Length];
if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
AddRow((sender as Label).Text);
}
Run the application and resize the form to its minimum width with the Mouse
and then click the label2 for several times. I see that the label2 extends
with its text and the form extends as well. But there's a space between the
right border of the label2 and that of the TableLayoutPanel, i.e. the
label2 doesn't use up the entire space of the row 1.
So it seems that the TableLayoutPanel doesn't calculate the expected space
very accurately when the hosted controls span more than 1 column in the
above case. I think this behavior is by design.
Normally, we only make those controls whose sizes won't change at run time
span more than 1 column within a TableLayoutPanel.
Hope this helps.
If you have any question, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
.
- References:
- Autosizing and column spanning conundrum
- From: michael sorens
- Autosizing and column spanning conundrum
- Prev by Date: Re: Do we have extention properties in C# 3.0?
- Next by Date: Re: Do we have extention properties in C# 3.0?
- Previous by thread: Autosizing and column spanning conundrum
- Next by thread: RE: Autosizing and column spanning conundrum
- Index(es):
Relevant Pages
|