2

I am working on a multi form Windorms application in Visual Studio 2017. I have a small form set up properly (pic 1,) If I close the window and open it again Visual Studio messes up my form for no apparent reason. (pic 2,)

The only way I managed to keep this from happening when running my program is setting the buttons location at runtime in code.

This does not happen on any other form by the way.

Pic 1:

Pic 2:

The form is a FixedToolWindow and the buttons are just regular buttons. They are anchored to the bottom left and bottom right.

I can post the Designer code if anyne needs it.

Why does VS do this? Is there something I can do to make it stop?

Small edit: I closed and opened the form again, and it just keeps raising the buttons higher.

Small edit #2: After reopening the form, I can press ctrl + z to undo and the buttons go back to their original places, so it looks like this sis happening when I open the form again maybe.

WolfyD
  • 865
  • 3
  • 14
  • 29
  • What is the value of the property AutoScaleMode of your form? – Steve Sep 29 '17 at 15:44
  • No idea; but I can't strongly recommend enough considering a move to WPF (for so many reasons). It definitely doesn't have *that* problem – BradleyDotNET Sep 29 '17 at 15:45
  • @Steve It's on `Grow only` as by default – WolfyD Sep 29 '17 at 15:45
  • I had a similar problem that was caused by `.AutoScaleMode`. But you could also use a `TableLayout` design the form – Michael Sep 29 '17 at 15:45
  • 1
    Try setting it to AutoScaleMode=None – Steve Sep 29 '17 at 15:46
  • 1
    @BradleyDotNET Thanks for the comment, I do WPF from time to time but I'm not a huge fan. – WolfyD Sep 29 '17 at 15:46
  • @Steve Sorry I misread your question, autoscalemode is on `Font` I'll try that – WolfyD Sep 29 '17 at 15:47
  • @Steve I tried but it sadly made no difference it seems – WolfyD Sep 29 '17 at 15:48
  • @WolfyD If you ever want to discuss it, I'm sure the regulars in the WPF room would be happy to change your mind :) https://chat.stackoverflow.com/rooms/18165/wpf – BradleyDotNET Sep 29 '17 at 15:48
  • @BradleyDotNET heh thanks, I'll consider it :) – WolfyD Sep 29 '17 at 15:49
  • 1
    In this question there are numerous 'possible' solutions. https://stackoverflow.com/questions/1158130/visual-studio-2005-designer-moves-controls-and-resizes-form – Steve Sep 29 '17 at 15:50
  • @Steve Thanks, I'll look into this, I might have to put the buttons in a panel and use docking or something – WolfyD Sep 29 '17 at 15:53
  • 1
    Well in the end that did work, I placed my buttons in a Panel and now they just stay put in there... Still I remember this being an issue once before when I was using VS 2013 so I guess this is an old bug... Thanks for the help everyone! – WolfyD Sep 29 '17 at 15:56

0 Answers0