1

This question is similar to this question asked here, But that question has no acceptable answer, hence posting this question …

When our developers add new controls to Form using the Designer, the position of old controls in the generated designer.vb is changed. This is causing problem when we compare the old copy of designer.vb with the new version of the file that was generated after adding new controls to approve the changes. The file comparison causes problem where instead of just showing us the differences with new controls, we have to deal with differences triggered by the change in position of some already present controls in the new file.

One workaround was to sort both the files alphabetical as this eliminates the differences that were triggered by positional changes of controls in new file, but this makes understanding and approving newly added controls difficult. We have no idea why VS studio needs/makes the positions of old controls to be re-arranged in the designer.vb file. Is there any setting in Visual studio that we can tweak to avoid this or any tool available that can be used to remedy this.

IT researcher
  • 3,274
  • 17
  • 79
  • 143
  • This is typically the result of the form being opened on a system with different a DPI or base font size than it was last saved under and the form's `AutoScaleMode` being set to either `DP`I or `Font`. This is why in newer VS versions that you are prompted with the warning "Scaling on your main display is set _XXX_%. Restart Visual Studio with 100% scaling" when you open a form with DPI scaling set. Please indicate whether or not each system is using the same scaling factor. – TnTinMn Sep 07 '20 at 13:42
  • @TnTinMn Yes, the underlying cause is because of different scaling and DPI. so we are currently changing AutoScale mode to False and are also setting AutoSize method of Controls to false as well. With AutoSize method set to true we had drawing size value change when forms were opened in different machines. Are there any other methods apart from this ? – IT researcher Sep 09 '20 at 04:35
  • There is no need to set AutoSize to False. Set the [ContainerControl.AutoScaleMode Property](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.containercontrol.autoscalemode) to `None` via the designer for the form then add a constructor to the form as shown in [this answer](https://stackoverflow.com/a/48912533/2592875). – TnTinMn Sep 09 '20 at 12:47
  • That answer is a few years old, so enable high DPI support as prescribe by the article [High DPI support in Windows Forms](https://learn.microsoft.com/en-us/dotnet/desktop/winforms/high-dpi-support-in-windows-forms?view=netframeworkdesktop-4.8#configuring-your-windows-forms-app-for-high-dpi-support) as opposed to the instructions given in the answer. – TnTinMn Sep 09 '20 at 12:48

0 Answers0