I am having an issue with button controls moving when I close my form in the editor in VS 2012. I am working in C# exclusively. This is diving me nuts as I have to reposition the controls every time I open the designer.
Form Size 995, 625
Button Location
------ --------
Save button 617, 575
Delete button 701, 575
Clear button 785, 575
Cancel button 869, 575
Buttons are anchored Bottom,Right
Form Maximum size is 0,0
There is a TabControl above these buttons. I have had this issue before and I am pretty sure it involved a form with a TabControl as well.
There are a couple layers of inheritance below this form, but both are defined smaller. The buttons in play here are inherited from the form just below this one. On that form they are anchored Top,Left so I would think my controls would be moving up and left if they were being effected by that forms positioning. They consistently move down and right.
Steps that reproduce.
- Position the controls as above. (No further edits)
- Save the form. (no visible change yet)
- Close the form.
- Reopen the form and the controls are located as follows:
Button Location
Save button 852, 664 (off visible form)
Delete button 936, 631 (off visible form)
Clear button 1020, 630 (off visible form)
Cancel button 1104, 664 (off visible form)
These locations vary. Sometimes they are still on the form, or partially on-form just in a lower position and no longer aligned. They are always lower and to the right as if they were being effected by a changing form size during the closing process.
If I make the form larger in the designer, they just keep moving down and right staying off-form.
I have resorted to positioning them programmatically for now, but would rather understand what is happening so as to prevent it in the future.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…