RE: Autosizing and column spanning conundrum

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.

.



Relevant Pages

  • Modeling the condition code register in register allocation
    ... model the condition code register properly. ... IF d GOTO label1 ELSE GOTO label2 ... e' -> %rsi ...
    (comp.compilers)
  • Re: forward references, was [Re: incremental assembly]
    ... Does this C code qualify as structured code or spaghetti code? ... the same issues as the assembly code above ... ...
    (comp.lang.asm.x86)
  • Re: Wecker
    ... Will einen Wecker machen. ... Timer der jede Sekunde tickt. ... in Label1 kann man die Stunden und in Label2 die Minuten eingeben, ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: Wecker
    ... Timer der jede Sekunde tickt. ... in Label1 kann man die Stunden und in Label2 die Minuten eingeben, ... Nur dass man in Labels nichts eingeben kann. ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: ARM assembler: labels
    ... PK> Typically label1 and label2 would be descriptive names. ... PK> Look at the code where you have the branch/jump instruction to ... PK> label names, although the error handler code is common. ...
    (comp.arch.embedded)