none
Windows forms apps change size when I run them

    Question

  • So I can't for the life of my find an answer to fix this INCREDIBLY ANNOYING functionality in Visual Studio.  I've been searching for hours.  So when I create a windows forms app I set specific size (one that I do NOT want the app to deviate from).  But for some reason Visual Studio will change the size a little bit when I go to run the program, it will shrink horizontally and vertically.  I'm running on a 4K display, could that be the issue?!?  I've tried using every single "auto scaling" setting I can find in the designer but only one setting seems to keep the correct aspect ratio I'm trying to set (I can tell by the gaps surrounding the PictureBox I've added to the form) but then the app explodes and is bigger than my display!  I realize this is probably due to very poor implementation of Visual Studio on 4K displays, but I just have to believe someone has found a work around.  The issue arises from using a picture for a tutorial I'm trying to follow.  Since (for really some unknown reason, I realize it's due to everything being based on pixels, but that doesn't stop Adobe from having this functionality in their products) you can't zoom in when using the designer, I have to increase the size of the image along with the size of everything on the form.  

    I realize this is a very ranty posting, but I'm really just at my whits end.  Running into so many issues with Visual Studio just sucks all the desire out of me to keep going.

    Friday, June 17, 2016 2:33 AM

Answers

  • Hi a-calovl,

    >>  I've tried using every single "auto scaling" setting I can find in the designer but only one setting seems to keep the correct aspect ratio I'm trying to set

    Do you set the AutoScaleMode property for the forms in your WinForm designer? Please set it as Font to let your project scaling all the controls based on your system fonts. If you set it as Dpi, your application will changed based on the screen resolution.

    In addition, please try set the Windows displaying to let it auto scaling based on your settings. For example, on Windows 10, please open the Settings -> System -> Display -> Change the size of text, apps and other items to change the settings.

    As far as I know, the WinForms application's resolution will be changed based on the screen resolution, which is a known issue for WinForms application. Please refer to the Design Guidelines in following link, which provide some suggestions on the WinForm application design. Hope that can help you.

    http://stackoverflow.com/questions/22735174/how-to-write-winforms-code-that-auto-scales-to-system-font-and-dpi-settings

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, June 20, 2016 2:21 AM
    Moderator