Note that there are some explanatory texts on larger screens.

plurals
  1. POAnchored controls won't resize when window is resized (56k beware)
    text
    copied!<p>This one's really kicking my backside. I have a form, spawned and owned by the main form of the application, that is used for searching records. The form is laid out in a docked TableLayoutPanel, with a combination of Absolute and Percentage-sized rows/columns so that my labels stay the same size while the data entry and results controls grow. We're talking about 20 controls all told.</p> <p>The problem is that, although the TableLayoutPanel is fill-docked, and all child controls are also fill-docked, nothing is resizing inside the form when I grab the window edge and drag. Everything resizes just fine in the designer, but not in the actual app.</p> <p>I did use my Google-fu, and found <a href="https://stackoverflow.com/questions/2176426/c-anchored-panel-wont-resize-properly">this SO question</a> which pointed me to <a href="http://support.microsoft.com/kb/953934" rel="nofollow noreferrer">this MSKB article</a>. I created a derived FlowLayoutPanel and a derived TableLayoutPanel with the threaded calls and put them in, but it's still not working. This is the ONLY form on which this is happening, and another form has some pretty deep nesting as well (it uses a TabControl and TableLayoutPanel to layout the data entry controls, but no RBs). </p> <p>Other pertinent info:</p> <ul> <li>There are no MaxSize properties set.</li> <li>Nothing is anchored in this form except for the default Top-Left; pretty much everything is fill-docked to its container. However, a child user control containing the search results table is laid out internally using anchoring; this hasn't been a problem in the other form in which I use these controls, where I've fill-docked them to SplitPanels (nested two deep, no less).</li> <li>RadioButtons and Labels are set to AutoSize, but nothing else is. This seems to be the default behavior for these controls even though the values are bolded in the Designer, and matches the setup of other windows that resize properly.</li> <li>Resize events are fired for the form, but not the TLP.</li> <li>The behavior does not change when the TLP is anchored to the window INSTEAD of being Docked (it's never both at once).</li> </ul> <p>I'm tearing my hair out here. Help!</p> <p><strong>Edit</strong>: Here are some of the requested pictures showing layout behavior in the designer and in-app:</p> <p><img src="https://i.stack.imgur.com/6Ppsz.png" alt="alt text"> <img src="https://i.stack.imgur.com/m83zX.png" alt="alt text"> <img src="https://i.stack.imgur.com/P07Aa.png" alt="alt text"> <img src="https://i.stack.imgur.com/atkPs.png" alt="alt text"></p> <p>The controls that begin with "Nested" derive directly from the built-in panel controls, and their only change is an override of OnSizeChanged() to call the base method asynchronously (the workaround from the KB article). It doesn't work with the built-in panels either, as I said before. As you can see from the last two windows, the mainLayout TLP simply does not grow even though it's docked to the window in the designer.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload