When clicking “btnLogin”, my forms decrease in size.

This may be an issue with DPI awareness. Specifically, your application is not declared as being DPI aware and when your code accesses the Microsoft.ACE.OLEDB provider, its process is set to being DPI aware. This is something that I discovered by accident a while ago, but I never seen anyone else report it happening.

The simple solution is to make your application DPI aware.

  1. From the Project Menu, select “your project name”-Properties.
  2. Select the Application Tab and click on the “View Window Settings” button.
  3. Depending on your VS version, you may or may not have the following in the file.
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
  <windowsSettings>
    <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
  </windowsSettings>
</application>
-->

If you find this block, then remove the first and last lines (“< !–” and ” –>”). If it is not present, add these lines right before the last tag in the file.

  1. Rebuild your application.

Leave a Comment