Reputation: 2293
I'm having a variety of weird issues with the WinForms Designer and wondering if anyone knows of a fix. I'll just lay out some of the symptoms here (in case they're all symptoms of the same problem).
I have an issue where my tabpage controls are getting "compressed" into the top left corner when I close and re-open the designer for the form.
The controls that seem to be affected are anchored to the Bottom (sometimes Bottom-Left, sometimes Bottom-Right but always includes "Bottom"). If I move the controls to where they're supposed to be, save, close the designer, then reopen it - they're all "compressed" back in the top left corner.
Even weirder is that the properties shown in the properties pane for some of the controls (the checkbox for instance) does not match what is in the Form.Designer.cs file (Form.Designer.cs has the correct location values):
When running my application, it shows the "compressed" controls and doesn't reflect the values in the Form.Designer.cs file (which are correct).
Finally, sometimes when I go to save the file, Visual Studio pops up a "Save As" dialog box as if it didn't know where the file was actually located, but then prompts me to overwrite the exact same file (even if there were no changes).
If anyone has any ideas of what could be causing these things, that'd be very helpful! I have tried investigating the "Document Outline" window to see if there is some odd parenting going on (there wasn't), tried tweaking the Form.Designer.cs file to fix it (it didn't so I undid those changes), and a couple other things.
Upvotes: 1
Views: 505
Reputation: 2293
Well, I didn't ever find out the real reason this was happening, but I found the cause (and a workaround solution).
The cause is my usercontrol on the "Editor" tab page (everything inside that red rectangle is part of one usercontrol):
I am not sure why this would cause all the "rearranging" issues - until recently I had all these controls on the tab page themselves (without the usercontrol "parent"). But maybe the Designer is getting overloaded somehow and is placing controls in weird locations.
Whatever the cause is, the "fix" (if you could call it that) was to remove the usercontrol from the designer and add it to the form at startup. I do all the designing of the usercontrol in its own designer any way so this should be sufficient for now.
If anyone has any ideas as to what could truly have been causing this, let me know.
Upvotes: -1