Why does Visual Studio 2015 form size changes when

2019-09-21 04:45发布

问题:

Decided to start working on a personal project creating a C++ program with a GUI. The idea that I had in mind was to practice what I'm learning in college by implementing it on a personal project.

After debugging it I noticed the size was quite off. For some reason, everything it scaling downwards when debugged. I'm guessing this has to do with Visual Studio not recognising my current screen resolution or conflict with my theme (which is an ordinary Windows 10 theme).

Please let me know if there's possibly a step I missed while implementing a GUI with C++ in Visual Studio, or if this is a known issue.

Thank you for your time and support through this early stages in my learning process.

#include "MainForm.h"

using namespace System;
using namespace System::Windows::Forms;


[STAThread]
void Main(array<String^>^ args)
{
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);

    cppGUI::MainForm form;
    Application::Run(%form);
}

回答1:

Figured out how to fix it!

I'm currently using a monitor connected to my laptop and have the laptop's monitor turned off. While re-checking the monitor settings I noticed I've been paying attention to my monitor's settings but not the settings my laptop's screen.

After checking I noticed that it was defaulting to 125%.

Managed to fix my problem after changing my laptop's screen to 100%.

Apparently, Visual Studio doesn't use your main display as it's reference. Instead, it uses the integrated display settings. So if anyone encounters a similar problem, remember to check all of your display settings (even the disabled ones).