title: Why do controls in the WinForms designer resize on their own?
body: <p>On the main form of a Windows Forms application I'm currently writing, I have a SplitContainer with a left and right panel. Controls in the right panel that have their anchor set to right (or right and left) don't stay where I put them in the designer. Periodically, the controls will shift a pixel to the left (in the designer, not during runtime). For controls anchored both left and right, the control will shrink, but for controls just anchored right, the entire control moves left while staying the same size. Does anyone know why this happens or how to avoid it? Right now, the only thing I can do is periodically move them back. </p>
  
  <p>Note: My Windows Forms designer is currently set up with LayoutMode = SnapToGrid, Snap to Grid = true, and a grid size of 5 x 5. </p>
  
  <p>Edit: I've managed to find a way to reproduce this issue in Visual Studio 2012, finally. Create a new Windows Forms project, with the same designer settings that I'm using, and add a SplitContainer to the form. Leave it docked to fill (or use anchors to all sides). Now, set the SplitterDistance to 100 and the SplitterWidth to 5. Add a button to the right SplitPanel and set it's anchor to Bottom and Right. Move the button so that its right edge is flush against the side of the SplitPanel, then close and open the form. Magically, the button has shifted one pixel to the left. </p>
  
  <p>Here is what it looks like before you close it (in this case the button's location is 105, 175):
  <img src="https://i.stack.imgur.com/JXylL.png" alt="The form set up correctly"></p>
  
  <p>Here is what it looks like after you close and reopen it (now the button's location is 104, 175):
  <img src="https://i.stack.imgur.com/pd9mA.png" alt="The form after being closed and reopened"></p>
  
  <p>I hope that this example will help anyone reproduce the issue.</p>