none
Bug windows forms with Windows 10, HighDPI (DPIAwareness))

Semua Balasan

  • Hi,

    In general, we can solve some issues about DPI by setting the AutoScaleMode property of form to Dpi instead of Font.

    Try to modify the "TestWinFormsW10.cpp" like the code shown as follows:

        #include "stdafx.h"
        #include "MyPanel.h"
        using namespace System;
        using namespace System::Runtime::InteropServices;
    
        // add this statement
        [DllImport("user32.dll", EntryPoint = "SetProcessDPIAware", CallingConvention = CallingConvention::Cdecl, CharSet = CharSet::Ansi)]
        bool SetProcessDPIAware();
    
        [System::STAThreadAttribute]
        int main(array<System::String^>^ args)
        {
            OperatingSystem ^ osv = Environment::OSVersion;
            // code omitted
            Version ^ version = osv->Version;
            if (version->Major >= 6)
            {
                SetProcessDPIAware();
            }
    
            // Activation des effets visuels de Windows XP avant la création de tout contrôle
            System::Windows::Forms::Application::EnableVisualStyles();
            System::Windows::Forms::Application::SetCompatibleTextRenderingDefault(false);
            // code omitted
        }

    Regards,

    Stanly


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Jumat, 23 November 2018 09.58
  • Adding SetProcessDPIAware(); doesn't change anything. I assume that my manifest and config files already enabled it.

    Changing AutoScaleMode::Font to AutoScaleMode::Dpi doesn't change anything either (it can become a total mess under W7 and W10 when using Dpi and AutoScaleDimensions, but it never made it work under W10)


    • Diedit oleh C.h.a.c.h.a_ Senin, 26 November 2018 14.47 typo
    Jumat, 23 November 2018 10.43
  • Hi,

    I'm not sure if it is a BUG, and according to your description, I'm afraid this issue is more related about Windows 10 system, try to ask this question at Windows 10 forum.

    Regards,

    Stanly


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Senin, 26 November 2018 02.36