Panels keep resizing themselves

Marilee

Newcomer
Joined
May 20, 2011
Messages
6
Location
South Africa
I have an annoying problem. I have tried everything I could think of and anything google gave me and nothing is working.

I have a form in a split panel. It contains panels and the panels contain the labels and text boxes. I carefully resize and move the text boxes and labels, save. When I open the form again or run the application the panels and textboxes has resized iteself to be squished up and moved some of the labels underneath the text boxes.

This is driving me insane. Please help.
 
I don't think this is the problem, but try setting the AutoScaleMode property to None. That's the only thing I can come up with off the top of my head.

It's hard to say whether the problem is related to the designer, code generation, or your own code. What I might do is add an event handler for the SizeChanged event and set a breakpoint within. Run the program, and when the breakpoint is triggered, look through the call stack and see where the property is being set.
 
I don't know what to do anymore. It's not when it runs it seems. It's just disregarding my changes. If I save and close the form and open it again, it's jumped all over the place again.

Can't be anything in the code as it did it before any code was added.

I've tried it in a normal panel, in a table, in no panel and it still bounces around. This project had to be done Monday already. No one where I work can figure it out.

I have everything in one panel. Could it have something to do with the AutoScroll option? I don't know. It's what the client wants.

I'll try the AutoScaleMode property thing today, but if it doesn't work I have no idea how to go from there.
 
It seems to be the scrollbar, that's messing with the design. The project has been taken from me so it's not urgent anymore, but will still like to know why the thing was going wacky.

Not even the Boss could get it right and they want it with a scrollbar so it could look exactly like the form.
 
Have you tried my other suggestion (setting a breakpoint and running the program)? This should show you anywhere the size is being set programatically.

Knowing virtually nothing about the project, I can't really make any kind of educated guess, but I'm trying to help you narrow it down. Does the problem go away if you remove the scrollbar? Is it even a scrollbar control, or an automatic scrollbar from an auto-scrolling control? Do you have any third-party components on the form? Are you sure the changes you are making are being saved? (Maybe the designer-generated file has been set to read-only somehow.) Try creating a new project and re-adding all the files from the old project, and see if the problem persists. Try working with the project on another computer (i.e. a different installation of VS).

I don't know what you've tried, other than changing AutoScaleMode, and I don't know what your best course of action is since I'm not going on much here, but try to eliminate some variables, and if you can't figure it out, let us know what you've tried. Don't forget the details.
 
Back
Top