C#. I'm filling a panel with controls such that a scrollbar comes up. When the scrollbar shows up, I would like the controls (anchored top|left|right) to resize so they aren't covered by the scrollbar. If I make the form bigger and then smaller again, they resize properly, but I don't know how to make them do this sizing when the scrollbar shows up.
A:
There doesn't seem to be an event for this. However, you could override the form's virtual AdjustFormScrollbars method in order to detect if a change has occurred.
Nicole Calinoiu
2009-10-29 19:18:23
Well, I can tell when the scroll bar shows up. I just don't know what to call to have the controls in the panel (not form) adjust their size.
Daniel Straight
2009-10-29 19:41:38
In my tests, anchored controls are resized automatically when a scroll bar is added. Could you please provide a sample that behaves as you describe? Also, on what version of the .NET Framework are you running?
Nicole Calinoiu
2009-10-30 15:08:11