Anchored controls won't resize when window is resized (56k beware)?

I have found that setting one disables the other. I would look in the . Designer.Cs file and see if both dock and anchor properties are being set, and maybe even remove the proprties from the source (back up beforehand, of course) Another thing I usually try is to recreate the form in a separate, new form and see if I get the same results.

I have found that setting one disables the other. I would look in the . Designer.Cs file and see if both dock and anchor properties are being set, and maybe even remove the proprties from the source (back up beforehand, of course).

Another thing I usually try is to recreate the form in a separate, new form and see if I get the same results.

See my edit: All controls that are instantiated for this page are docked, however the child controls of a UserControl used on the form are anchored. Mixing them this way wasn't a problem in the main form. – KeithS Nov 12 '10 at 16:33 @KeithS: Ok, I meant the same control having both an anchor and a dock property set usually does not work.

Can you do something to determine which control is not resizing? For example, setting a background color in a container or something similar that will tell you at runtime which container is resizing and which is not? – Gabriel Magana Nov 12 '10 at 16:37 @gmagna: I get ya; no, none of the controls have both a dock and an anchor property set.

I'll post printscreens once I sanitize them (can't show the entire world the search results), and I'll try the background color trick. – KeithS Nov 12 '10 at 16:41 @KeithS: Also, what happens when you make the form smaller than the content? When you make it larger it doesnot resize, but when you make it smaller what happens?

Do you get scroll bars, or is it simply cut off? I went through a global "form cleansing" recently in a large project, so I feel your pain. – Gabriel Magana Nov 12 '10 at 16:43 @The initial form size is set to its minimum size, however if I resize the form to be bigger than the set minimum in design, the controls won't shrink when I make the window smaller in-app.

– KeithS Nov 12 '10 at 16:50.

Epic Facepalm. In the constructor of this form (user code side), I called SuspendLayout() to perform some additional setup that may affect the layout. Guess what I DIDN'T call when I was done.

If you call SuspendLayout to do your own custom layout changes, always be sure to call ResumeLayout(true) (or ResumeLayout(false) followed by PerformLayout()) when you're done.

LOL Never fails... Glad you got it working – Gabriel Magana Nov 12 '10 at 19:25.

I've had issues with usercontrols not doing what I expect in the way your describing it might be something to do with the usercontrol autoscalemode property set to 'font' -Try Changing it to inherit.

Do not dock or anchor individual controls inside a TableLayoutPanel. That rarely does what you want.

Do not set DockStyle = Fill for them either. – Joshua Nov 12 '10 at 17:48 More info needed; what I want is for the controls to take up as much space as they are given by the cell(s) in the TLP, and to have them stretch and shrink with the form. That means I either dock them, anchor them, or roll my own resize logic in the form's Resize event handler.

Filling out a fill-docked TLP with fill-docked controls and using the TLP to govern which controls can stretch/shrink, and how, worked perfectly in another form I created for the same app; why shouldn't it work here? – KeithS Nov 12 '10 at 18:00 I found the most effective way is to lose the TableLayoutPanel, create all the controls directly on the form, and use Anchors to define how to behave when the user stretches the form. – Joshua Nov 12 '10 at 23:18.

Try setting Dock = DockStyle. Fill on the container of the TableLayoutPanel. Worked for me, David.

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. 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.

I did use my Google-fu, and found this SO question which pointed me to this MSKB article. 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).

There are no MaxSize properties set. 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).

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. Resize events are fired for the form, but not the TLP.

The behavior does not change when the TLP is anchored to the window INSTEAD of being Docked (it's never both at once). I'm tearing my hair out here. 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.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions